soimort/you-get · error · ValueError

Error : {}

Error message

Error : {}

What it means

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.

Source

Thrown at src/you_get/extractors/yizhibo.py:14

#!/usr/bin/env python

__all__ = ['yizhibo_download']

from ..common import *
import json

def yizhibo_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
    video_id = url[url.rfind('/')+1:].split(".")[0]
    json_request_url = 'http://www.yizhibo.com/live/h5api/get_basic_live_info?scid={}'.format(video_id)
    content = get_content(json_request_url)
    error = json.loads(content)['result']
    if (error != 1):
        raise ValueError("Error : {}".format(error))

    data = json.loads(content)
    title = data.get('data')['live_title']
    if (title == ''):
        title = data.get('data')['nickname']
    m3u8_url = data.get('data')['play_url']
    m3u8 = get_content(m3u8_url)
    base_url = "/".join(data.get('data')['play_url'].split("/")[:7])+"/"
    part_url = re.findall(r'([0-9]+\.ts)', m3u8)
    real_url = []
    for i in part_url:
        url = base_url + i
        real_url.append(url)
    print_info(site_info, title, 'ts', float('inf'))
    if not info_only:
        if player:
            launch_player(player, [m3u8_url])
        download_urls(real_url, title, 'ts', float('inf'), output_dir, merge = merge)

View on GitHub (pinned to 049548f3f3)

Solutions

  1. Confirm the URL points at an actual live/show page and the scid extracted from the last path segment is valid
  2. Print the raw get_basic_live_info response for that scid to see the machine-readable reason behind the non-1 result
  3. If the platform is defunct or the API is gone, no client-side fix exists — capture streams live while they run
  4. Patch the raise to include the JSON message body for easier diagnosis

Example fix

# before
error = json.loads(content)['result']
if (error != 1):
    raise ValueError("Error : {}".format(error))

# after (surface the API's own message)
data = json.loads(content)
if data.get('result') != 1:
    raise ValueError('yizhibo error {}: {}'.format(data.get('result'), data.get('msg', 'unknown')))
Defensive patterns

Strategy: try-catch

Validate before calling

import json

def yizhibo_show_ok(video_id, fetch):
    return json.loads(fetch('http://www.yizhibo.com/live/h5api/get_basic_live_info?scid=%s' % video_id)).get('result') == 1

Try / catch

try:
    yizhibo_download(url, ...)
except ValueError as e:
    if str(e).startswith('Error :'):
        print('yizhibo rejected the scid (result=%s); show ended or invalid' % str(e).split(':')[-1].strip())
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of soimort/you-get@049548f3f3 (2026-08-15). Data as JSON: /api/errors/83686208cc1f7b3e. Report an issue: GitHub.