selenium-dolphin


Nameselenium-dolphin JSON
Version 1.0.6 PyPI version JSON
download
home_pagehttps://github.com/DedInc/selenium_dolphin
SummaryA Python module for controlling Dolphin browser profiles using Selenium/Pyppeteer. It also has a Dolphin API for creating, editing, and deleting profiles.
upload_time2024-04-19 11:27:08
maintainerNone
docs_urlNone
authorMaehdakvan
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🐬 selenium-dolphin

A Python module for controlling Dolphin browser profiles using Selenium or Pyppeteer πŸ€–. It also has a Dolphin API for creating, editing, and deleting profiles.

## ⚠️ Warning!

```
Selenium and some features working only if Dolphin Anty is opened!!! (Local API wrapper must be launched!)
```

## πŸš€ Quickstart

### Selenium

```python
import random
import selenium_dolphin as dolphin
from selenium_dolphin import DolphinAPI, STABLE_CHROME_VERSION
from selenium.webdriver.chrome.options import Options

api = DolphinAPI(api_key='Your Api Key')

response = api.get_profiles()
if response['data']:
    profile_id = response['data'][-1]['id']
    if profile_id:
        api.delete_profiles([profile_id])

fingerprint = []
while not fingerprint:
  fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')

data = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)

profile_id = api.create_profile(data)['browserProfileId']

response = dolphin.run_profile(profile_id)
port = response['automation']['port']

##### custom chrome options demonstration #####
options = Options()
options.add_argument("--start-maximized")
###############################################

driver = dolphin.get_driver(options=options, port=port)
driver.get('https://google.com/')
print(driver.title)
driver.quit()

dolphin.close_profile(profile_id)
```

### Pyppeteer

```python
import asyncio
import random
import selenium_dolphin as dolphin
from selenium_dolphin import DolphinAPI, STABLE_CHROME_VERSION

api = DolphinAPI(api_key='Your Api Key')

response = api.get_profiles()
if response['data']:
    profile_id = response['data'][-1]['id']
    if profile_id:
        api.delete_profiles([profile_id])

fingerprint = []
while not fingerprint:
  fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')

data = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)

profile_id = api.create_profile(data)['browserProfileId']

response = dolphin.run_profile(profile_id)
port = response['automation']['port']
ws_endpoint = response['automation']['wsEndpoint']

async def main():
    browser = await dolphin.get_browser(ws_endpoint, port)
    pages = await browser.pages()
    page = pages[0]
    await page.goto('http://google.com/')
    await asyncio.sleep(5)
    await browser.disconnect()

asyncio.run(main())
dolphin.close_profile(profile_id)
```

## πŸ“ Get profiles

```python
from selenium_dolphin import DolphinAPI

api = DolphinAPI() # you can enter api_key='Your key' inside instance
```

You can [get an API key here](https://dolphin-anty.com/panel/#/api), but if the token is present in the logs, the module can automatically retrieve it.

```python
response = api.get_profiles() 

print(response)
```

### Pagination and limitation

```python
response = api.get_profiles(page=1, limit=300) # default page - 1 limit - 50
```

## πŸ†• Create profile

```python
fingerprint = api.generate_fingerprint(platform='linux') # you can use platform windows/linux/macos, also you can use screen='1366x768' and browser_version='116' if you need

data = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint) # also you can add tags=['test', 'selenium_dolphin'] and other

response = api.create_profile(data)  

print(response)
```

## πŸ“ Custom data for profile

After this line:

```python
data = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint)
```

Use for:

### Geolocation πŸ—ΊοΈ

```python
data.update({'geolocation':{
  'mode': 'manual',
  'latitude': 33.4,
  'longitude': 55.2,
  'accuracy': 318
}})
```

### Timezone ⏰

```python
data.update({'timezone':{
  'mode':'manual',
  'value':'Pacific/Johnston'
}})
```

### Locale 🌎

```python
data.update({'locale':{
  'mode':'manual',
  'value':'af_ZA' 
}})
```

### Proxy πŸ•ΈοΈ

```python
data.update({'proxy':{
  'name': 'http://37.19.220.129:8443',
  'host': '37.19.220.129',
  'port': '8443',
  'type': 'http' 
}})
# also you can add 'login' and 'password' args
```

### and others...

## ✏️ Edit profile

```python 
from selenium_dolphin import DolphinAPI

api = DolphinAPI()

fingerprint = api.generate_fingerprint(platform='windows') 

data = api.fingerprint_to_profile(name='mega profile', fingerprint=fingerprint)

response = api.edit_profile(190438486, data)

print(response)
```

## πŸ—‘οΈ Delete profile(s)

```python
from selenium_dolphin import DolphinAPI

api = DolphinAPI()

response = api.delete_profiles([190438486]) # you need specify list ids of profiles  

print(response)
```

## πŸ” Other features

### Proxy checker

```python
response = api.check_proxy(host='37.19.220.129', port='8443', type='http')

print(response)

# also you can use other kwargs (login='username', password='password')
```

Response:

```json
{"success": true, "country": "US", "region": "Virginia", "city": "Ashburn", "ip": "37.19.220.178", "timezone": "America/New_York"}
```

### MAC Address generator

```python
response = api.generate_mac()  

print(response) 
```

Response:

```json
{"success": true, "macAddress": "8E:DD:48:08:F1:31"}
```

## Conclusion

selenium-dolphin provides a straightforward way to control Dolphin browser profiles for automation testing using Selenium or Pyppeteer πŸ€–. With the Dolphin API, you can easily create, customize, and manage profiles right from Python. Give it a try for your next web scraping or test automation project! 🐬

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DedInc/selenium_dolphin",
    "name": "selenium-dolphin",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Maehdakvan",
    "author_email": "visitanimation@google.com",
    "download_url": "https://files.pythonhosted.org/packages/90/12/26175dbeeb80767c0bde51311ef8afafce7f92a1dfaa31c2aeff08beffec/selenium_dolphin-1.0.6.tar.gz",
    "platform": null,
    "description": "# \ud83d\udc2c selenium-dolphin\r\n\r\nA Python module for controlling Dolphin browser profiles using Selenium or Pyppeteer \ud83e\udd16. It also has a Dolphin API for creating, editing, and deleting profiles.\r\n\r\n## \u26a0\ufe0f Warning!\r\n\r\n```\r\nSelenium and some features working only if Dolphin Anty is opened!!! (Local API wrapper must be launched!)\r\n```\r\n\r\n## \ud83d\ude80 Quickstart\r\n\r\n### Selenium\r\n\r\n```python\r\nimport random\r\nimport selenium_dolphin as dolphin\r\nfrom selenium_dolphin import DolphinAPI, STABLE_CHROME_VERSION\r\nfrom selenium.webdriver.chrome.options import Options\r\n\r\napi = DolphinAPI(api_key='Your Api Key')\r\n\r\nresponse = api.get_profiles()\r\nif response['data']:\r\n    profile_id = response['data'][-1]['id']\r\n    if profile_id:\r\n        api.delete_profiles([profile_id])\r\n\r\nfingerprint = []\r\nwhile not fingerprint:\r\n  fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')\r\n\r\ndata = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)\r\n\r\nprofile_id = api.create_profile(data)['browserProfileId']\r\n\r\nresponse = dolphin.run_profile(profile_id)\r\nport = response['automation']['port']\r\n\r\n##### custom chrome options demonstration #####\r\noptions = Options()\r\noptions.add_argument(\"--start-maximized\")\r\n###############################################\r\n\r\ndriver = dolphin.get_driver(options=options, port=port)\r\ndriver.get('https://google.com/')\r\nprint(driver.title)\r\ndriver.quit()\r\n\r\ndolphin.close_profile(profile_id)\r\n```\r\n\r\n### Pyppeteer\r\n\r\n```python\r\nimport asyncio\r\nimport random\r\nimport selenium_dolphin as dolphin\r\nfrom selenium_dolphin import DolphinAPI, STABLE_CHROME_VERSION\r\n\r\napi = DolphinAPI(api_key='Your Api Key')\r\n\r\nresponse = api.get_profiles()\r\nif response['data']:\r\n    profile_id = response['data'][-1]['id']\r\n    if profile_id:\r\n        api.delete_profiles([profile_id])\r\n\r\nfingerprint = []\r\nwhile not fingerprint:\r\n  fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')\r\n\r\ndata = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)\r\n\r\nprofile_id = api.create_profile(data)['browserProfileId']\r\n\r\nresponse = dolphin.run_profile(profile_id)\r\nport = response['automation']['port']\r\nws_endpoint = response['automation']['wsEndpoint']\r\n\r\nasync def main():\r\n    browser = await dolphin.get_browser(ws_endpoint, port)\r\n    pages = await browser.pages()\r\n    page = pages[0]\r\n    await page.goto('http://google.com/')\r\n    await asyncio.sleep(5)\r\n    await browser.disconnect()\r\n\r\nasyncio.run(main())\r\ndolphin.close_profile(profile_id)\r\n```\r\n\r\n## \ud83d\udcdd Get profiles\r\n\r\n```python\r\nfrom selenium_dolphin import DolphinAPI\r\n\r\napi = DolphinAPI() # you can enter api_key='Your key' inside instance\r\n```\r\n\r\nYou can [get an API key here](https://dolphin-anty.com/panel/#/api), but if the token is present in the logs, the module can automatically retrieve it.\r\n\r\n```python\r\nresponse = api.get_profiles() \r\n\r\nprint(response)\r\n```\r\n\r\n### Pagination and limitation\r\n\r\n```python\r\nresponse = api.get_profiles(page=1, limit=300) # default page - 1 limit - 50\r\n```\r\n\r\n## \ud83c\udd95 Create profile\r\n\r\n```python\r\nfingerprint = api.generate_fingerprint(platform='linux') # you can use platform windows/linux/macos, also you can use screen='1366x768' and browser_version='116' if you need\r\n\r\ndata = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint) # also you can add tags=['test', 'selenium_dolphin'] and other\r\n\r\nresponse = api.create_profile(data)  \r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\udcdd Custom data for profile\r\n\r\nAfter this line:\r\n\r\n```python\r\ndata = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint)\r\n```\r\n\r\nUse for:\r\n\r\n### Geolocation \ud83d\uddfa\ufe0f\r\n\r\n```python\r\ndata.update({'geolocation':{\r\n  'mode': 'manual',\r\n  'latitude': 33.4,\r\n  'longitude': 55.2,\r\n  'accuracy': 318\r\n}})\r\n```\r\n\r\n### Timezone \u23f0\r\n\r\n```python\r\ndata.update({'timezone':{\r\n  'mode':'manual',\r\n  'value':'Pacific/Johnston'\r\n}})\r\n```\r\n\r\n### Locale \ud83c\udf0e\r\n\r\n```python\r\ndata.update({'locale':{\r\n  'mode':'manual',\r\n  'value':'af_ZA' \r\n}})\r\n```\r\n\r\n### Proxy \ud83d\udd78\ufe0f\r\n\r\n```python\r\ndata.update({'proxy':{\r\n  'name': 'http://37.19.220.129:8443',\r\n  'host': '37.19.220.129',\r\n  'port': '8443',\r\n  'type': 'http' \r\n}})\r\n# also you can add 'login' and 'password' args\r\n```\r\n\r\n### and others...\r\n\r\n## \u270f\ufe0f Edit profile\r\n\r\n```python \r\nfrom selenium_dolphin import DolphinAPI\r\n\r\napi = DolphinAPI()\r\n\r\nfingerprint = api.generate_fingerprint(platform='windows') \r\n\r\ndata = api.fingerprint_to_profile(name='mega profile', fingerprint=fingerprint)\r\n\r\nresponse = api.edit_profile(190438486, data)\r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\uddd1\ufe0f Delete profile(s)\r\n\r\n```python\r\nfrom selenium_dolphin import DolphinAPI\r\n\r\napi = DolphinAPI()\r\n\r\nresponse = api.delete_profiles([190438486]) # you need specify list ids of profiles  \r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\udd0d Other features\r\n\r\n### Proxy checker\r\n\r\n```python\r\nresponse = api.check_proxy(host='37.19.220.129', port='8443', type='http')\r\n\r\nprint(response)\r\n\r\n# also you can use other kwargs (login='username', password='password')\r\n```\r\n\r\nResponse:\r\n\r\n```json\r\n{\"success\": true, \"country\": \"US\", \"region\": \"Virginia\", \"city\": \"Ashburn\", \"ip\": \"37.19.220.178\", \"timezone\": \"America/New_York\"}\r\n```\r\n\r\n### MAC Address generator\r\n\r\n```python\r\nresponse = api.generate_mac()  \r\n\r\nprint(response) \r\n```\r\n\r\nResponse:\r\n\r\n```json\r\n{\"success\": true, \"macAddress\": \"8E:DD:48:08:F1:31\"}\r\n```\r\n\r\n## Conclusion\r\n\r\nselenium-dolphin provides a straightforward way to control Dolphin browser profiles for automation testing using Selenium or Pyppeteer \ud83e\udd16. With the Dolphin API, you can easily create, customize, and manage profiles right from Python. Give it a try for your next web scraping or test automation project! \ud83d\udc2c\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python module for controlling Dolphin browser profiles using Selenium/Pyppeteer. It also has a Dolphin API for creating, editing, and deleting profiles.",
    "version": "1.0.6",
    "project_urls": {
        "Bug Tracker": "https://github.com/DedInc/selenium_dolphin/issues",
        "Homepage": "https://github.com/DedInc/selenium_dolphin"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "168bd8300c69e2b40e776961a8ae11031cc611ab2cdb071b777b8ea2fa2f9db5",
                "md5": "de4a18c4064371c95e4484c0fd2a3a97",
                "sha256": "153b9e3ea462f0629416e9af39881f511123b51a91e264d62f6c95d093978b70"
            },
            "downloads": -1,
            "filename": "selenium_dolphin-1.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "de4a18c4064371c95e4484c0fd2a3a97",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 9424,
            "upload_time": "2024-04-19T11:27:07",
            "upload_time_iso_8601": "2024-04-19T11:27:07.355210Z",
            "url": "https://files.pythonhosted.org/packages/16/8b/d8300c69e2b40e776961a8ae11031cc611ab2cdb071b777b8ea2fa2f9db5/selenium_dolphin-1.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "901226175dbeeb80767c0bde51311ef8afafce7f92a1dfaa31c2aeff08beffec",
                "md5": "6e949ffba41c2440276976781e858bf3",
                "sha256": "76566ef4f155ef40df60bf5901794d426180713d1f30e11d906792c47595a7a7"
            },
            "downloads": -1,
            "filename": "selenium_dolphin-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "6e949ffba41c2440276976781e858bf3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10101,
            "upload_time": "2024-04-19T11:27:08",
            "upload_time_iso_8601": "2024-04-19T11:27:08.971817Z",
            "url": "https://files.pythonhosted.org/packages/90/12/26175dbeeb80767c0bde51311ef8afafce7f92a1dfaa31c2aeff08beffec/selenium_dolphin-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 11:27:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DedInc",
    "github_project": "selenium_dolphin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "selenium-dolphin"
}
        
Elapsed time: 0.25666s