Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,43 @@ All notable changes to `tikhub` will be documented in this file. The format is b

## [Unreleased]

## [2.2.0] — 2026-10-02

### Changed

- **Spec sync to the live OpenAPI spec (1050 operations, 51 tags).** The SDK
now exposes **1048 methods across 51 resources**.
- **Deprecated endpoints are no longer generated.** `scripts/generate_resources.py`
skips any operation marked `deprecated: true`. `scripts/verify_coverage.py`
and the endpoint-count test check against non-deprecated operations only.
This drops `tiktok_shop_web.fetch_product_detail_v2` and
`tiktok_shop_web.fetch_hot_selling_products_list`.

### Added

- New resources: `bilibili_huahuo` (45), `douyin_douplus` (17),
`telegram_web` (7), `wechat_channels_v2` (12), `wechat_media_platform_v2` (11),
`wechat_search_v2` (2), `xiaohongshu_pgy` (20).
- New endpoints on existing resources, e.g. `bilibili_web.fetch_user_post_videos_v2`,
`douyin_index.fetch_hot_detail`, `douyin_xingtu_v2.get_author_audience_distribution`.

### Removed

- Resources that TikHub removed upstream: `linkedin_web`, `sora2`, `temp_mail`,
`tiktok_interaction`, `wechat_channels`, `wechat_media_platform_web`,
`weibo_web`, `xiaohongshu_app`, `xiaohongshu_web`, `xiaohongshu_web_v2`.
- Endpoints that TikHub removed upstream from the remaining resources
(e.g. several `douyin_app_v3` search methods and `douyin_web` token generators).

## [2.1.2] — 2026-06-03

### Added — Phase 6 (docs, CLI, release tooling)

- **mkdocs-material site** at `mkdocs.yml` + `docs/`. Hand-written guides
for authentication, async, errors, pagination, retries, logging, CLI,
naming rules, and a migration guide from `tikhub_sdk_v2`.
- **Auto-generated API reference** (`docs/reference.md`, 1540 lines) listing
all 1010 methods with their endpoint paths and signatures.
all 1106 methods with their endpoint paths and signatures.
Regenerated by `scripts/generate_docs.py`.
- **CLI** (`pip install "tikhub[cli]"` -> `tikhub` console script):
- `tikhub health`
Expand All @@ -36,7 +66,8 @@ All notable changes to `tikhub` will be documented in this file. The format is b
- `refresh_spec.py` — pulls latest `openapi.json`, prints diff vs cached snapshot.
- `generate_resources.py` — regenerates all resource modules + `client.py` + `async_client.py` from `spec/openapi.json`.
- `verify_coverage.py` — CI gate that asserts every spec endpoint has a matching SDK method (and vice versa).
- **All 52 resources** for TikHub OpenAPI V5.3.2 wired up — **1010 / 1010 endpoints**.
- **All 54 resources** for TikHub OpenAPI V5.3.2 wired up — **1106 / 1106 endpoints**.
- **Spec sync to V5.3.2 (1106 endpoints)** — added two platforms (`douyin_index`, 44 endpoints; `linkedin_web_v2`, 43 endpoints), +121 new endpoints across LinkedIn/YouTube/Reddit/WeChat/Douyin and others, −25 removed (deprecated Douyin & Xiaohongshu search/feed variants).
- **Multipart support** in `_base_client._request` (the one Sora2 image-upload endpoint).
- **GitHub Actions CI** (`.github/workflows/ci.yml`): lint, mypy, pytest matrix on Python 3.9–3.13, plus the coverage gate.
- **`docs/quickstart.md`** — runnable 5-minute tour.
Expand Down
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Built for developers, data scientists, and AI engineers who need structured soci

## Why This SDK?

- **100% endpoint coverage** — 1010 / 1010 endpoints from OpenAPI spec V5.3.2, mechanically generated and verified
- **100% endpoint coverage** — 1048 / 1048 endpoints from OpenAPI spec V5.3.2 (deprecated endpoints excluded), mechanically generated and verified
- **Sync + async** — `TikHub` and `AsyncTikHub` clients with identical APIs
- **Production-ready** — automatic retries with exponential backoff, rate-limit handling, structured error hierarchy with full debugging context
- **Type-safe** — `mypy --strict` clean, built on `httpx` + `pydantic v2`
Expand All @@ -42,22 +42,23 @@ Built for developers, data scientists, and AI engineers who need structured soci

| Platform | Resource | Endpoints |
|---|---|---|
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 200+ |
| Douyin | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_xingtu` | 400+ |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 80+ |
| YouTube | `youtube_web`, `youtube_web_v2` | 50+ |
| Twitter / X | `twitter_web` | 13+ |
| Xiaohongshu (Red Note) | `xiaohongshu_web`, `xiaohongshu_app` (+ v2/v3 variants) | 80+ |
| Bilibili | `bilibili_web`, `bilibili_app` | 40+ |
| Weibo | `weibo_web`, `weibo_web_v2`, `weibo_app` | 30+ |
| Threads | `threads_web` | 10+ |
| LinkedIn | `linkedin_web` | 10+ |
| Reddit | `reddit_app` | 10+ |
| Kuaishou | `kuaishou_web`, `kuaishou_app` | 20+ |
| WeChat | `wechat_channels`, `wechat_media_platform_web` | 20+ |
| Lemon8 | `lemon8_app` | 10+ |
| Zhihu | `zhihu_web` | 30+ |
| Others | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app`, `sora2` | 30+ |
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 162 |
| Douyin | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_creator_v2`, `douyin_xingtu`, `douyin_xingtu_v2`, `douyin_index`, `douyin_douplus` | 319 |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 93 |
| YouTube | `youtube_web`, `youtube_web_v2` | 34 |
| Twitter / X | `twitter_web` | 25 |
| Xiaohongshu (Red Note) | `xiaohongshu_app_v2`, `xiaohongshu_web_v3`, `xiaohongshu_pgy` | 45 |
| Bilibili | `bilibili_web`, `bilibili_app`, `bilibili_huahuo` | 87 |
| Weibo | `weibo_web_v2`, `weibo_app` | 56 |
| Threads | `threads_web` | 12 |
| LinkedIn | `linkedin_web_v2` | 8 |
| Telegram | `telegram_web` | 7 |
| Reddit | `reddit_app` | 28 |
| Kuaishou | `kuaishou_web`, `kuaishou_app` | 38 |
| WeChat | `wechat_channels_v2`, `wechat_media_platform_v2`, `wechat_search_v2` | 25 |
| Lemon8 | `lemon8_app` | 16 |
| Zhihu | `zhihu_web` | 41 |
| Others | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app` | 31 |

## Install

Expand Down Expand Up @@ -160,10 +161,10 @@ Parameter names match the OpenAPI spec verbatim. If you can read the TikHub API

| | |
|---|---|
| Resources | **52** (one per OpenAPI tag) |
| Endpoints | **1010 / 1010** |
| Tests | 110 passing |
| Type-check | mypy `--strict` clean across 71 source files |
| Resources | **51** (one per OpenAPI tag) |
| Endpoints | **1048 / 1048** |
| Tests | 108 passing |
| Type-check | mypy `--strict` clean across 70 source files |
| Lint | ruff clean |

| Phase | Scope | State |
Expand All @@ -180,7 +181,7 @@ The resource layer is **mechanically generated** from `spec/openapi.json`. To re

```bash
python scripts/refresh_spec.py # pulls latest openapi.json, prints diff
python scripts/generate_resources.py # regenerates all 52 resource files + clients
python scripts/generate_resources.py # regenerates all 51 resource files + clients
python scripts/generate_docs.py # regenerates docs/reference.md
python scripts/verify_coverage.py # asserts 100% coverage
pytest -q # 110 tests
Expand All @@ -204,7 +205,7 @@ Every command prints JSON to stdout — pipe to `jq` or any other formatter.

## Documentation

Full docs (mkdocs-material): authentication, async, errors, pagination, retries, logging, CLI, migration guide, naming rules, and the auto-generated reference for all 1010 endpoints.
Full docs (mkdocs-material): authentication, async, errors, pagination, retries, logging, CLI, migration guide, naming rules, and the auto-generated reference for all 1048 endpoints.

```bash
pip install -e ".[docs]"
Expand Down
47 changes: 24 additions & 23 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

## 为什么选择这个 SDK?

- **100% 接口覆盖** — OpenAPI 规范 V5.3.2 的 1010 / 1010 个接口,机械化生成并验证
- **100% 接口覆盖** — OpenAPI 规范 V5.3.2 的 1048 / 1048 个接口(不含已弃用接口),机械化生成并验证
- **同步 + 异步** — `TikHub` 和 `AsyncTikHub` 客户端,API 完全一致
- **生产就绪** — 自动重试(指数退避)、速率限制处理、结构化异常体系(含完整调试上下文)
- **类型安全** — `mypy --strict` 通过,基于 `httpx` + `pydantic v2` 构建
Expand All @@ -42,22 +42,23 @@

| 平台 | 资源 | 接口数 |
|---|---|---|
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 200+ |
| 抖音 | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_xingtu` | 400+ |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 80+ |
| YouTube | `youtube_web`, `youtube_web_v2` | 50+ |
| Twitter / X | `twitter_web` | 13+ |
| 小红书 | `xiaohongshu_web`, `xiaohongshu_app`(+ v2/v3 变体) | 80+ |
| B站 | `bilibili_web`, `bilibili_app` | 40+ |
| 微博 | `weibo_web`, `weibo_web_v2`, `weibo_app` | 30+ |
| Threads | `threads_web` | 10+ |
| LinkedIn | `linkedin_web` | 10+ |
| Reddit | `reddit_app` | 10+ |
| 快手 | `kuaishou_web`, `kuaishou_app` | 20+ |
| 微信 | `wechat_channels`, `wechat_media_platform_web` | 20+ |
| Lemon8 | `lemon8_app` | 10+ |
| 知乎 | `zhihu_web` | 30+ |
| 其他 | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app`, `sora2` | 30+ |
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 162 |
| 抖音 | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_creator_v2`, `douyin_xingtu`, `douyin_xingtu_v2`, `douyin_index`, `douyin_douplus` | 319 |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 93 |
| YouTube | `youtube_web`, `youtube_web_v2` | 34 |
| Twitter / X | `twitter_web` | 25 |
| 小红书 | `xiaohongshu_app_v2`, `xiaohongshu_web_v3`, `xiaohongshu_pgy` | 45 |
| B站 | `bilibili_web`, `bilibili_app`, `bilibili_huahuo` | 87 |
| 微博 | `weibo_web_v2`, `weibo_app` | 56 |
| Threads | `threads_web` | 12 |
| LinkedIn | `linkedin_web_v2` | 8 |
| Telegram | `telegram_web` | 7 |
| Reddit | `reddit_app` | 28 |
| 快手 | `kuaishou_web`, `kuaishou_app` | 38 |
| 微信 | `wechat_channels_v2`, `wechat_media_platform_v2`, `wechat_search_v2` | 25 |
| Lemon8 | `lemon8_app` | 16 |
| 知乎 | `zhihu_web` | 41 |
| 其他 | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app` | 31 |

## 安装

Expand Down Expand Up @@ -160,17 +161,17 @@ SDK 由 TikHub OpenAPI 规范机械化生成。两条规则:

| | |
|---|---|
| 资源 | **52**(每个 OpenAPI 标签一个) |
| 接口 | **1010 / 1010** |
| 测试 | 110 个通过 |
| 类型检查 | mypy `--strict` 71 个源文件全部通过 |
| 资源 | **51**(每个 OpenAPI 标签一个) |
| 接口 | **1048 / 1048** |
| 测试 | 108 个通过 |
| 类型检查 | mypy `--strict` 70 个源文件全部通过 |
| 代码检查 | ruff 通过 |

资源层由 `spec/openapi.json` **机械化生成**。当 TikHub 规范更新后,运行以下命令刷新:

```bash
python scripts/refresh_spec.py # 拉取最新 openapi.json,打印差异
python scripts/generate_resources.py # 重新生成所有 52 个资源文件 + 客户端
python scripts/generate_resources.py # 重新生成所有 51 个资源文件 + 客户端
python scripts/generate_docs.py # 重新生成 docs/reference.md
python scripts/verify_coverage.py # 验证 100% 覆盖
pytest -q # 110 个测试
Expand All @@ -193,7 +194,7 @@ tikhub user usage # 今日请求量

## 文档

完整文档(mkdocs-material):身份认证、异步、异常处理、分页、重试、日志、CLI、迁移指南、命名规则,以及所有 1010 个接口的自动生成参考文档。
完整文档(mkdocs-material):身份认证、异步、异常处理、分页、重试、日志、CLI、迁移指南、命名规则,以及所有 1048 个接口的自动生成参考文档。

```bash
pip install -e ".[docs]"
Expand Down
35 changes: 18 additions & 17 deletions README_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Diseñado para desarrolladores, científicos de datos e ingenieros d

## ¿Por qué este SDK?

- **Cobertura del 100%** — 1010 / 1010 endpoints de la especificación OpenAPI V5.3.2, generados y verificados mecánicamente
- **Cobertura del 100%** — 1048 / 1048 endpoints de la especificación OpenAPI V5.3.2 (sin los endpoints obsoletos), generados y verificados mecánicamente
- **Sync + async** — clientes `TikHub` y `AsyncTikHub` con APIs idénticas
- **Listo para producción** — reintentos automáticos con backoff exponencial, manejo de límites de tasa, jerarquía de errores estructurada
- **Type-safe** — compatible con `mypy --strict`, construido sobre `httpx` + `pydantic v2`
Expand All @@ -42,22 +42,23 @@ Diseñado para desarrolladores, científicos de datos e ingenieros d

| Plataforma | Recurso | Endpoints |
|---|---|---|
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 200+ |
| Douyin | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_xingtu` | 400+ |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 80+ |
| YouTube | `youtube_web`, `youtube_web_v2` | 50+ |
| Twitter / X | `twitter_web` | 13+ |
| Xiaohongshu (Red Note) | `xiaohongshu_web`, `xiaohongshu_app` (+ variantes v2/v3) | 80+ |
| Bilibili | `bilibili_web`, `bilibili_app` | 40+ |
| Weibo | `weibo_web`, `weibo_web_v2`, `weibo_app` | 30+ |
| Threads | `threads_web` | 10+ |
| LinkedIn | `linkedin_web` | 10+ |
| Reddit | `reddit_app` | 10+ |
| Kuaishou | `kuaishou_web`, `kuaishou_app` | 20+ |
| WeChat | `wechat_channels`, `wechat_media_platform_web` | 20+ |
| Lemon8 | `lemon8_app` | 10+ |
| Zhihu | `zhihu_web` | 30+ |
| Otros | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app`, `sora2` | 30+ |
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 162 |
| Douyin | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_creator_v2`, `douyin_xingtu`, `douyin_xingtu_v2`, `douyin_index`, `douyin_douplus` | 319 |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 93 |
| YouTube | `youtube_web`, `youtube_web_v2` | 34 |
| Twitter / X | `twitter_web` | 25 |
| Xiaohongshu (Red Note) | `xiaohongshu_app_v2`, `xiaohongshu_web_v3`, `xiaohongshu_pgy` | 45 |
| Bilibili | `bilibili_web`, `bilibili_app`, `bilibili_huahuo` | 87 |
| Weibo | `weibo_web_v2`, `weibo_app` | 56 |
| Threads | `threads_web` | 12 |
| LinkedIn | `linkedin_web_v2` | 8 |
| Telegram | `telegram_web` | 7 |
| Reddit | `reddit_app` | 28 |
| Kuaishou | `kuaishou_web`, `kuaishou_app` | 38 |
| WeChat | `wechat_channels_v2`, `wechat_media_platform_v2`, `wechat_search_v2` | 25 |
| Lemon8 | `lemon8_app` | 16 |
| Zhihu | `zhihu_web` | 41 |
| Otros | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app` | 31 |

## Instalación

Expand Down
35 changes: 18 additions & 17 deletions README_FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Conçu pour les développeurs, les data scientists et les ing&eacute

## Pourquoi ce SDK ?

- **Couverture à 100%** — 1010 / 1010 endpoints de la spécification OpenAPI V5.3.2, générés et vérifiés mécaniquement
- **Couverture à 100%** — 1048 / 1048 endpoints de la spécification OpenAPI V5.3.2 (hors endpoints dépréciés), générés et vérifiés mécaniquement
- **Sync + async** — clients `TikHub` et `AsyncTikHub` avec des APIs identiques
- **Prêt pour la production** — nouvelles tentatives automatiques avec backoff exponentiel, gestion des limites de taux, hiérarchie d'erreurs structurée
- **Type-safe** — compatible `mypy --strict`, construit sur `httpx` + `pydantic v2`
Expand All @@ -42,22 +42,23 @@ Conçu pour les développeurs, les data scientists et les ing&eacute

| Plateforme | Ressource | Endpoints |
|---|---|---|
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 200+ |
| Douyin | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_xingtu` | 400+ |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 80+ |
| YouTube | `youtube_web`, `youtube_web_v2` | 50+ |
| Twitter / X | `twitter_web` | 13+ |
| Xiaohongshu (Red Note) | `xiaohongshu_web`, `xiaohongshu_app` (+ variantes v2/v3) | 80+ |
| Bilibili | `bilibili_web`, `bilibili_app` | 40+ |
| Weibo | `weibo_web`, `weibo_web_v2`, `weibo_app` | 30+ |
| Threads | `threads_web` | 10+ |
| LinkedIn | `linkedin_web` | 10+ |
| Reddit | `reddit_app` | 10+ |
| Kuaishou | `kuaishou_web`, `kuaishou_app` | 20+ |
| WeChat | `wechat_channels`, `wechat_media_platform_web` | 20+ |
| Lemon8 | `lemon8_app` | 10+ |
| Zhihu | `zhihu_web` | 30+ |
| Autres | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app`, `sora2` | 30+ |
| TikTok | `tiktok_web`, `tiktok_app_v3`, `tiktok_creator`, `tiktok_analytics`, `tiktok_ads`, `tiktok_shop_web` | 162 |
| Douyin | `douyin_web`, `douyin_app_v3`, `douyin_search`, `douyin_billboard`, `douyin_creator`, `douyin_creator_v2`, `douyin_xingtu`, `douyin_xingtu_v2`, `douyin_index`, `douyin_douplus` | 319 |
| Instagram | `instagram_v1`, `instagram_v2`, `instagram_v3` | 93 |
| YouTube | `youtube_web`, `youtube_web_v2` | 34 |
| Twitter / X | `twitter_web` | 25 |
| Xiaohongshu (Red Note) | `xiaohongshu_app_v2`, `xiaohongshu_web_v3`, `xiaohongshu_pgy` | 45 |
| Bilibili | `bilibili_web`, `bilibili_app`, `bilibili_huahuo` | 87 |
| Weibo | `weibo_web_v2`, `weibo_app` | 56 |
| Threads | `threads_web` | 12 |
| LinkedIn | `linkedin_web_v2` | 8 |
| Telegram | `telegram_web` | 7 |
| Reddit | `reddit_app` | 28 |
| Kuaishou | `kuaishou_web`, `kuaishou_app` | 38 |
| WeChat | `wechat_channels_v2`, `wechat_media_platform_v2`, `wechat_search_v2` | 25 |
| Lemon8 | `lemon8_app` | 16 |
| Zhihu | `zhihu_web` | 41 |
| Autres | `toutiao_web`, `toutiao_app`, `xigua_app_v2`, `pipixia_app` | 31 |

## Installation

Expand Down
Loading
Loading