rewards-farmer README

The project's README from github.com/User0332/rewards-farmer. As one markdown file: README.md.

User0332/rewards-farmer

Automation for MS Rewards based on https://youtu.be/4qdPcMNaioA.

Running Instructions

IMPORTANT: Use at your own risk. Microsoft may take action against your account for using automated scripts to gain rewards points. The YouTube video contains more details about the techniques implemented to avoid detection of this script.

Clone the repository.

git clone https://github.com/User0332/rewards-farmer

A sample nouns.txt file is included in the project root and can be modified by the user to contain seed words for the LLM to complete 20 searches. The wordlist should be separated by newline.

cd rewards-farmer
# Edit the included nouns.txt file to add or replace words as needed

Where search queries come from

The bot needs short strings to type into Bing. Two backends produce them, set with QUERY_SOURCE:

QUERY_SOURCE Needs Notes
llm (default) Ollama account + model Current behaviour, unchanged
trends nothing Google Trends, Wikipedia and Bing autosuggest
QUERY_SOURCE=trends python src/main.py          # bash
$env:QUERY_SOURCE="trends"; python src/main.py  # PowerShell

trends needs no account, no API key and no model download, so the Ollama setup below is optional if you use it. If every feed is unreachable it falls back to nouns.txt rather than failing the run.

You should also have an Ollama account created (for the LLM), the ollama tool installed, and you should have signed in to the Ollama CLI via the command line using ollama signin. This project will use a minimal amount of Ollama cloud usage using gemma4:cloud. If you wish to use a different model, please change the model parameter in the get_ollama_response function in src/llm_utils.py.

You must also provide an image for the script to upload to complete the visual search task. A helper script is included at src/random_image_for_visual_search.py that will download an image from Wikipedia named visual_search.jpg into the project root for you. You may also provide an image of your own, just ensure that the absolute path of the image is placed in the VISUAL_SEARCH_IMAGE_PATH constant at the top of rewards_tasks.py.

Activate the virtual environment & install dependencies (you may have to use python -m poetry instead of poetry). You must have Python 3.12+ and Poetry installed.

If iex (poetry env activate) fails with "Cannot bind argument to parameter 'Command' because it is null", poetry install did not create an environment. Run python --version first: an older Python leaves poetry with nothing to activate, and the message explaining that goes to stderr rather than into iex.

Windows (PowerShell)

poetry install
iex (poetry env activate)

*nix (Bash)

poetry install
eval $(poetry env activate)

You must also have a webdriver for Microsoft Edge installed. If you already have the Edge Browser installed, you probably have this component as well.

The profile directory in src/constants.py is set to Default. If this signs you in to a global profile that you do not want to use for automation, then you can create a new profile from within the webdriver instance manually and then change the PROFILE_NAME constant to Profile 1 (or the equivalent number).

Run main.py (python src/main.py, it must be run from the root directory so the relative paths work out), wait for the page to launch, and then CTRL-C to quit the application immediately. Sign in to the created profile with your Microsoft account on both Bing and rewards.bing.com.

EU Users: you may have to accept a consent banner once on rewards.bing.com and on the Bing search page, bing.com. Once you consent, your choice will be saved for future runs using the same profile, so you will not need to interact with the banner during automated runs.

Close all webdriver browser instances. Run main.py again; the automation should start working.

Running more than one account

Rewards is per Microsoft account and the browser profile holds the sign-in, so an account here is a profile directory. REWARDS_ACCOUNTS takes a comma separated list, and each name gets its own directory under data-dir:

REWARDS_ACCOUNTS=personal,spare python src/main.py

Each is signed in once by hand, the same way as the single profile, using its own directory:

msedge --user-data-dir="<repo>\data-dir\personal" --profile-directory=Default https://rewards.bing.com

They run one after another, and an account that fails is reported and skipped rather than ending the run, whether it fails to start or dies partway through. Leave REWARDS_ACCOUNTS unset and everything behaves exactly as before, using the single profile in data-dir.

Docker

Runs the bot without installing Edge, a driver or Python on the host.

docker compose build
docker compose run --rm rewards-farmer

The container defaults to QUERY_SOURCE=trends, so it needs no Ollama account and no model. Set QUERY_SOURCE=llm and OLLAMA_HOST to a reachable address to use a model instead.

Sign in first. The profile in data-dir starts logged out and the container has no display to sign in with, so do it once on the host with a normal Edge window and let the volume carry it in:

msedge --user-data-dir="<repo>\data-dir" --profile-directory=Default https://rewards.bing.com

Close every window of that profile afterwards, and close them normally rather than killing the browser. Chromium allows one process per profile directory, so a window left open on the host stops the container from starting. A profile whose browser was killed is worse: it keeps a SingletonLock naming the machine that wrote it, the container reads that as the profile being open somewhere else, and it exits during startup with the same error a genuinely open window produces.

This does not work from a Windows host. Chromium encrypts cookie values with a key held by the operating system, and on Windows that key is wrapped with DPAPI and tied to the Windows account that wrote it. The Linux container has no DPAPI, so it cannot unwrap the key and every cookie in the profile is unreadable to it. The volume carries the file in and the browser then ignores its contents: a profile signed in on the host reported 73 cookies on disk, of which Edge in the container could read 19 — the ones it had just set itself — while .MSA.Auth and ANON, the cookies the sign-in actually rests on, came back absent. The container starts, looks healthy and behaves as though it were logged out.

Sign-in has to happen wherever the container will read it, so on a Windows host run the bot directly instead:

python src/main.py

A Linux host does work. With no keyring running Chromium falls back to a fixed key, which is the case both on a plain Linux host and inside the image, so the volume carries a working sign-in straight in. Measured: a profile signed in on the host opened in the container already on rewards.bing.com/dashboard and earned from it.

macOS is expected to fail the way Windows does, since it wraps the key with the login Keychain and the container cannot reach that either, but that case was not tested.

Provide the visual search image on the host too. visual_search.jpg is not in the repository and is not built into the image, so create it once in the project root and the compose file mounts it in:

python src/random_image_for_visual_search.py

Without it every other task still runs; only the visual search one fails.

Multiple accounts work the same way in the container:

REWARDS_ACCOUNTS=personal,spare docker compose run --rm rewards-farmer

REWARDS_HEADLESS=1 is set in the image. It also works on the host if you want a run with no visible window; the pointer code needs an explicit window size in that mode, which main.py sets.

Logging

The script logs to the console. Two optional environment variables change that:

Variable Default Effect
REWARDS_FARMER_LOG_LEVEL INFO Set to DEBUG to also attach the full stack trace to every [FAIL] line.
REWARDS_FARMER_LOG_FILE unset Path to also write the log to, useful for unattended runs.

Windows (PowerShell)

$env:REWARDS_FARMER_LOG_LEVEL="DEBUG"; $env:REWARDS_FARMER_LOG_FILE="run.log"; python src/main.py

*nix (Bash)

REWARDS_FARMER_LOG_LEVEL=DEBUG REWARDS_FARMER_LOG_FILE=run.log python src/main.py

If you are opening an issue about a crash, running with REWARDS_FARMER_LOG_LEVEL=DEBUG and attaching the log is the most useful thing you can include.

Please open up a GitHub issue if you run into any difficulties.

rewards-farmer (User0332/rewards-farmer)

Searching Database…

这是什么?rewards-farmer 用来自动化 Microsoft Rewards:它通过 webdriver 驱动 Microsoft Edge 执行 Bing 搜索并完成每日视觉搜索任务,让你无需手动操作就能积累奖励积分。
这是图形界面应用,还是我在终端里运行的脚本?它是一个从命令行运行的 Python 脚本(python src/main.py);唯一可见的窗口就是它驱动的自动化 Edge 浏览器,在无头模式下还可以完全隐藏。
怎么让它跑起来?克隆仓库,用 Poetry 安装依赖(需要 Python 3.12+),安装 Edge webdriver,在浏览器配置文件中手动登录一次 Bing 和 rewards.bing.com,然后在项目根目录运行 python src/main.py。
生成搜索查询需要 Ollama 账号吗?只有使用默认的 llm 查询源才需要,它需要 Ollama 账号、CLI 登录状态和 gemma4:cloud 模型;trends 源不需要账号、API 密钥或模型,而是从 Google Trends、Wikipedia 和 Bing 自动建议中获取。
如果我在 Windows 主机上运行,Docker 配置还能用吗?不行。Chromium 使用由 Windows DPAPI 包装的密钥加密配置文件 cookie,因此在 Windows 主机上完成的登录在 Linux 容器内无法解密(73 个 cookie 只有 19 个传了过来,真正的登录凭据 cookie 都丢了);在 Windows 上必须直接运行机器人,而不是通过 Docker。
我可以运行多个 Microsoft Rewards 账号吗?可以——把 REWARDSACCOUNTS 设置为逗号分隔的名称列表,每个账号在 data-dir 下有自己的配置目录,机器人先手动登录每个账号一次,然后依次运行,某个账号失败就跳过它,而不是中止整个运行。
视觉搜索任务的图片从哪里来?一个辅助脚本(src/randomimageforvisualsearch.py)会从 Wikipedia 下载一张图片作为 visualsearch.jpg 放到项目根目录,你也可以提供自己的图片,并把 VISUALSEARCHIMAGEPATH 常量指向它的绝对路径。
微软会不会因此处罚我的账号?有风险,README 明确警告微软可能对使用自动脚本获取奖励积分的账号采取行动,所以使用风险自负。
它能在不显示浏览器窗口的情况下运行吗?可以——REWARDSHEADLESS=1(Docker 镜像中的默认值)以无头模式运行;该模式下 main.py 会设置明确的窗口大小,因为鼠标移动代码需要它。
Creator
User0332
Size
0.8 MB
Stars
1K
Updated
CommitOct 15
Age
1mo
Commits · 90 Days