ITADN
klept0/MS-Rewards-Farmer
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈

一个使用 Selenium 辅助处理 M$ Rewards 的“简单”Python 应用程序

Static Badge MIT Maintained GitHub contributors GitHub issues

[!IMPORTANT] 如果你在进行多账号操作并滥用本服务——* 请勿抱怨封禁!!!*

[!CAUTION] 使用本方法风险自负,M$ 可能会封禁你的账户(且我对此不承担责任)

不要同时运行多个账户。

每 5 个账户不要使用超过一个电话号码。

每天不要兑换超过一个奖励。

原始 bot 由 @charlesbel 创建 - 由 @klept0 及志愿者社区重构/更新/维护。

欢迎并感谢提交 PULL REQUESTS!

安装

  1. Create a virtual environment using venv:
    python -m venv venv
  2. Activate the virtual environment:
  • 在 Windows 上:

    venv\Scripts\activate
  • 在 macOS/Linux 上:

    source venv/bin/activate
  1. 使用以下命令安装依赖项:
    pip install -r requirements.txt

或者,如果正在开发或运行测试,请使用以下命令安装开发依赖项:

 pip install -r requirements-dev.txt

使用以下命令升级所有必需项: pip install --upgrade -r requirements.txt

  1. 确保已安装 Chrome

  2. (仅限 Windows) 确保已安装 Visual C++ 可再发行组件 DLL

如果没有,请从 此 链接 安装当前的 "vc_redist.exe" 并重启您的计算机

  1. 使用以下参数运行脚本:

    python main.py -C
  2. 打开生成的 config.yaml 文件,并使用您的信息进行编辑。

"totp" 字段不是必需的,仅当您使用 TOTP 密钥进行 2FA 时才输入(如果 省略,请勿将其保留为空字符串,而是完全删除该行)。

"proxy" 字段不是必需的,如果您不想使用代理,可以省略它(不要 将其保留为空字符串,请完全删除该行)。

您可以根据需要添加或删除账户。

"apprise.urls" 字段不是必需的,如果您不想接收通知,可以将其删除。

  1. 运行脚本:
    python main.py

(仅限 Windows)您还可以运行脚本包装器,该包装器会检测您的 python 安装, 并在脚本崩溃时重新运行该脚本,使用 .\run.ps1(有关更多 信息,请参阅 .\run.ps1 -help)。若要允许无需确认即可执行脚本,请使用以下命令: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

  1. (仅限 Windows) 您可以通过生成任务计划程序 XML 文件来设置自动执行。

如果你是 Windows 用户,请运行 generate_task_xml.py 脚本以创建一个 .xml 文件。 生成文件后,将其导入任务计划程序以安排脚本的自动执行。 这将允许脚本在指定时间运行,而无需手动 干预。

要将 XML 文件导入任务计划程序, 请参阅 此指南

配置文件

此处列出的所有变量都可以添加到你的 config.yaml 配置文件中,此处表示的值代表 默认值,除非另有说明。

[!CAUTION] 请勿将此用作你的配置。这是一个展示配置可能性的示例, 而不是最适合你的配置。这样做只会阻止使用默认值, 并导致阻止更新(例如被忽略的活动)。 只有当你想要更改某个变量时,才应将其添加到你的配置文件中。

# config.yaml
apprise: # 'apprise' is the name of the service used for notifications https://github.com/caronc/apprise
  enabled: true  # set it to false to disable apprise globally, can be overridden with command-line arguments.
  notify:
    incomplete-activity: true # set it to false to disable notifications for incomplete activities
    uncaught-exception: true # set it to false to disable notifications for uncaught exceptions
    login-code: true # set it to false to disable notifications for the temporary M$ Authenticator login code
  summary: ON_ERROR # set it to ALWAYS to always receive a summary about your points progression or errors, or to 
  # NEVER to never receive a summary, even in case of an error. 
  urls: # add apprise urls here to receive notifications on the specified services :
    # https://github.com/caronc/apprise#supported-notifications
    # Empty by default.
    - discord://{WebhookID}/{WebhookToken} # Exemple url 
browser:
  geolocation: US # Replace with your country code https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.
  # Detected by default, can be overridden with command-line arguments.
  language: en # Replace with your language code https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes.
  # Detected by default, can be overridden with command-line arguments.
  visible: false # set it to true to show the browser window, can be overridden with command-line arguments.
  proxy: null # set the global proxy using the 'http://user:pass@host:port' syntax.
  # Override per-account proxies. Can be overridden with command-line arguments.
rtfr: true # If true, display the "read the readme" message at the start of the script and prevent the script
# from running. Default is false.
logging:
  level: INFO # Set to DEBUG, WARNING, ERROR or CRITICAL to change the level of displayed information in the terminal
  # See https://docs.python.org/3/library/logging.html#logging-levels. Can be overridden with command-line arguments.
retries:
  backoff-factor: 120 # The base wait time between each retries. Multiplied by two each try.
  max: 4 # The maximal number of retries to do
  strategy: EXPONENTIAL # Set it to CONSTANT to use the same delay between each retries.
  # Else, increase it exponentially each time.
cooldown:
  min: 300 # The minimal wait time between two searches/activities
  max: 600 # The maximal wait time between two searches/activities
search:
  type: both # Set it to 'mobile' or 'desktop' to only complete searches on one plateform,
  # can be overridden with command-line arguments.
accounts: # The accounts to use. You can put zero, one or an infinite number of accounts here.
  # Empty by default, can be overridden with command-line arguments.
  - email: Your Email 1 # replace with your email
    password: Your Password 1 # replace with your password
    totp: 0123 4567 89ab cdef # replace with your totp, or remove it
    proxy: http://user:pass@host1:port # replace with your account proxy, or remove it
  - email: Your Email 2 # replace with your email
    password: Your Password 2 # replace with your password
    totp: 0123 4567 89ab cdef # replace with your totp, or remove it
    proxy: http://user:pass@host2:port # replace with your account proxy, or remove it

用法

usage: main.py [-h] [-c CONFIG] [-C] [-v] [-l LANG] [-g GEO] [-em EMAIL] [-pw PASSWORD]
               [-p PROXY] [-t {desktop,mobile,both}] [-da] [-d] [-r]

A simple bot that uses Selenium to farm M$ Rewards in Python

options:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Specify the configuration file path
  -C, --create-config   Create a fillable configuration file with basic settings and given
                        ones if none exists
  -v, --visible         Visible browser (Disable headless mode)
  -l LANG, --lang LANG  Language (ex: en) see https://serpapi.com/google-languages for options
  -g GEO, --geo GEO     Searching geolocation (ex: US) see https://serpapi.com/google-trends-
                        locations for options (should be uppercase)
  -em EMAIL, --email EMAIL
                        Email address of the account to run. Only used if a password is given.
  -pw PASSWORD, --password PASSWORD
                        Password of the account to run. Only used if an email is given.
  -p PROXY, --proxy PROXY
                        Global Proxy, supports http/https/socks4/socks5 (overrides config per-
                        account proxies) `(ex: http://user:pass@host:port)`
  -t {desktop,mobile,both}, --searchtype {desktop,mobile,both}
                        Set to search in either desktop, mobile or both (default: both)
  -da, --disable-apprise
                        Disable Apprise notifications, useful when developing
  -d, --debug           Set the logging level to DEBUG
  -r, --reset           Delete the session folder and temporary files and kill all chrome
                        processes. Can help resolve issues.

At least one account should be specified, either using command line arguments or a
configuration file. All specified arguments will override the configuration file values

你可以随时使用 python main.py -h 显示此消息。

功能

  • 使用当前 User-Agents 进行 Bing 搜索(桌面版和移动版)
  • 自动完成每日任务
  • 自动完成打卡
  • 自动完成其他推广任务
  • 无头模式
  • 多账户管理
  • 会话存储
  • 2FA 支持
  • 通过 Apprise 发送通知 - 不再局限于 Telegram 或 Discord
  • 代理支持(3.0)- 它们必须是高质量代理
  • 将日志记录到 CSV 文件以跟踪积分

贡献

Fork 此仓库并:

  • 如果提供 bug 修复,请向 master 分支创建 pull request。
  • 如果提供新功能,请向 develop 分支创建 pull request。如果你 更新了 CHANGELOG.md,将额外加分。