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

ToolsKiemTrieuDo

Mod
Vip Member
Bài viết
74
Điểm tương tác
4
Điểm
8

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

image-8.png

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#
Mã:
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
Mã:
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()
 
Chỉnh sửa lần cuối:
Bên trên