Batch-retrieves the latest articles of specified Official Account bloggers via the mptext.top API, downloads them, and parses them into Markdown/HTML/plain text format output.
Quick Start
Retrieve the latest 2 articles of a single Official Account:
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids "MzkzNDQxOTU2MQ=="
Retrieve articles from multiple Official Accounts (comma-separated fakeids):
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids "MzkzNDQxOTU2MQ==,MjM5NDI4MTY3NA==" --limit 3
Retrieve by Official Account name:
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids "赛博禅心,饼干哥哥AGI"
Retrieve articles from all preset Official Accounts:
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids all --limit 2
Dependency Installation
pip install requests beautifulsoup4 html2text
Minimum Dependencies: Only
requestsis a required dependency.beautifulsoup4andhtml2textare used to enhance the Markdown conversion effect; if not installed, the built-in HTML parser will be used.
User Parameter Description
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
--api-key / -k |
string | Yes | - | API Key for mptext.top |
--fakeids / -f |
string | Yes | - | List of Official Account fakeids (comma-separated), Official Account name, or all |
--limit / -l |
int | No | 2 | Number of articles to retrieve per Official Account |
--output-dir / -o |
string | No | ./output |
Output directory |
--format / -F |
string | No | markdown |
Output format:markdown / html / text / json |
--accounts-file / -a |
string | No | Auto-find | Path to a custom Official Account list JSON file |
--interval / -i |
float | No | 1.0 | Request interval in seconds |
--list-accounts |
flag | No | - | List all preset Official Account information |
How to Obtain the API Key
The API Key comes from the mptext.top platform and is used to authenticate article retrieval requests. It is passed in the request header as X-Auth-Key .
fakeid Description
fakeid is the unique identifier of a WeChat Official Account (a Base64-encoded biz parameter), which can be obtained in the following ways:
- View it in the WeChat Official Account platform backend
- Extract it from the
__bizparameter in the Official Account article URL - Use the account list preset in this skill
Feature Description
1. Retrieve Article List
Call the mptext.top API to retrieve the latest article list of a specified Official Account:
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids "MzkzNDQxOTU2MQ==" --limit 5
2. Download and Parse Article Content
After retrieving the article HTML, automatically extract the #js_content body area and convert it to Markdown format:
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids "赛博禅心" --format markdown
3. Batch-Retrieve Multiple Official Accounts
Retrieve the latest articles of multiple Official Accounts at the same time:
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids "赛博禅心,饼干哥哥AGI,老金开源" --limit 3
4. Retrieve All Preset Official Accounts
Use the all keyword to retrieve articles from all preset Official Accounts:
python scripts/fetch_articles.py --api-key YOUR_KEY --fakeids all
5. View the Preset Official Account List
python scripts/fetch_articles.py --api-key dummy --fakeids dummy --list-accounts
6. Call as a Python Library
import sys
sys.path.insert(0, 'scripts')
from fetch_articles import get_article_list, download_article_html, extract_markdown_from_html, load_accounts, resolve_fakeids, fetch_all
api_key = "YOUR_API_KEY"
# 获取单个公众号文章列表
articles = get_article_list(api_key, "MzkzNDQxOTU2MQ==", limit=2)
for art in articles:
print(art['title'], art['url'])
# 下载并解析文章内容
html = download_article_html(api_key, articles[0]['url'])
markdown = extract_markdown_from_html(html, title=articles[0]['title'])
print(markdown[:500])
# 批量获取多个公众号
accounts = load_accounts()
fakeids = resolve_fakeids("赛博禅心,饼干哥哥AGI", accounts)
summary = fetch_all(api_key, fakeids, limit=2, output_dir="./output")
print(f"成功: {summary['success']}, 失败: {summary['fail']}")
Output Structure
output/
├── 赛博禅心/
│ ├── 文章标题1.md
│ └── 文章标题2.md
├── 饼干哥哥AGI/
│ ├── 文章标题1.md
│ └── 文章标题2.md
├── 老金开源/
│ └── ...
└── summary.json # 所有文章的元数据汇总
summary.json Format
{
"fetch_time": "2026-02-23T17:30:00",
"total_accounts": 3,
"total_articles": 6,
"success": 5,
"fail": 1,
"accounts": [
{
"fakeid": "MzkzNDQxOTU2MQ==",
"name": "赛博禅心",
"articles": [
{
"title": "文章标题",
"url": "https://mp.weixin.qq.com/s/...",
"create_time": "1708689600",
"saved_path": "output/赛博禅心/文章标题.md",
"status": "success"
}
]
}
]
}
API Interface Description
Article List Interface
GET https://down.mptext.top/api/public/v1/article?fakeid={URL_ENCODED_FAKEID}&limit={N}
| Parameter | Description |
|---|---|
fakeid |
The Official Account's fakeid, which needs URL encoding (== → %3D%3D) |
limit |
Number of articles returned |
Request header:
X-Auth-Key: {YOUR_API_KEY}
Response example:
[
{
"title": "文章标题",
"url": "https://mp.weixin.qq.com/s/xxxxx",
"create_time": 1708689600
}
]
Article Download Interface
GET https://down.mptext.top/api/public/v1/download?url={URL_ENCODED_ARTICLE_URL}&type=html
| Parameter | Description |
|---|---|
url |
WeChat article URL, must be URL-encoded |
type |
Fixed to html(API returns HTML format) |
Request headers:
X-Auth-Key: {YOUR_API_KEY}
Response: Complete WeChat article HTML page.
HTML body parsing rules
Extract the body content from the downloaded HTML:
- Locate the
id="js_content"div element - Remove the contents of the
script、style、noscripttag - Extract text content, preserving paragraph line breaks
- Use
html2textto convert to Markdown (if installed)
Preset official account list
| No. | Official account name | Category | FakeID |
|---|---|---|---|
| 1 | Cookie Brother AGI | AI Programming | MjM5NDI4MTY3NA== |
| 2 | Cyber Zen | AI Frontiers | MzkzNDQxOTU2MQ== |
| 3 | Poor Little Hu | AI Technology | MzkzMTcyMTgxNg== |
| 4 | Baoyu's Engineering Technology Sharing | Technical Translation | Mzk1NzgxMjQ0OA== |
| 5 | Cang He | AI in Practice | Mzg3MTk3NzYzNw== |
| 6 | Lao Jin Open Source | Claude Code | MzI0NzU2MDgyNA== |
| 7 | Mastering AI Tools | AI Tools | MzU4NTE1Mjg4MA== |
| 8 | Kangaroo Emperor AI Inn | AI in Practice | MzkwMzE4NjU5NA== |
Can be extended via the --accounts-file parameter to specify a custom official account list JSON file.
Notes
- API Key security: Do not hardcode the API Key into the code; it is recommended to pass it in via environment variables or command-line parameters.
- Request frequency: The default interval is 1 second; if you encounter a 429 error, increase the
--intervalvalue. - HTML parsing: The download API returns a complete HTML page, and the script automatically extracts the body from the
#js_contentarea. - Dependency fallback: When
beautifulsoup4andhtml2textare not installed, use the built-in HTMLParser to extract plain text. - File naming: Output files are named after the article title, with special characters automatically removed and the length truncated to 80 characters.
Trigger keywords
- "Get official account articles"
- "Scrape WeChat articles"
- "Official account article aggregation"
- "Batch fetch official accounts"
- "Download official account articles"
- "WeChat article collection"
- "Get the latest official account articles"
Changelog
v1.0.0 (2026-02-23)
- Initial version
- Support retrieving the official account article list via the mptext.top API
- Support downloading article HTML and parsing it into Markdown/HTML/Text/JSON
- Built-in HTMLParser extracts the
#js_contentbody (zero-dependency fallback) - Preset fakeid for 8 popular AI technology official accounts
- Support retrieval by official account name or fakeid
- Support the
allkeyword to retrieve all preset official accounts - Automatically generate summary.json aggregate metadata