{
  "title": "斗球直播API接口文档",
  "version": "2026-05-14",
  "base_url": "https://www.x5tolic.com",
  "cdn_url": "https://sta-prod-score01-new-prod511.qaffvz.com",
  "live_cdn_url": "https://vxx.kanyunshi.com",
  "anim_cdn_url": "https://d2theorj75dyet.cloudfront.net",
  "pic_cdn_url": "https://sta-prod-pic-prod511.jiaoict.com",
  "signature": {
    "signKey": "3577a5ec93594b7ac2c615333e16256r",
    "algorithm": "sign = sha256(md5(data_str + '&key=signKey&t=timestamp'))"
  },
  "required_headers": {
    "channel": "F0",
    "version": "1.8.9",
    "client-type": "web",
    "channelApp": "F0",
    "platform": "dq",
    "auth": "Basic YXBwOmFwcA=="
  },
  "apis": [
    {"method": "POST", "path": "/qiutx-score/v2/web/match/list", "description": "比赛列表", "params": "sportType=1足球/2篮球, status=0全部/2进行中, date", "category": "比分"},
    {"method": "GET", "path": "/qiutx-score/v5/match/match", "description": "比赛详情(含直播流地址)", "params": "id=matchId", "category": "比分", "note": "hasLive=1时返回liveM3u8Url/liveFlvUrl/rtmpUrl"},
    {"method": "GET", "path": "/qiutx-score/v5/matchEvent/all", "description": "比赛事件(进球/红黄牌/换人)", "params": "matchId", "category": "比分"},
    {"method": "GET", "path": "/qiutx-score/web/index/soccer/integralRank", "description": "积分榜", "params": "leagueId", "category": "比分"},
    {"method": "GET", "path": "/qiutx-score/v4/league/getLeagueAndCountry", "description": "联赛列表", "params": "typeId=1足球/2篮球/3棒球/5网球", "category": "比分"},
    {"method": "GET", "path": "/qiutx-score/v9/queryOddsBook", "description": "赔率公司列表", "params": "", "category": "赔率"},
    {"method": "GET", "path": "/qiutx-score/v8/queryOdd", "description": "单场赔率", "params": "bookId, matchId", "category": "赔率"},
    {"method": "GET", "path": "/qiutx-score/v4/league/teams", "description": "联赛球队列表", "params": "leagueId, seasonId(必填)", "category": "比分"},
    {"method": "WS", "path": "wss://www.x5tolic.com/socket.io/", "description": "Socket.IO实时推送", "params": "matchId订阅实时比分更新", "category": "实时"},
    {"method": "GET", "path": "/live-product/anonymous/v3/web/rooms/index", "description": "直播首页(数据最全)", "params": "", "category": "直播", "response_fields": ["matchLiveList(83场)", "hotAnchorList(20个)", "footballMatch", "basketballMatch", "bannerList", "liveGroupList"]},
    {"method": "GET", "path": "/live-product/anonymous/newWeb/home/hot", "description": "热门直播主播列表", "params": "", "category": "直播", "response_fields": ["anchorId", "nickname", "headImageUrl", "hotCount", "matchId", "leagueId"]},
    {"method": "GET", "path": "/live-product/anonymous/sidebar/hot/matches", "description": "热门比赛直播(联赛分组)", "params": "", "category": "直播", "response_fields": ["leagueId", "leagueName", "matches[]"]},
    {"method": "GET", "path": "/live-product/anonymous/v5/anchors/queryLiveMatch", "description": "按比赛查主播", "params": "matchId", "category": "直播"}
  ],
  "live_stream_fields": {
    "description": "比赛详情接口(v5/match/match)当hasLive=1时返回的直播流字段",
    "fields": {
      "liveM3u8Url": {"format": "https://vxx.kanyunshi.com/org/{id}.m3u8?auth_key=...", "type": "HLS", "recommended": true},
      "liveFlvUrl": {"format": "https://vxx.kanyunshi.com/org/{id}.flv?auth_key=...", "type": "FLV"},
      "rtmpUrl": {"format": "rtmp://vvo.e3x7up.com/org/{id}?...", "type": "RTMP"},
      "pathM3u8": {"format": "同liveM3u8Url", "type": "HLS备用"},
      "pathFlv": {"format": "同liveFlvUrl", "type": "FLV备用"},
      "trendAnim": {"format": "https://d2theorj75dyet.cloudfront.net/sc/index.jsp?matchId=...&code=...", "type": "动画直播"},
      "hasLive": {"type": "0/1", "description": "是否有视频直播"},
      "hasAnchor": {"type": "0/1", "description": "是否有主播直播"},
      "videoStatus": {"type": "Number", "description": "视频状态(2=直播中)"}
    },
    "note": "直播流地址含auth_key签名,有时效性,需实时获取"
  },
  "match_live_list_fields": {
    "description": "直播首页matchLiveList单条字段",
    "fields": {
      "matchId": "比赛ID",
      "anchorId": "主播ID",
      "roomId": "直播间ID",
      "liveTitle": "直播标题",
      "liveType": "直播类型(2=视频直播)",
      "liveImage": "直播封面图URL",
      "playAddr": "播放地址",
      "nickname": "主播昵称",
      "hotCount": "人气值",
      "scanCount": "观看人数",
      "fans": "粉丝数",
      "streamServerType": "流服务器类型(huawei等)",
      "chatId": "聊天室ID",
      "status": "状态(1=直播中)",
      "isRobot": "是否机器人(0=真人)",
      "barrageCount": "弹幕数",
      "openDate": "开播时间"
    }
  },
  "logo_scraping": {
    "description": "球队/联赛Logo采集专题 - 4个数据源接口",
    "cdn_base": "https://sta-prod-score01-new-prod511.qaffvz.com",
    "logo_url_format": {
      "team": "https://sta-prod-score01-new-prod511.qaffvz.com/teams/{date_path}_{size}.png",
      "league": "https://sta-prod-score01-new-prod511.qaffvz.com/league/{date_path}_{size}.png",
      "sizes": ["150x150", "215x215"]
    },
    "data_sources": [
      {
        "priority": 1,
        "method": "POST",
        "path": "/qiutx-score/v2/web/match/list",
        "logo_types": ["team", "league"],
        "description": "最全数据源, 每场比赛含主客队+联赛logo",
        "params": "sportType=1/2, filterType=0, date=YYYY-MM-DD",
        "logo_fields": {
          "team": ["hostTeamId", "hostTeamName", "hostTeamLogo", "guestTeamId", "guestTeamName", "guestTeamLogo"],
          "league": ["leagueId", "leagueName", "leagueLogo"]
        },
        "coverage": "18000+ teams, 1500+ leagues (scan ±30 days)"
      },
      {
        "priority": 2,
        "method": "GET",
        "path": "/qiutx-score/v4/league/getLeagueAndCountry",
        "logo_types": ["league"],
        "description": "联赛logo (足球/棒球/网球, 篮球返回0)",
        "params": "typeId=1足球/3棒球/5网球",
        "logo_fields": {
          "league": ["id", "cnAlias", "cnName", "logoUrl", "sportId", "seasonId"]
        },
        "coverage": "110 leagues"
      },
      {
        "priority": 3,
        "method": "GET",
        "path": "/qiutx-score/web/index/soccer/integralRank",
        "logo_types": ["team"],
        "description": "积分榜球队logo (仅顶级联赛)",
        "params": "leagueId",
        "basketball_path": "/qiutx-score/web/index/basketball/integralRank",
        "logo_fields": {
          "team": ["teamId", "teamName", "teamLogo", "teamNameInitials", "rank", "score"]
        },
        "extra_returns": ["seasonId", "leagueName"],
        "top_league_ids": {
          "football": [2,3,9,10,11,13,14,15,16,17,18,19,20,21,22,23,29,30,31,227],
          "basketball": [580, 673]
        }
      },
      {
        "priority": 4,
        "method": "GET",
        "path": "/qiutx-score/v4/league/teams",
        "logo_types": ["team"],
        "description": "联赛球队列表 (需seasonId必填)",
        "params": "leagueId, seasonId(必填, 不传返回99500)",
        "note": "seasonId从getLeagueAndCountry或integralRank获取"
      }
    ],
    "logo_url_normalization": {
      "full_url": "直接使用",
      "relative_path": "加cdn_base前缀",
      "old_format_prefix": "_file/ 开头, 去掉前缀+加cdn_base",
      "null_or_empty": "跳过, 无Logo"
    },
    "scraper_tool": {
      "script": "douqiu/scripts/scrape_logos.py",
      "usage": {
        "full": "python3 scrape_logos.py",
        "no_download": "python3 scrape_logos.py --no-download",
        "custom_days": "python3 scrape_logos.py --days 30"
      },
      "output": {
        "teams_dir": "public/logos/teams/{teamId}.png",
        "leagues_dir": "public/logos/leagues/{leagueId}.png",
        "map_file": "public/logos/logos_map.json"
      },
      "stats": {
        "teams_total": 18147,
        "teams_with_logo": 17980,
        "football_teams": 15220,
        "basketball_teams": 2927,
        "leagues_total": 1514,
        "leagues_with_logo": 1498,
        "local_files": 19503,
        "local_size": "233MB"
      }
    },
    "online_map": "https://douqiu.yy.la/logos/logos_map.json"
  },
  "external_api": {
    "base_url": "https://douqiu.yy.la/v1",
    "auth": "Header X-API-Key 或 ?api_key=",
    "test_key": "dq_public_2026",
    "live_apis": [
      {
        "method": "GET",
        "path": "/v1/live/rooms",
        "description": "PlazaFM 直播间列表(含缩略图/主播/人气)",
        "params": "page, per_page(max100), live_type(1娱乐/2游戏/3体育/4电竞)",
        "cache": "15秒",
        "provider": "PlazaFM"
      },
      {
        "method": "GET",
        "path": "/v1/live/rooms/:roomId",
        "description": "PlazaFM 单个直播间详情",
        "params": "roomId(路径参数)",
        "cache": "30秒",
        "provider": "PlazaFM"
      },
      {
        "method": "GET",
        "path": "/v1/live/streams/:roomId",
        "description": "PlazaFM 获取直播流地址(sd/ud × m3u8/flv/rtmp)",
        "params": "anchorId(必填,从rooms列表获取)",
        "cache": "不缓存(auth_key有时效性)",
        "note": "推荐使用ud.m3u8，浏览器用HLS.js播放",
        "provider": "PlazaFM"
      }
    ],
    "stream_cdn": "live.dtdgc.com (阿里云直播，无防盗链)",
    "stream_format": "https://live.dtdgc.com/live/{roomId}_{sd|ud}.m3u8?auth_key={ts}-0-0-{md5}",
    "auth_key_ttl": "约1小时"
  },
  "yyzb_api": {
    "base_url": "https://douqiu.yy.la/v1/yyzb",
    "auth": "Header X-API-Key 或 ?api_key=",
    "test_key": "dq_public_2026",
    "provider": "YYZB (yyzb1.tv)",
    "apis": [
      {
        "method": "GET",
        "path": "/v1/yyzb/rooms",
        "description": "YYZB 直播间列表(含封面/主播/人气/分类)",
        "params": "page, per_page(max100), live_type_parent(1娱乐/2体育/3游戏), nocache=1强制刷新",
        "cache": "30秒",
        "response_fields": ["roomNum", "uid", "nickName", "title", "cover", "icon", "viewCount", "liveStatus", "liveType", "liveTypeParent", "liveTypeName"]
      },
      {
        "method": "GET",
        "path": "/v1/yyzb/rooms/:roomNum",
        "description": "YYZB 房间详情+流地址",
        "params": "roomNum(路径参数), nocache=1强制刷新",
        "cache": "30秒",
        "response_fields": ["roomNum", "title", "anchor", "viewCount", "liveStatus", "streams.sd/hd.m3u8/flv"]
      },
      {
        "method": "GET",
        "path": "/v1/yyzb/streams/:roomNum",
        "description": "YYZB 获取直播流地址(简化版,不缓存)",
        "params": "roomNum(路径参数)",
        "cache": "不缓存(auth_key约1小时有效)",
        "response_fields": ["streams.sd.m3u8/flv", "streams.hd.m3u8/flv"]
      },
      {
        "method": "GET",
        "path": "/v1/yyzb/hot_anchors",
        "description": "YYZB 热门主播列表",
        "params": "无",
        "cache": "30秒",
        "response_fields": ["uid", "nickName", "icon", "roomNum", "grow", "score", "level"]
      }
    ],
    "stream_cdn": "pullsgp.yyzb456.top (华为云CDN，需Referer防盗链)",
    "stream_format": "https://pullsgp.yyzb456.top/live/stream-{roomNum}_{lsd|lhd}.{m3u8|flv}?auth_key={expire}-0-0-{md5}",
    "auth_key_ttl": "约1小时",
    "anti_leech": "华为云CDN需携带Referer(yyzb1.tv)，建议通过 /yyzb/stream/m3u8 代理播放",
    "live_type_parent": {"1": "娱乐", "2": "体育", "3": "游戏"},
    "live_type": {"1": "娱乐", "2": "体育", "3": "游戏", "14": "CBA"}
  },
  "league_ids": {
    "2": "欧冠", "9": "英超", "3": "西甲", "21": "德甲", "15": "意甲", "20": "法甲",
    "227": "中超", "580": "NBA", "673": "CBA"
  },
  "sport_types": {"1": "足球", "2": "篮球", "3": "棒球", "5": "网球"},
  "match_status": {"0": "未开始", "1": "即将开始", "2": "进行中", "3": "已结束", "4": "取消/异常"},
  "proxy_base": "https://douqiu.yy.la/api/",
  "markdown_source": "/docs/api.md"
}
