Browser-based monitoring and digest generation for:
Xaccount watchlistsWeChat public accountsdiscovered throughnewrank.cn- structured
MarkdownandJSONoutput for downstream agents
This repo started as an internal workflow and was cleaned up into a reusable public project. The current focus is practical browser automation with a logged-in Chrome session, not a pure API-only collector.
The project helps you:
- reuse a logged-in desktop Chrome session
- read recent posts from a curated
Xaccount pool - open
newrank.cn, inspect account detail pages, and click through to original WeChat articles - produce a structured digest for human reading or agent consumption
Many high-value sources are either rate-limited, partially blocked, or not fully accessible through stable public APIs.
This repo therefore leans on:
Playwright+ Chrome remote debugging- slower, human-like page interaction for
X - Newrank detail-page navigation for
WeChat - JSON + Markdown outputs that other tools can reuse
What is already usable:
- browser-driven
Xscraping from a watchlist - browser-driven
WeChatarticle extraction from Newrank candidate pages - a unified runner that writes timestamped digest files
- a reusable Codex skill under
skills/browser-social-digest
What is still opinionated or workflow-dependent:
WeChatcurrently expects a pre-scanned Newrank candidate file- the browser session must already be logged in to
Xandnewrank.cn - Newrank may hit daily access caps depending on account state
scripts/
collect_x_48h_from_browser.py
collect_wechat_48h_from_newrank.py
run_browser_social_digest.py
skills/
browser-social-digest/
sources/
x_accounts.example.csv
wechat_accounts.example.csv
src/social_digest/
reusable Python package code
python -m pip install -e .[browser]
python -m playwright install chromiumCopy the example files and edit them:
Copy-Item sources\x_accounts.example.csv sources\x_accounts.csv
Copy-Item sources\wechat_accounts.example.csv sources\wechat_accounts.csvYour Chrome session should:
- be logged in to
X - be logged in to
newrank.cn - expose remote debugging, usually at
http://127.0.0.1:9222
At minimum:
$env:WECHAT_NEWRANK_TOKEN = "your_newrank_token"Optional:
$env:X_CDP_URL = "http://127.0.0.1:9222"
$env:WECHAT_CDP_URL = "http://127.0.0.1:9222"python scripts\run_browser_social_digest.py --hours 24The runner writes timestamped files under output/:
browser_social_digest_*h_*.mdbrowser_social_digest_*h_*.json- per-source snapshots for
XandWeChat
The X collector:
- reads enabled accounts from
sources/x_accounts.csv - opens a search URL per account using
from:username since:... until:... - waits and scrolls in a more human-like rhythm
- extracts text, timestamps, links, and engagement signals
- writes sorted JSON and Markdown summaries
Useful environment variables:
$env:X_WINDOW_HOURS = "24"
$env:X_ACCOUNT_OFFSET = "0"
$env:X_ACCOUNT_LIMIT = "20"
$env:X_RESET_OUTPUT = "1"This makes chunked runs possible when X gets unstable.
The WeChat collector expects a Newrank candidate file, by default:
output/wechat_48h_browser_scan_v3.json
For each candidate article it:
- opens the Newrank account detail page
- clicks the left-side article card
- reads the right-side detail panel
- clicks the large title in the right panel
- opens the original
mp.weixin.qq.comarticle - extracts the article body and metadata
Required environment variable:
$env:WECHAT_NEWRANK_TOKEN = "your_newrank_token"Optional overrides:
$env:WECHAT_WINDOW_HOURS = "24"
$env:WECHAT_SCAN_FILE = "D:\path\to\wechat_scan.json"This repo includes a reusable Codex skill:
Use it when you want Codex to:
- reuse the browser session
- scrape recent
XandWeChatupdates - write a structured digest instead of raw notes
Prompt templates for OpenClaw and OpenCode live here:
The short version:
- do not ask those agents to “understand the whole repo” first
- tell them exactly which script to run
- tell them where the browser session lives
- tell them where to write outputs
This repo now also includes a minimal local HTTP API wrapper for Coze or any other tool-calling platform.
Install the API extras:
python -m pip install -e .[browser,api]Start the local service:
python scripts\serve_digest_api.pyDefault address:
http://127.0.0.1:8787
Main endpoints:
GET /healthPOST /digest/fullPOST /digest/xPOST /digest/wechat
Detailed setup steps for Coze live here:
This public repo intentionally does not include:
- your real
Xwatchlist - your real
WeChatwatchlist - local browser profiles
- cookies, access tokens, or session dumps
- generated
output/artifacts
Only example watchlists and template configs are committed.
Xcan still throw blank or error states under heavier browsing pressure- Newrank may enforce daily access limits
WeChatis not yet fully end-to-end from keyword search to candidate generation in one script- some logic still reflects a Windows-first workflow
- add a dedicated Newrank scanning script from
sources/wechat_accounts.csv - expand the new local API into a fuller MCP or multi-tenant service
- normalize more classifiers and summaries for public use
- add Linux/macOS browser-launch helpers
No license has been added yet. If you want broader reuse, add one before inviting outside contributions.