微信公众号 API 等相关工具
Project description
微信公众号 API 工具
微信公众平台(微信公众号)API 相关工具,提供公众号搜索、文章列表获取、文章内容下载等功能。
项目地址: https://github.com/morning-start/wxmp
项目简介
wxmp 是一个 Python 库,用于与微信公众平台后台 API 进行交互。通过本项目可以:
- 通过微信登录后的 cookies 获取访问 token
- 搜索公众号(根据关键词查找公众号信息)
- 获取指定公众号的文章列表
- 验证文章链接有效性
- 下载文章内容并转换为 Markdown 格式
- 支持时间范围缓存和增量更新
- 支持并发下载
安装
pip install wxmp
或从源码安装:
git clone https://github.com/morning-start/wxmp.git
cd wxmp
pip install -e .
快速开始
1. 初始化 API
from wxmp import WxMPAPI
cookies = {
"wxuin": "your_wxuin",
"pass_ticket": "your_pass_ticket",
}
api = WxMPAPI(cookies)
2. 搜索公众号
response = api.search_fakeid("Python")
for account in response.list:
print(f"名称: {account.nickname}")
3. 使用时间范围爬虫(推荐)
from wxmp.spider import TimeRangeSpider
from datetime import datetime
spider = TimeRangeSpider.from_cookies_file("cookies.json")
bizs = spider.load_or_search_bizs(["Python编程"])
time_range = TimeRange(
begin=datetime(2024, 1, 1),
end=datetime(2024, 12, 31)
)
df = spider.search_articles_content(bizs, time_range)
spider.save_all_article_content(df, save_dir="temp/article_content/")
文档
详细文档请查看 Wiki:
- 项目概览 - 项目简介、技术栈、架构概览
- 架构设计 - 设计原则、模块设计、缓存策略
- API 文档 - API 层完整文档、数据模型、异常类
- 使用指南 - 快速开始、使用场景、最佳实践
- 数据流动与状态管理 - 数据流转、状态机、缓存策略
- 贡献指南 - 如何贡献代码、开发环境设置
- 常见问题 - 常见问题和解决方案
- 更新日志 - 版本历史、变更记录
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wxmp-1.1.0.tar.gz.
File metadata
- Download URL: wxmp-1.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cee3161e07051bc709e4e5c1fa6a75a38e8e28eff5dd9715c3ddf336451f697
|
|
| MD5 |
534d7dda60af652290d37cafaf26a667
|
|
| BLAKE2b-256 |
75f2b3a2fd4134a22335db78489a477da315873bd29271ff92e918a4f824ed2e
|
Provenance
The following attestation bundles were made for wxmp-1.1.0.tar.gz:
Publisher:
python-publish.yml on morning-start/wxmp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wxmp-1.1.0.tar.gz -
Subject digest:
1cee3161e07051bc709e4e5c1fa6a75a38e8e28eff5dd9715c3ddf336451f697 - Sigstore transparency entry: 975633707
- Sigstore integration time:
-
Permalink:
morning-start/wxmp@c4f68f1f7d584adcf7246e860ec2bfee4e1fa271 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/morning-start
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c4f68f1f7d584adcf7246e860ec2bfee4e1fa271 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wxmp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: wxmp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88760f1dcbc6c98782e7fbbaff851032e8ecf257bf63b6b14376023295315c92
|
|
| MD5 |
22a2c4d1d4e9f9896c699886ed41fe9e
|
|
| BLAKE2b-256 |
39ebcb64cd07b402ef9965afa6dd103f9a353ca650c43968501fa291f62322f9
|
Provenance
The following attestation bundles were made for wxmp-1.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on morning-start/wxmp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wxmp-1.1.0-py3-none-any.whl -
Subject digest:
88760f1dcbc6c98782e7fbbaff851032e8ecf257bf63b6b14376023295315c92 - Sigstore transparency entry: 975633709
- Sigstore integration time:
-
Permalink:
morning-start/wxmp@c4f68f1f7d584adcf7246e860ec2bfee4e1fa271 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/morning-start
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c4f68f1f7d584adcf7246e860ec2bfee4e1fa271 -
Trigger Event:
push
-
Statement type: