最受欢迎主题: Multilogin X, Multilogin 6,
Multilogin X CookieRobot 简介
目录
备受期待的 Multilogin X 版CookieRobot Multilogin X CookieRobot 🔥在本指南中,我们将向您展示如何使用它轻松加快您的个人资料预热过程。CookieRobot 能够浏览每个列出的网站并收集尽可能多的cookie ,使您的个人资料看起来更加真实!✨
CookieRobot通过我们新的 Script Runner 端点运行!⚡在我们的Postman页面Documenter: Script Runner中了解如何使用它!
保持更新以确保操作顺利进行:Script Runner 适用于Agent 1.37.4 或更新版本。
使用CookieRobot设置脚本运行器
需要最低限度的技术技能? Script Runner 是一款用户友好的工具,可轻松运行自动化脚本,实现对多个配置文件的批量操作!
要运行CookieRobot脚本,您必须调用Script Runner 端点 URL : https://launcher.mlx.yt:45001/ api /v1/run_script
要运行CookieRobot ,您需要调用 Script Runner URL 并包含请求正文(JSON),格式如下例所示:
{
"script_file": "cookie_robot.py",
"profile_ids": [
{
"profile_id": "profile uuid"
},
{
"profile_id": "profile uuid",
"is_headless": true
}
],
"script_params": [
{
"name": "websites",
"value": ["https://youtube.com","https://google.com","https://fb.com","https://amazon.com"]
},
{
"name": "randomOrder",
"value": true
},
{
"name": "countMode",
"value": 0.7
},
{
"name": "processCookieConsent",
"value": true
}
]
}
Custom参数
按照上面的例子,您可以调整以下参数:
“script_file”
目录中的CookieRobot脚本文件的名称(例如: cookie_robot.py
)。脚本默认存储在以下目录中:
- Windows :
C:\Users\%username%\mlx\deps\scripts
- macOS :
/Users/%username%/mlx/scripts
- Linux :
/home/%username%/mlx/scripts
“profile_ids”
包含配置文件ID的列表,结构如下:
-
“profile_id”
– 唯一个人资料ID号码 -
“is_ headless ”
– (可选)在headless模式下运行可能会限制机器人与某些页面元素的交互
“script_params”
包含一组可自定义参数的列表,简单表示为:
-
“name”
– 参数名称 -
“value”
– 指定的值(字符串、整数、浮点数、JSON 等)
“websites”
如果“websites”
参数中没有提供任何内容,机器人将使用其默认列表:
websites = [
"https://aliexpress.com",
"https://amazon.com",
"https://ebay.com",
"https://fiverr.com",
"https://google.com",
"https://reddit.com",
"https://twitch.com",
"https://twitter.com",
"https://yahoo.com",
"https://youtube.com",
"https://en.wikipedia.org"
]
“randomOrder”
“fractionMode”
想要运行网站的一部分,而不是全部?查看如何使用:
- 选择 0.0 到 1.0 之间的浮点数来设置要运行的站点比例
- 确保
“randomOrder”
设置为“true”
- 例如:
fractionMode = “0.5”
→ 以随机顺序运行 50% 的网站列表
- 例如:
“processCookieConsent”
由于 GDPR(什么是 GDPR? )等隐私法,许多网站都会显示“允许Cookie ”按钮,该法案要求在跟踪Cookie之前获得用户同意。
- 设置为
“true”
→ CookieRobot将自动查找并尝试点击同意按钮(默认) - 设置为
“false”
→它将忽略 cookie 弹出窗口,这在以下情况下很有用:- 您正在浏览不显示 Cookie 横幅的非欧盟网站
- 您不关心 GDPR 合规性(例如,使用欧盟以外的代理)
想要查看代码应用程序吗?
在此示例中,设置在payload
对象中的run_script()
内配置。 功能:
- CookieRobot将通过文件
cookie_robot.py
运行。 - 使用的配置文件ID设置为
ced16576-a67b-4ae5-8459-c07991d50f27
和ec0cf95f-b199-4b1c-b394-af1e01ac9c09
- 两种配置文件都将在非headless模式下运行
- 这些网站是 Yahoo.com 和 Amazon.com,将按随机顺序访问它们
- 由于
fractionMode
设置为1,所以列出的网站100%都会被访问。 - 如果出现CookieRobot同意通知,它将自动接受
import logging
import requests
import json
# In project root you need a file called token with your auth token in there
def setup_logging():
"""Set up logging configuration."""
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
handlers=[
logging.FileHandler("script_runner.log"),
logging.StreamHandler()
]
)
def get_token_from_file():
"""Read the token from a file called 'token' in the project root."""
try:
with open("token", "r") as file:
token = file.read().strip()
return token
except FileNotFoundError:
logging.error("Token file not found in the project root.")
raise
except Exception as e:
logging.error("An error occurred while reading the token file: %s", str(e))
raise
def run_script():
url = "https://launcher.mlx.yt:45001/api/v1/run_script"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {get_token_from_file()}"
}
payload = {
"script_file": "cookie_robot.py",
"profile_ids": [
{
"profile_id": "ced16576-a67b-4ae5-8459-c07991d50f27",
"is_headless": False
},
# {
# "profile_id": "ec0cf95f-b199-4b1c-b394-af1e01ac9c09",
# "is_headless": False
# },
],
"script_params": [
{
"name": "websites",
"value": ["yahoo.com", "amazon.com"]
},
{
"name": "randomOrder",
"value": True
},
{
"name": "fractionMode",
"value": 1
},
{
"name": "processCookieConsent",
"value": True
}
]
}
try:
logging.info("Payload to send: %s", json.dumps(payload, indent=4))
logging.info("Sending request to the script runner endpoint...")
response = requests.post(url, headers=headers, data=json.dumps(payload), timeout=30)
if response.status_code == 200:
logging.info("Script executed successfully.")
logging.info("Response: %s", response.json())
else:
logging.error("Failed to execute script. Status code: %d", response.status_code)
logging.error("Response: %s", response.text)
except requests.exceptions.RequestException as e:
logging.error("An error occurred while making the request: %s", str(e))
if __name__ == "__main__":
setup_logging()
run_script()