Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BitBrowser WeChat Doc RPA

Python/RPA framework for:

  • Connecting to a local BitBrowser API
  • Launching browser profiles in batches
  • Opening the 公众账号助手 extension
  • Scraping WeChat public account metrics
  • Writing batch results back into a shared Tencent Docs sheet

Runtime assumptions

  1. BitBrowser local API is reachable at http://127.0.0.1:<port>.
  2. Each BitBrowser profile has a non-empty profile/window name, and that name matches Tencent Docs column A.
  3. Tencent Docs is already opened and logged in inside a separate Chromium browser launched with remote debugging enabled.
  4. The browser toolbar contains a visible 公众账号助手 extension icon, or you provide an image template for fallback clicking.

Tencent Docs browser requirement

Selenium cannot attach to an arbitrary already-open browser window unless that browser was started with remote debugging.

Example:

chrome.exe --remote-debugging-port=9222 --user-data-dir=C:\temp\tencent-doc-profile

Then open Tencent Docs manually in that browser and log in before running the script.

Setup

cd C:\Users\Administrator\bitbrowser_wechat_doc_rpa
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt

Usage

Dry run:

python main.py --dry-run

Real execution:

python main.py --write-back

Notes

  • BitBrowser API endpoint names vary. Adjust src/bitbrowser_wechat_doc_rpa/config.py if needed.
  • Tencent Docs DOM also varies. If row matching or write-back fails, calibrate tencent_doc_writer.py.
  • Extension toolbar controls are outside normal web DOM. The script uses pywinauto, then optionally image fallback.
  • If the separate Tencent Docs Chrome version is newer than your local chromedriver, the script will fall back to direct CDP write-back on port 9222.

Local-First Flow

Current recommended flow:

python .\script_1_build_daily_excel.py
python .\script_2_fill_daily_excel.py

Quick debug:

python .\script_1_build_daily_excel.py
python .\debug_3_profiles.py

Login-State Extension

The standalone login-state extension flow is used to keep WeChat public-account sessions alive without changing the main flow or the local daily workbook.

Run all profiles:

python .\script_3_extend_login_state.py --mode all

Run only non-publishing accounts:

python .\script_3_extend_login_state.py --mode non_publishing

Behavior:

  • At most 14 BitBrowser windows are opened in one batch.
  • --mode non_publishing reads the same daily_YYYYMMDD.xlsx workbook used by script 2 and skips accounts already covered there.
  • If the daily workbook does not exist, --mode non_publishing falls back to all.
  • Failed login-state probes are written to a separate workbook:
output\login_state_failures_YYYYMMDD_HHMMSS.xlsx

Desktop Launcher

The desktop launcher keeps the Python source readable and editable, while providing an interactive Windows GUI entrypoint:

  • desktop_app.py: desktop launcher
  • build_desktop_exe.bat: PyInstaller build script

Run from source:

python .\desktop_app.py

Build the exe:

pip install pyinstaller
.\build_desktop_exe.bat

Built output:

dist\BitBrowserWechatDesktop.exe

Pre-Edit Backup

Before code edits, create a targeted backup for the files you plan to change:

python .\pre_edit_backup.py --task "桌面端 UI 调整" desktop_app.py debug_3_profiles.py

Backup output is written under:

backups\code_edits\<timestamp>\

Each backup directory contains:

  • original file copies
  • manifest.txt with backup time, task, and file list

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages