Hướng Dẫn Automate Profiles Gologin Antidetect Browser Free Forever Offline by C# và Python

Gologin cung cấp tính năng tạo profile Antidetect miễn phí, cho phép bạn quản lý thoải mái nhiều tài khoản mà không lo bị checkpoint. Bài hướng dẫn này sẽ giúp bạn tận dụng Gologin offline kết hợp với Selenium để tự động hóa các tác vụ trên trình duyệt với profile Antidetect.

Lưu ý: Để sử dụng hướng dẫn này, bạn cần có kiến thức lập trình cơ bản.

Gologin API và Tích Hợp với Selenium

Gologin cung cấp API giúp bạn kết nối và tích hợp với các chương trình khác để tự động hóa quy trình bằng bot do chính bạn viết. Tuy nhiên, việc sử dụng API yêu cầu khả năng lập trình.

You can connect to API and integrate Gologin with other programs to, for instance, automate some processes by using self-written bots. Keep in mind that you must be able to program on your own to use our API.

Start profile offline to automation with selenium

C#

private void StartProfile()
{
    try
    {
        string path = @"C:\Profiles_Folder\profileName_profileID";
        string serverUrl = "http://localhost:36969/start?path=" + path + "&version=123&os=win";
        using (var client = new WebClient())
        {
            string driverInfo = client.DownloadString(serverUrl);
            dynamic json = Newtonsoft.Json.JsonConvert.DeserializeObject(driverInfo);
            if (json.status == "success")
            {
                string debuggerAddress = json.debuggerAddress;
                string drive_location = json.chromeDriverPath;

                ChromeDriverService service;
                service = ChromeDriverService.CreateDefaultService(Directory.GetCurrentDirectory(), drive_location);
                service.HideCommandPromptWindow = true;

                ChromeOptions options = new ChromeOptions();
                options.DebuggerAddress = debuggerAddress;

                var driver = new ChromeDriver(service, options);
                driver.Navigate().GoToUrl("https://iphey.com");
//Run automation code here
                driver.Close(); 
                driver.Quit();
            }
        }
    }
    catch
    {
        
    }
}

Python

import json
from time import sleep
import requests
from selenium import webdriver

def main():
    path = r"C:\Profiles_Folder\profileName_profileID"
    server_url = f"http://localhost:36969/start?path={path}&version=123&os=win"

    try:
        response = requests.get(server_url)
        response.raise_for_status()  # Raise an exception if the request was unsuccessful
        driver_info = response.text
        json_data = json.loads(driver_info)

        if json_data.get("status") == "success":
            debugger_address = json_data.get("debuggerAddress")
            chrome_driver_path = json_data.get("chromeDriverPath")

            chrome_options = webdriver.ChromeOptions()
            chrome_options.add_experimental_option("debuggerAddress", debugger_address)

            driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options)
            driver.get("https://iphey.com")
            sleep(3.0)
# Run automation code here
            driver.close();
            driver.quit()
        else:
            print("Error: Contact admin @ToolsKiemTrieuDo to support")
    except requests.RequestException as ex:
        print(f"Error: {ex}")

if __name__ == "__main__":
    main()

All in one