crawl_config.json 6.33 KB
{
  "version": "1.0.0",
  "agent": "weibo-scraper",
  "updated_at": "2026-04-13T10:35:00+08:00",
  "sources": [
    {
      "id": "weibo_pc_hotsearch",
      "name": "微博 PC 端热搜公开 API",
      "platform": "weibo",
      "category": "热搜榜",
      "url": "https://weibo.com/ajax/side/hotSearch",
      "method": "GET",
      "priority": 1,
      "enabled": true,
      "headers": {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
        "Accept": "application/json, text/plain, */*",
        "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
        "Connection": "keep-alive",
        "Referer": "https://weibo.com",
        "X-Requested-With": "XMLHttpRequest"
      },
      "parser": {
        "type": "json",
        "root_path": "$.data.realtime",
        "item_selector": "*",
        "fields": {
          "word": { "path": "word", "type": "string", "required": true },
          "word_scheme": { "path": "word_scheme", "type": "string", "required": false },
          "note": { "path": "note", "type": "string", "required": false },
          "num": { "path": "num", "type": "integer", "required": true },
          "rank": { "path": "realpos", "type": "integer", "required": true },
          "label_name": { "path": "label_name", "type": "string", "required": false },
          "flag": { "path": "flag", "type": "integer", "required": false },
          "topic_flag": { "path": "topic_flag", "type": "integer", "required": false, "default": 0 }
        }
      },
      "notes": "核心数据源。无需登录,实测返回 51 条 realtime 数据 + 1 条 hotgov 置顶数据。"
    },
    {
      "id": "weibo_60s_api",
      "name": "60s 读世界聚合 API",
      "platform": "weibo",
      "category": "热搜榜",
      "url": "https://60s.viki.moe/v2/weibo",
      "method": "GET",
      "priority": 2,
      "enabled": true,
      "headers": {
        "User-Agent": "Mozilla/5.0"
      },
      "parser": {
        "type": "json",
        "root_path": "$.data",
        "item_selector": "*",
        "fields": {
          "word": { "path": "title", "type": "string", "required": true },
          "num": { "path": "hot_value", "type": "integer", "required": false },
          "url": { "path": "link", "type": "string", "required": false }
        }
      },
      "notes": "第三方聚合接口,字段精简但稳定性好,作为官方 API 的降级/对账来源。"
    },
    {
      "id": "weibo_xxapi",
      "name": "XXAPI 免费微博热搜接口",
      "platform": "weibo",
      "category": "热搜榜",
      "url": "https://v2.xxapi.cn/api/weibohot",
      "method": "GET",
      "priority": 3,
      "enabled": true,
      "headers": {
        "User-Agent": "Mozilla/5.0"
      },
      "parser": {
        "type": "json",
        "root_path": "$.data",
        "item_selector": "*",
        "fields": {
          "rank": { "path": "index", "type": "integer", "required": true },
          "word": { "path": "title", "type": "string", "required": true },
          "num_label": { "path": "hot", "type": "string", "required": false },
          "url": { "path": "url", "type": "string", "required": false }
        }
      },
      "notes": "免密钥免费接口,热度值为字符串(如 '119万'),需后处理转为整数。"
    },
    {
      "id": "weibo_zxki_api",
      "name": "酷酷 API 聚合热榜",
      "platform": "weibo",
      "category": "热搜榜",
      "url": "https://api.zxki.cn/api/jhrs?type=weibo",
      "method": "GET",
      "priority": 4,
      "enabled": true,
      "headers": {
        "User-Agent": "Mozilla/5.0"
      },
      "parser": {
        "type": "json",
        "root_path": "$.data",
        "item_selector": "*",
        "fields": {
          "word": { "path": "title", "type": "string", "required": true },
          "num_label": { "path": "hot", "type": "string", "required": false },
          "url": { "path": "url", "type": "string", "required": false }
        }
      },
      "notes": "聚合多平台热榜的备用源,实测 HTTP 200 可用。"
    },
    {
      "id": "weibo_aa1_api",
      "name": "AA1.cn 微博热搜免费接口",
      "platform": "weibo",
      "category": "热搜榜",
      "url": "https://api.aa1.cn/api/weibo-rs",
      "method": "GET",
      "priority": 5,
      "enabled": true,
      "headers": {
        "User-Agent": "Mozilla/5.0"
      },
      "parser": {
        "type": "json",
        "root_path": "$.data",
        "item_selector": "*",
        "fields": {
          "rank": { "path": "index", "type": "integer", "required": true },
          "word": { "path": "title", "type": "string", "required": true },
          "num": { "path": "hot", "type": "integer", "required": false },
          "url": { "path": "url", "type": "string", "required": false },
          "mobile_url": { "path": "mobilUrl", "type": "string", "required": false }
        }
      },
      "notes": "实测可用的免费接口,返回 PC 端和移动端双 URL。"
    }
  ],
  "rate_limit": {
    "strategy": "adaptive",
    "min_delay_seconds": 2,
    "max_delay_seconds": 5,
    "requests_per_minute": 20,
    "cooldown_minutes": 1,
    "retry_on_rate_limit": {
      "enabled": true,
      "max_retries": 2,
      "backoff_seconds": 30
    }
  },
  "user_agent_pool": [
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 Mobile/15E148 Safari/604.1",
    "Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Mobile Safari/537.36"
  ],
  "validation": {
    "expected_content_type": "application/json",
    "fallback_content_types": ["text/html"],
    "success_indicator": {
      "path": "$.ok",
      "value": 1
    }
  },
  "output": {
    "schema": "weibo_hotsearch_v1",
    "required_fields": [
      "rank",
      "word",
      "num",
      "board_type",
      "source_url",
      "crawl_time"
    ],
    "include_raw_data": false
  },
  "compliance": {
    "robots_txt": "https://weibo.com/robots.txt",
    "crawl_delay_seconds": 10,
    "exclude_private_data": true,
    "exclude_ads": true,
    "data_retention_days": 90
  }
}