ソーシャルリスニングエージェント構築:Weibo + Douyin

チュートリアル:15分ごとにWeiboのホット検索とDouyinのホットアカウントランキングを確認し、ブランド言及を検出してSlackアラートを投稿するエージェント。

ソーシャルリスニングエージェント構築:Weibo + Douyinのカバー画像

Key takeaway (TL;DR) — Pythonエージェントが15分ごとにWeiboのホットサーチとDouyinのホットアカウントランキングを取得し、LLMにあなたのブランドや業界に関係する項目を判定させ、該当するものがあればSlackにアラートを投稿します。1サイクルあたりデータ呼び出し2回+LLM呼び出し1回で、1日あたりデータ呼び出し192回、LLM呼び出し96回です。各組織はUTCの1日あたり、対象API全体でデータAPI呼び出し100回まで無料で、それを超えるデータ呼び出しはSandBaseカタログ価格で1回ごとに課金されます。LLM側は以下のトークン前提で1日あたり約$0.72です(推定値)。コード全文を掲載し、2026-10-01 (UTC) にテスト済みです。

ブランドの危機は、あなたが朝に確認するまで待ってはくれません。午前2時にトレンド入りし始めたネガティブな投稿は、午前9時に確認するチームが見るまでに7時間拡散する猶予があります。この差が、「素早く対応した」と「不意を突かれた」の違いになります。

このソーシャルリスニングエージェントは、その猶予を15分のポーリング間隔1回分に、API・LLM・Slackの呼び出しにかかる数秒を加えた程度まで縮めます。

エージェントの動作

15分ごと、24時間365日:

  1. Weiboの現在のホットサーチ一覧を取得する(私の2026-10-01の実行では、ヒートスコア付きの50〜51件のトピック)
  2. Douyinのホットアカウントランキングを取得する(ランキング順のアカウントで、フォロワー数と新規フォロワー数を含む。これはアカウント一覧であり、ホットサーチのトピック一覧ではない)
  3. 両方の一覧を、あなたのブランドと業界のキーワードおよび分類ルールとともにLLMに送る
  4. ブランド言及または業界シグナルとしてフラグが立ったものがあれば、Slackのincoming webhookにメッセージを投稿する
  5. サイクルごとに、件数、フラグが立った項目、LLMの要約を含むログ行を追記する

使用するデータ

WeiboのホットサーチとDouyinのホットアカウントランキングは、誰でもアプリ内で見られる公開・読み取り専用の一覧です。SandBaseのAPIキーが必要です。SandBaseはWeiboやDouyinの公式パートナーではなく、このエージェントは非公開アカウントのデータ、DM、オーナー専用のアナリティクスを読むことはできず、投稿やアカウント操作を行うこともできません。

このチュートリアル(SandBaseの公開データAPI)公式デベロッパープラットフォーム(Weibo Open Platform、Douyin Open Platform)
アクセスSandBaseのAPIキー1つアプリ登録とプラットフォーム審査
範囲公開一覧と公開投稿: ホットサーチ、ホットアカウントランキング、キーワード検索あなたのアプリにアクセスを許可したアカウントに対する、認可済みのアカウント連携ワークフロー
アカウント操作(投稿、返信、DM)不可プラットフォームが権限を付与する場合に可能
オーナー向けアナリティクス不可認可済みアカウント向け
選ぶべき場面公開されているトレンドを監視し、その中に自社ブランドを捉えたいとき自分が管理するアカウントに対して操作を行いたい、または非公開データを読みたいとき

どちらのプラットフォームも、任意の公開データに対する汎用の未認証APIを提供しておらず、このアプローチはそのギャップを埋めるものです。

アーキテクチャ

Text
┌─────────────────┐     ┌──────────────┐     ┌─────────────┐     ┌──────────────┐
│ Scheduler       │────▶│ Data Fetch   │────▶│ LLM Classify│────▶│ Slack        │
│ (every 15 min)  │     │ Weibo+Douyin │     │ Relevant?   │     │ webhook      │
└─────────────────┘     └──────────────┘     └─────────────┘     └──────────────┘
                                                    │
                                                    ▼
                                             ┌────────────┐
                                             │ Cycle log  │
                                             │ (JSONL)    │
                                             └────────────┘

以下のコードでの1サイクルあたりの呼び出し: データ呼び出し2回+LLM呼び出し1回。1日96サイクルで: データ呼び出し192回+LLM呼び出し96回。

コード全文

すべてのデータ呼び出しはPOST https://api.sandbase.ai/v1/api/<endpoint>を使用し、JSONボディにはそのエンドポイントのパラメータのみを含めます。エンドポイントのリファレンス:

リファレンスでは完了したレスポンスを{id, status, model, outputs: [{data: ...}]}と記載しているため、コードはoutputs[0].dataのみを読み取り、呼び出しが完了しない場合は例外を送出します。これらはModel APIのPOSTルートであり、WeiboやDouyinのカタログページに表示されるGETルートではありません。

このサイクルが依存する2つのリファレンスは、コード内のリクエストボディを裏付けています。Weiboのホットサーチにはリクエストフィールドがないため、fetch_weibo_hot_search()は{}を送信し、Douyinのランキングはオプションのpage_numとpage_sizeを受け取ります。

weibo/web-v2/hot-searchのSandBaseエンドポイントリファレンス。POSTルート、空のリクエストボディセクション、レスポンススキーマを示す

Caption: weibo/web-v2/hot-searchのリファレンス: 操作フィールドのないPOST /v1/api/weibo/web-v2/hot-searchルートで、レスポンスにはid、status、model、outputsが含まれる(2026-10-02取得)。

douyin/billboard/hot-account-listのSandBaseエンドポイントリファレンス。date_window、page_num、page_size、query_tagフィールドを持つPOSTルートを示す

Caption: douyin/billboard/hot-account-listのリファレンスで、オプションのdate_window、page_num、page_size、query_tagを列挙している。エージェントはpage_numとpage_sizeのみを設定する(2026-10-02取得)。

Python
#!/usr/bin/env python3
"""Social listening agent: Weibo + Douyin.

Checks Weibo hot search and the Douyin hot account billboard every 15 minutes,
classifies relevance with an LLM, posts alerts to a Slack incoming webhook.
Run as a long-running process, or via cron with --once.
"""

import json
import os
import sys
import time
from datetime import datetime, timezone
from pathlib import Path

import requests
from openai import OpenAI

# --- Configuration ---
BRAND_KEYWORDS = ["你的品牌名", "YourBrand", "竞品A", "竞品B"]
INDUSTRY_KEYWORDS = ["AI", "大模型", "agent", "智能体"]
SLACK_WEBHOOK_URL = os.environ.get("SLACK_WEBHOOK_URL", "")  # Slack incoming webhook
CHECK_INTERVAL = 900  # 15 minutes in seconds
LOG_DIR = Path("./listening_logs")
LOG_DIR.mkdir(exist_ok=True)

SANDBASE_API_KEY = os.environ["SANDBASE_API_KEY"]
API_BASE = "https://api.sandbase.ai/v1/api"
HEADERS = {
    "Authorization": f"Bearer {SANDBASE_API_KEY}",
    "Content-Type": "application/json",
}

# OpenAI client for LLM calls only
client = OpenAI(
    base_url="https://api.sandbase.ai/v1",
    api_key=SANDBASE_API_KEY,
    timeout=60,
)


# --- Data fetching: POST /v1/api/<endpoint>, read outputs[0].data ---
def call_data_api(endpoint: str, params: dict | None = None, retries: int = 3) -> dict:
    """Call one SandBase data endpoint; retry HTTP 429/5xx with 1s, 2s backoff."""
    for attempt in range(retries):
        resp = requests.post(f"{API_BASE}/{endpoint}", headers=HEADERS, json=params or {}, timeout=90)
        if (resp.status_code == 429 or resp.status_code >= 500) and attempt < retries - 1:
            time.sleep(2 ** attempt)
            continue
        resp.raise_for_status()
        body = resp.json()
        outputs = body.get("outputs") or []
        if body.get("status") != "completed" or not outputs:
            raise RuntimeError(f"SandBase call did not complete: {body.get('status')} {body.get('error')}")
        return outputs[0].get("data") or {}


def fetch_weibo_hot_search() -> list:
    """Get current Weibo hot search list as [{title, heat}]."""
    data = call_data_api("weibo/web-v2/hot-search")
    # Observed-only field names (tested 2026-10-01): realtime[].word / .num
    return [
        {"title": t.get("word") or t.get("note"), "heat": t.get("num")}
        for t in data.get("realtime") or []
    ]


def fetch_douyin_hot_accounts() -> list:
    """Get Douyin hot account list (accounts ranked on the billboard, not topics)."""
    data = call_data_api("douyin/billboard/hot-account-list", {"page_num": 1, "page_size": 10})
    # Observed-only field names (tested 2026-10-01): data.user_list[].nick_name / .fans_cnt / .new_fans_cnt
    users = (data.get("data") or {}).get("user_list") or []
    return [
        {"title": u.get("nick_name"), "fans": u.get("fans_cnt"), "new_fans": u.get("new_fans_cnt")}
        for u in users
    ]


def fetch_weibo_keyword_posts(keyword: str) -> list:
    """Optional follow-up, not called by run_cycle: recent Weibo posts for a flagged keyword."""
    data = call_data_api("weibo/web-v2/realtime-search", {"query": keyword})
    # Observed-only field names (tested 2026-10-01): parsed_data.results[].content / .post_url
    return (data.get("parsed_data") or {}).get("results") or []


# --- Classification ---
def classify_relevance(weibo_topics: list, douyin_accounts: list) -> dict:
    """Use LLM to classify which topics are relevant to our brand/industry."""
    prompt = f"""You are a brand monitoring analyst. Review these Weibo trending topics and Douyin hot accounts and classify each as:
- "brand_mention": directly mentions our brand or competitors
- "industry_relevant": relevant to our industry but not a direct mention
- "irrelevant": not related

Brand keywords: {json.dumps(BRAND_KEYWORDS, ensure_ascii=False)}
Industry keywords: {json.dumps(INDUSTRY_KEYWORDS, ensure_ascii=False)}

WEIBO HOT SEARCH (top 20):
{json.dumps(weibo_topics[:20], ensure_ascii=False, indent=2)}

DOUYIN HOT ACCOUNTS (top 10):
{json.dumps(douyin_accounts[:10], ensure_ascii=False, indent=2)}

Respond in JSON format only, no markdown:
{{
  "brand_mentions": [{{"source": "weibo|douyin", "title": "...", "heat": N, "reason": "..."}}],
  "industry_relevant": [{{"source": "weibo|douyin", "title": "...", "heat": N, "reason": "..."}}],
  "summary": "One sentence overall assessment"
}}

Only include items that are genuinely relevant. Empty lists are fine if nothing matches."""

    resp = client.chat.completions.create(
        model="anthropic/claude-sonnet-4",
        messages=[{"role": "user", "content": prompt}],
        max_tokens=1500,
    )
    if resp.usage:  # log real token counts so you can check the cost estimate
        print(f"  LLM tokens: {resp.usage.prompt_tokens} in / {resp.usage.completion_tokens} out")
    text = (resp.choices[0].message.content or "").strip()
    if text.startswith("`" * 3):  # tolerate a fenced reply
        text = text.strip("`").removeprefix("json").strip()
    try:
        return json.loads(text)
    except json.JSONDecodeError:
        return {"brand_mentions": [], "industry_relevant": [], "summary": "Parse error"}


# --- Alerting (Slack incoming webhook payload: {"text": ...}) ---
def send_slack_alert(classification: dict, timestamp: str):
    """Post brand mentions and industry signals to Slack."""
    if not SLACK_WEBHOOK_URL:
        print("  No Slack webhook configured, skipping alert")
        return

    brand_mentions = classification.get("brand_mentions") or []
    industry = classification.get("industry_relevant") or []
    if not brand_mentions and not industry:
        return  # Nothing to alert

    blocks = []
    if brand_mentions:
        blocks.append("🚨 *Brand mentions*\n" + "\n".join(
            f"• [{m.get('source', '?').upper()}] {m.get('title')} (heat: {m.get('heat', '?')}) — {m.get('reason', '')}"
            for m in brand_mentions
        ))
    if industry:
        blocks.append("📡 *Industry signals*\n" + "\n".join(
            f"• [{i.get('source', '?').upper()}] {i.get('title')} — {i.get('reason', '')}"
            for i in industry[:5]  # Cap industry items
        ))

    message = {
        "text": f"Social Listening Alert — {timestamp}\n\n" + "\n\n".join(blocks)
                + f"\n\n_{classification.get('summary', '')}_"
    }
    try:
        resp = requests.post(SLACK_WEBHOOK_URL, json=message, timeout=10)
        resp.raise_for_status()
        print(f"  Alert sent: HTTP {resp.status_code}")
    except requests.RequestException as e:
        print(f"  Alert failed: {e}")


# --- Logging ---
def log_cycle(timestamp: str, weibo: list, douyin: list, classification: dict):
    """Append one JSON line per cycle: counts, flagged items, summary."""
    log_entry = {
        "timestamp": timestamp,
        "weibo_count": len(weibo),
        "douyin_count": len(douyin),
        "brand_mentions": classification.get("brand_mentions") or [],
        "industry_relevant": classification.get("industry_relevant") or [],
        "summary": classification.get("summary", ""),
    }
    log_file = LOG_DIR / f"listening-{timestamp[:10]}.jsonl"
    with open(log_file, "a", encoding="utf-8") as f:
        f.write(json.dumps(log_entry, ensure_ascii=False) + "\n")


# --- Main loop ---
def run_cycle():
    """Execute one monitoring cycle: 2 data calls + 1 LLM call."""
    timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
    print(f"\n[{timestamp}] Running social listening cycle...")

    weibo = fetch_weibo_hot_search()
    print(f"  Got {len(weibo)} Weibo topics")
    douyin = fetch_douyin_hot_accounts()
    print(f"  Got {len(douyin)} Douyin accounts")

    classification = classify_relevance(weibo, douyin)
    brand_count = len(classification.get("brand_mentions") or [])
    industry_count = len(classification.get("industry_relevant") or [])
    print(f"  Found: {brand_count} brand mentions, {industry_count} industry signals")

    # Brand mentions and industry-only signals both go to Slack
    if brand_count > 0:
        print("  ⚠️ Brand mention detected! Sending alert...")
        send_slack_alert(classification, timestamp)
    elif industry_count > 0:
        print("  📡 Industry signal detected, sending digest...")
        send_slack_alert(classification, timestamp)
    else:
        print("  ✓ Nothing relevant this cycle")

    log_cycle(timestamp, weibo, douyin, classification)
    return classification


def run_continuous():
    """Run as a long-lived process with 15-minute intervals."""
    print("Social Listening Agent started")
    print(f"  Brand keywords: {BRAND_KEYWORDS}")
    print(f"  Industry keywords: {INDUSTRY_KEYWORDS}")
    print(f"  Check interval: {CHECK_INTERVAL}s")
    print(f"  Slack webhook: {'configured' if SLACK_WEBHOOK_URL else 'NOT configured'}")

    while True:
        try:
            run_cycle()
        except Exception as e:
            print(f"  ERROR: {e}")
        time.sleep(CHECK_INTERVAL)


if __name__ == "__main__":
    if "--once" in sys.argv:
        run_cycle()  # Single cycle for testing / cron
    else:
        run_continuous()

2026-10-01 (UTC) にテスト済み

上記のコードを、LLMをスタブ化し、データ呼び出しは実際に行って実行しました。どちらの一覧エンドポイントもキーワードを受け取りません。以下のリクエストは、コードが送信する内容そのものです。フィールド名はこれらの呼び出しから得たものであり、観測されただけのものであって文書化された保証ではないため、すべての読み取りで.get()を使用しています。レスポンスは省略しています。

Text
POST https://api.sandbase.ai/v1/api/weibo/web-v2/hot-search
{}

{"id": "1e56f2e0-3eca-4242-b371-0a4e2f4cc060", "status": "completed", "model": "weibo/web-v2/hot-search",
 "outputs": [{"data": {"realtime": [
   {"word": "鸿蒙智行问界业务升级", "num": 1116159, "realpos": 1, "label_name": "新", ...},
   ...], "hotgov": {...}, "hotgovs": [...]}}]}
Text
POST https://api.sandbase.ai/v1/api/douyin/billboard/hot-account-list
{"page_num": 1, "page_size": 10}

{"id": "c38e0333-4f1d-4104-b5bc-f41dbb8a06ad", "status": "completed", "model": "douyin/billboard/hot-account-list",
 "outputs": [{"data": {"code": 0, "message": "", "data": {"has_more": true, "user_list": [
   {"nick_name": "人民日报", "fans_cnt": 203210991, "new_fans_cnt": 51760, ...},
   {"nick_name": "央视新闻", "fans_cnt": 187596558, "new_fans_cnt": 38735, ...},
   ...]}}}]}

この実行ではホットサーチのトピック51件とアカウント10件が返りました(ランキングの上位は人民日報やCCTV Newsなどの公式メディアアカウントでした)。5回のテストサイクルを通じて、エージェントはブランド言及と業界のみのシグナルでアラートを出し、何もフラグが立たない場合はアラートをスキップし、プリフィルタ版はキーワードが一致しない場合にLLMをスキップしました。Slackのペイロードはローカルのテストエンドポイントに投稿され、実際のSlackワークスペースには投稿されていません。

コスト内訳

毎日最初のデータAPI呼び出し100回はあなたの組織にとって無料で(対象APIにおいて)、それ以降は1回ごとに課金されるため、データ側はおおよそ1日あたりそれを超える92回の呼び出し×各エンドポイントのカタログ価格(sandbase inspectで確認してください)となり、これにLLMコストが加わります。anthropic/claude-sonnet-4は2026-10-01時点のSandBaseで、入力トークン100万あたり$3、出力トークン100万あたり$15です。

トークン前提(例示): 私の2026-10-01のデータから構築した分類プロンプトは、EN版とZH版のプロンプトで約2,300〜2,700文字でした(大半はJSONの空白とASCIIで、EN版には約250文字のCJK文字)。これを約1,000入力トークンに丸めています。典型的な返答では約300出力トークンを想定します。1回あたり: 1,000 × $3/M + 300 × $15/M = $0.003 + $0.0045 = $0.0075。

コンポーネント1サイクルあたり1日あたり(96サイクル)
Weiboホットサーチデータ呼び出し1回96回
Douyinホットアカウントデータ呼び出し1回96回
LLM分類1回、約$0.0075(推定)96回、約$0.72
合計データ呼び出し2回+LLM呼び出し1回データ呼び出し192回+LLM約$0.72

これは30日の月でLLMトークン約$21.60に加え、毎日の無料100回を超える呼び出しに対する1回ごとのデータ課金です。出力はmax_tokens=1500で上限が設定されています。すべての返答が上限に達した場合、1回のコストは$0.003 + 1,500 × $15/M = $0.0255、つまり1日$2.45になります。コードが出力するLLM tokens:の行から実際の数値が得られるので、この計算をやり直せます。

最適化版: キーワードプリフィルタ

ドルコストの実質的全部はLLM呼び出しなので、生の一覧にキーワードが現れない場合はスキップします:

Python
def quick_keyword_check(items: list, keywords: list) -> bool:
    """Fast check: does any keyword appear in any item? No API call."""
    text = " ".join(json.dumps(i, ensure_ascii=False) for i in items).lower()
    return any(kw.lower() in text for kw in keywords)


def run_cycle_optimized():
    """Same as run_cycle, but only calls the LLM when a keyword shows up."""
    timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
    weibo = fetch_weibo_hot_search()
    douyin = fetch_douyin_hot_accounts()

    if quick_keyword_check(weibo + douyin, BRAND_KEYWORDS + INDUSTRY_KEYWORDS):
        classification = classify_relevance(weibo, douyin)
        send_slack_alert(classification, timestamp)  # sends for brand or industry items
    else:
        classification = {"brand_mentions": [], "industry_relevant": [], "summary": "No keyword match"}
    log_cycle(timestamp, weibo, douyin, classification)
    return classification

トレードオフ: プリフィルタはリテラルのキーワードにしか一致しないため、あなたの語のいずれかを含まない業界トピックはLLMに届きません。節約額はキーワードがどれくらいの頻度で現れるかに依存します。例として、サイクルの30%で一致があったとすると、1日あたり96回ではなく約29回のLLM呼び出しとなり、同じトークン前提でおおよそ28.8 × $0.0075 × 30 ≈ $6.48/月になります。

デプロイの選択肢

選択肢1: 常時稼働プロセス(VPS/コンテナ)

Shell
SANDBASE_API_KEY=sk-... SLACK_WEBHOOK_URL=https://hooks.slack.com/services/... python3 listener.py

systemdまたはDockerの再起動ポリシーで稼働させ続けます。

選択肢2: 15分ごとのCron

Shell
*/15 * * * * SANDBASE_API_KEY=sk-... SLACK_WEBHOOK_URL=... python3 listener.py --once

よりシンプルです。各起動は新規に開始し、ディスク上のJSONLログが唯一の状態であるため、項目がサイクルをまたいで一覧に残っているとエージェントは再びアラートを出します。それが煩わしければ、最後のログ行に対して重複排除してください。

選択肢3: GitHub Actions

YAML
on:
  schedule:
    - cron: '*/15 * * * *'  # Every 15 minutes

GitHubは、スケジュールされたワークフローが高負荷時に遅延する可能性があると文書化しているため、時間に敏感なアラートには適していません。

アラートが発火したときの対応

エージェントは検知します。人間が判断します。推奨する対応フロー:

  1. ブランド言及アラート → マーケティング/PRチームが30分以内にレビュー
  2. ネガティブ感情+高いヒート → 危機対応プロトコルにエスカレーション
  3. 業界シグナル → 週次の戦略ブリーフィングに追加
  4. 競合の言及 → 競合インテリジェンスレビュー用に記録

エージェントの拡張

感情分析の深掘りを追加: ブランド言及が検知されたとき、fetch_weibo_keyword_posts()(weibo/web-v2/realtime-search、queryを受け取る)を呼び出してそのキーワードの最近の投稿を取得し、それらに対して感情分析を実行します。2026-10-01に{"query": "小米"}(実行973c3249-af8e-462c-b001-34e2fbf1ffac)で呼び出したところ、parsed_data.resultsの下に10件の投稿が返りました(観測されただけのフィールド名)。これはrun_cycleでは呼び出されません。組み込むと、サイクルごとではなくアラートごとにデータ呼び出し1回+感情分析LLM呼び出し1回が追加されます。

そのフォローアップエンドポイントのリファレンスでは、queryが唯一の必須フィールドで、pageのデフォルトは1です。

weibo/web-v2/realtime-searchのSandBaseエンドポイントリファレンス。pageと必須のqueryフィールドを持つPOSTルートを示す

Caption: fetch_weibo_keyword_posts()が使用するweibo/web-v2/realtime-searchのリファレンス: queryが必須で、pageのデフォルトは1(2026-10-02取得)。

Xiaohongshuを追加: xiaohongshu/app-v2/search-notes経由のキーワード検索(keywordを受け取る)は3つ目のソースとして機能します。2026-10-01に{"keyword": "小米"}(実行eae32bb2-f69c-4c98-8091-e60a139240cc)で呼び出したところ、data.items[].noteの下に20件のノートが返りました(観測されただけのフィールド名)。同じパターンで、1サイクルあたりデータ呼び出しが1回増えます(+96回/日)。

履歴トレンド分析: 各ログ行がフラグの立った項目を保持しているため、30日後にはどの業界トピックが週ごとに繰り返し現れるかをLLMに尋ねることができます。

制限事項

  • 15分の粒度: リアルタイムではありません。危機は1つの間隔のうちに勢いを増す可能性があります。より高い緊急性が必要なら、5分間隔に短縮してください(呼び出しとLLMコストが3倍)。
  • LLM分類は不完全: 誤検知は起こります。プロンプトは過剰アラート寄りに傾いており、最終判断は人間が行います。
  • Weiboのホットサーチは網羅的ではない: トピックは素早く入れ替わり、トレンドにならないブランドへの不満は決して現れません。より深いカバレッジにはキーワード検索(FAQ参照)を追加してください。
  • Douyinの動画コンテンツ分析はなし: エージェントが見るのはホットアカウントのメタデータであり、動画コンテンツではありません。気になる動画については、douyin/app-v3/one-video(aweme_idを受け取る)が動画の詳細を返します。2026-10-01の呼び出し(実行8d56b7aa-d98d-4559-b6da-cc2d17a47a2c)では、ペイロードはaweme_detailの下にありました(観測されただけ)。

FAQ

ホットサーチの代わりに特定のキーワードを監視できますか?

はい。weibo/web-v2/advanced-search(キーワードはqに入れる。2026-10-01に{"q": "小米"}、実行93a2caa9-42fe-497a-8dbf-3ffabfbc6fd4で呼び出したところ、parsed_data.resultsの下に20件の投稿が返りました。観測されただけ)またはweibo/web-v2/realtime-search(キーワードはqueryに入れる)を、ホットサーチ一覧の代わりに、あるいはそれに加えて、独自のキーワードで使用してください。これにより、トレンドにはなっていないが関連性のある言及を捉えられます。

ブランド危機をどのくらい速く捉えますか?

トピックがWeiboのホットサーチに載るか、アカウントがDouyinのランキングに載ってからです。その時点から、最悪のケースは1間隔分(15分)に、データ呼び出し2回、LLM呼び出し、Slack投稿にかかる時間を加えたものです。私の2026-10-01のテスト実行におけるホットサーチとホットアカウントの22回の呼び出しでは、データ呼び出しはそれぞれ1.5〜5.2秒かかりました。

どのwebhookサービスが使えますか?

コードはSlackのincoming-webhookペイロード{"text": "..."}を送信します。リクエストは実際のSlackワークスペースではなく、ローカルのテストエンドポイントに対して確認しました。Discord、PagerDuty、Feishu/Lark、DingTalkはそれぞれ異なるJSONボディを期待するため、独自のペイロードビルダーが必要です。

複数ブランドで実行できますか?

はい。異なるキーワードリストを持つ別々のインスタンスを維持するか、キーワード配列を拡張してLLMにブランドごとに分類させるかのどちらかです。後者なら、ブランドごとに1回ではなく、1サイクルあたりLLM呼び出し1回になります。

利用可能なデータの詳細については、Weibo & Xiaohongshu Data APIs Now on SandBaseとDouyin Public Data APIをご覧ください。

Get a SandBase API key · Browse the Weibo API catalog · Browse the Douyin API catalog

関連記事

役に立ったらシェアしてください