{"record":{"id":"83686208cc1f7b3e","repo":"soimort/you-get","slug":"error","errorCode":null,"errorMessage":"Error : {}","messagePattern":"Error : (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/you_get/extractors/yizhibo.py","lineNumber":14,"sourceCode":"#!/usr/bin/env python\n\n__all__ = ['yizhibo_download']\n\nfrom ..common import *\nimport json\n\ndef yizhibo_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):\n    video_id = url[url.rfind('/')+1:].split(\".\")[0]\n    json_request_url = 'http://www.yizhibo.com/live/h5api/get_basic_live_info?scid={}'.format(video_id)\n    content = get_content(json_request_url)\n    error = json.loads(content)['result']\n    if (error != 1):\n        raise ValueError(\"Error : {}\".format(error))\n\n    data = json.loads(content)\n    title = data.get('data')['live_title']\n    if (title == ''):\n        title = data.get('data')['nickname']\n    m3u8_url = data.get('data')['play_url']\n    m3u8 = get_content(m3u8_url)\n    base_url = \"/\".join(data.get('data')['play_url'].split(\"/\")[:7])+\"/\"\n    part_url = re.findall(r'([0-9]+\\.ts)', m3u8)\n    real_url = []\n    for i in part_url:\n        url = base_url + i\n        real_url.append(url)\n    print_info(site_info, title, 'ts', float('inf'))\n    if not info_only:\n        if player:\n            launch_player(player, [m3u8_url])\n        download_urls(real_url, title, 'ts', float('inf'), output_dir, merge = merge)","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/soimort/you-get/blob/049548f3f3f35e67ba8d3181c71fdc71d11cf260/src/you_get/extractors/yizhibo.py#L1-L32","documentation":"yizhibo_download derives the show id (scid) from the last path segment of the URL, then calls http://www.yizhibo.com/live/h5api/get_basic_live_info?scid=<id>. When the JSON envelope's 'result' field is anything but 1, the API itself flagged failure (bad scid, ended/removed show, anti-crawl) and the extractor raises ValueError with that code.","triggerScenarios":"A yizhibo URL whose trailing segment is not a valid scid (e.g. page URLs like /mycenter, or ids with junk after the dot handled by split('.')[0] producing garbage), or a valid scid for a show that ended/was deleted so get_basic_live_info returns result != 1.","commonSituations":"Non-show pages on yizhibo.com whose URL still ends in a segment; replays removed after moderation; service degradation of yizhibo (platform effectively shut down) making every scid fail.","solutions":["Confirm the URL points at an actual live/show page and the scid extracted from the last path segment is valid","Print the raw get_basic_live_info response for that scid to see the machine-readable reason behind the non-1 result","If the platform is defunct or the API is gone, no client-side fix exists — capture streams live while they run","Patch the raise to include the JSON message body for easier diagnosis"],"exampleFix":"# before\nerror = json.loads(content)['result']\nif (error != 1):\n    raise ValueError(\"Error : {}\".format(error))\n\n# after (surface the API's own message)\ndata = json.loads(content)\nif data.get('result') != 1:\n    raise ValueError('yizhibo error {}: {}'.format(data.get('result'), data.get('msg', 'unknown')))","handlingStrategy":"try-catch","validationCode":"import json\n\ndef yizhibo_show_ok(video_id, fetch):\n    return json.loads(fetch('http://www.yizhibo.com/live/h5api/get_basic_live_info?scid=%s' % video_id)).get('result') == 1","typeGuard":null,"tryCatchPattern":"try:\n    yizhibo_download(url, ...)\nexcept ValueError as e:\n    if str(e).startswith('Error :'):\n        print('yizhibo rejected the scid (result=%s); show ended or invalid' % str(e).split(':')[-1].strip())\n    else:\n        raise","preventionTips":["Verify the URL's last path segment is a genuine scid before calling","Probe the h5api endpoint once and log the result code instead of parsing exceptions later","Live platforms disappear — pin capture jobs to run while shows are airing"],"tags":["yizhibo","live-stream","api-response","invalid-id"],"backgroundTag":null,"analyzedSha":"049548f3f3f35e67ba8d3181c71fdc71d11cf260","analyzedAt":"2026-08-15T03:58:15.069Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}