Skip to main content
Glama

douyin-favorites-mcp · 抖音コレクション MCP サービス

License: MIT

抖音コレクション / 抖音のお気に入り の Model Context Protocol (MCP) サーバー —— ログイン状態のブラウザセッションを通じて、自分のアカウントの抖音のお気に入り(デフォルトのお気に入り)、コレクション / アルバム(例:「学習」)を読み取り、構造化データを AI アシスタント(Claude / WorkBuddy など)にエクスポートして利用します。

English: An MCP server that reads your personal Douyin (抖音) favorites and collection folders (收藏夹/专辑) via a logged-in browser session, for use with Claude / WorkBuddy and other MCP clients.

⚠️ 個人利用の認可:本ツールは現在ログインしているアカウントのコレクションデータのみを読み取り、他人のデータスクレイピング、CAPTCHA 回避、署名クラック機能は提供しません。

機能

ツール

説明

douyin_login_start

ヘッド付き Chrome を起動して QR コードで抖音にログイン(セッションはローカル profile に保存)

douyin_login_status

現在の session が有効かどうかを確認(sessionid cookie に基づく)

douyin_logout

ローカルブラウザの profile をクリア

douyin_health_check

ヘルスチェック

get_self_user_info

現在ログイン中のアカウントの基本情報を取得(ニックネーム/uid/フォロワー/フォロー/獲得いいね)

list_collection_videos

デフォルトの「お気に入り」フォルダの動画リストを取得

list_collects

すべてのコレクション(アルバム)を一覧表示:id、名前、動画数

get_collect_videos

指定したコレクション(アルバム)内の動画/画像・テキストを取得

get_video_detail

単一の動画の詳細とインタラクションデータを取得

対応コンテンツタイプ:動画 + 画像・テキスト(長文記事)。タイトル / 作者 / インタラクションデータ / カバー画像 / 再生時間を抽出できます。

Related MCP server: Bilibili MCP Server

動作原理

抖音の Web API には実行時署名保護があり、API 呼び出しを直接偽造することはできません。本サービスでは次の方法を採用しています:

  1. Playwright で実際の Chrome を起動(永続化 profile);

  2. QR コードで一度ログインし、session cookie をローカルに保存;

  3. ページ UI を操作(「お気に入り」タブをクリックし、「コレクション」サブタブをクリック)、XHR レスポンスを傍受;

  4. 解析して構造化データを返す。

検証済みの API(2026-08):

  • コレクションリスト:GET /aweme/v1/web/collects/list/

  • コレクションの内容:GET /aweme/v1/web/collects/video/list/?collects_id=...&cursor=0&count=10

  • すべてのお気に入り:POST /aweme/v1/web/aweme/listcollection/(cursor は POST body 内)

インストール

python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate

pip install -e .
playwright install chromium

設定(WorkBuddy / Claude Desktop)

MCP 設定に追加します(例:~/.workbuddy/mcp.json):

{
  "mcpServers": {
    "douyin-favorites": {
      "command": "C:/absolute/path/to/douyin-favorites/.venv/Scripts/python.exe",
      "args": ["-m", "douyin_favorites.server"],
      "env": {
        "DOUYIN_DATA_DIR": "C:/Users/<you>/.douyin-favorites"
      }
    }
  }
}

DOUYIN_DATA_DIR はブラウザ profile(ログイン状態)の保存場所です。バージョン管理に含めないでください。

初回使用

# 1. 登录(弹出 Chrome,扫码后自动关闭)
python scripts/verify.py

# 2. 或通过 MCP 调用:
#    douyin_login_start
#    douyin_login_status   -> {"logged_in": true}
#    list_collects         -> 列出收藏夹(id + 名称 + 数量)
#    get_collect_videos({"collects_id": "<id>"})

ログイン状態はセッションをまたいで永続化され、通常は数週間ごとに一度 QR コード再スキャンが必要です。

テスト

pytest tests/ -v
python scripts/verify.py          # 端到端验证(需要登录态)
python scripts/verify_collects.py # 列收藏夹 + 第一个收藏夹的视频

注意事項と既知の制限

  • ログイン状態の検出は session cookie に基づく(sessionid / sessionid_ss / sid_guard / sid_tt)。DOM 要素で判断しないこと(抖音のホームページは未ログインでも多数の作者アバターが表示され、誤判定するため)。

  • 抖音のホームページは決して networkidle に到達しないため、すべてのナビゲーションは domcontentloaded を使用します。

  • コレクションページのページングは実際のマウスホイールでトリガーされます(最初に mouse.move でコンテンツ領域に移動してから wheel)。window.scrollTo は無効です。

  • 「お気に入り」タブはクリックでトリガーする必要があります。?showTab=favorite URL パラメータ自体は無効です。

  • get_video_detail は、抖音の詳細 API のリニューアルにより一時的に利用できない場合があります。

免責事項

本プロジェクトは個人の学習、研究、データ整理のみを目的としています。本ツールを使用することで、以下を確認したことになります:

  • 完全なアクセス権限を持つ自分の抖音アカウントのデータのみにアクセスすること;

  • 本ツールを大量スクレイピング、データ販売、不正な水増し、その他の違法・規約違反行為に使用しないこと;

  • 抖音の API は随時変更され、ツールが一時的に使用できなくなる可能性があることを理解していること。

上記の条項または関連する法律・規制に違反したことによるいかなる結果も、利用者自身が負担するものとします。

ライセンス

MIT

Available Tools

9 tools
douyin_health_checkA

Return login status and profile health for diagnostics.

Inputs: no named parameters.

douyin_login_startA

Open a headed Chrome window for the user to scan QR code and login to Douyin.

Inputs: no named parameters.

douyin_login_statusB

Check whether the stored Douyin browser session is still valid.

Inputs: no named parameters.

douyin_logoutA

Clear the stored Douyin browser profile and force re-login next time.

Inputs: no named parameters.

get_collect_videosB

List videos inside a specific Douyin collection folder by collects_id.

Inputs: collects_id (required), limit.

get_self_user_infoB

Get basic info of the currently logged-in Douyin account.

Inputs: no named parameters.

get_video_detailB

Get detailed metadata and stats for a Douyin video by aweme_id or share_url.

Inputs: aweme_id, share_url.

list_collection_videosC

List videos from the default Douyin 'favorite' collection.

Inputs: limit, cursor.

list_collectsA

List the logged-in user's Douyin collection folders (收藏夹/专辑), with id, name and video count.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools target distinct actions (login, logout, list, get detail), but douyin_login_status and douyin_health_check substantially overlap since health_check also reports login status. The rest are clearly separable.

    Naming Consistency3/5

    Four tools use a douyin_ prefix while five use bare verb_noun, and there is confusing terminology drift between 'collection'/'collect' (list_collects, get_collect_videos). Readable but not a single consistent pattern.

    Tool Count5/5

    Nine tools is well-scoped for a login-plus-collections server, with each tool earning its place and no bloat.

    Completeness3/5

    The surface is essentially read-only for a 'favorites' server: no add/remove-favorite, save-to-collection, or search operations, so agents cannot actually manage favorites as the name implies. Core listing and detail reads are covered.

    Related MCP Connectors

    Related MCP Servers