soimort/you-get · error · Exception

The live stream is not online!

Error message

The live stream is not online!

What it means

zhanqi_live fetches https://www.zhanqi.tv/api/static/v2.1/room/domain/<room_id>.json and treats room status code '4' as the only live state; any other status raises Exception('The live stream is not online!'). The status field encodes the room lifecycle, and non-4 values cover offline, ended, and other non-broadcasting states.

Source

Thrown at src/you_get/extractors/zhanqi.py:27

def zhanqi_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
    path = urlparse(url).path[1:]

    if not (path.startswith('videos') or path.startswith('v2/videos')): #url = "https://www.zhanqi.tv/huashan?param_s=1_0.2.0"
        path_list = path.split('/')
        room_id = path_list[1] if path_list[0] == 'topic' else path_list[0]
        zhanqi_live(room_id, merge=merge, output_dir=output_dir, info_only=info_only, **kwargs)
    else: #url = 'https://www.zhanqi.tv/videos/Lyingman/2017/01/182308.html'
        # https://www.zhanqi.tv/v2/videos/215593.html
        video_id = path.split('.')[0].split('/')[-1]
        zhanqi_video(video_id, merge=merge, output_dir=output_dir, info_only=info_only, **kwargs)

def zhanqi_live(room_id, merge=True, output_dir='.', info_only=False, **kwargs):
    api_url = "https://www.zhanqi.tv/api/static/v2.1/room/domain/{}.json".format(room_id)
    json_data = json.loads(get_content(api_url))['data']
    status = json_data['status']
    if status != '4':
        raise Exception("The live stream is not online!")

    nickname = json_data['nickname']
    title = nickname + ": " + json_data['title']
    video_levels = base64.b64decode(json_data['flashvars']['VideoLevels']).decode('utf8')
    m3u8_url = json.loads(video_levels)['streamUrl']

    print_info(site_info, title, 'm3u8', 0, m3u8_url=m3u8_url, m3u8_type='master')
    if not info_only:
        download_url_ffmpeg(m3u8_url, title, 'mp4', output_dir=output_dir, merge=merge)

def zhanqi_video(video_id, output_dir='.', info_only=False, merge=True, **kwargs):
    api_url = 'https://www.zhanqi.tv/api/static/v2.1/video/{}.json'.format(video_id)
    json_data = json.loads(get_content(api_url))['data']

    title = json_data['title']
    vid = json_data['flashvars']['VideoID']
    m3u8_url = 'http://dlvod.cdn.zhanqi.tv/' + vid
    urls = general_m3u8_extractor(m3u8_url)

View on GitHub (pinned to 049548f3f3)

Solutions

  1. Confirm the room is broadcasting on zhanqi.tv before invoking
  2. For finished broadcasts, use the VOD URL form (e.g. https://www.zhanqi.tv/videos/215593.html) which routes to zhanqi_video instead
  3. Inspect the domain API JSON to see the actual status value; if a new status means live, update the != '4' check
  4. Retry while the stream is up — capture live streams promptly since they cannot be fetched after the fact via this path

Example fix

# before
status = json_data['status']
if status != '4':
    raise Exception("The live stream is not online!")

# after (include the raw status for diagnosis)
status = json_data['status']
if status != '4':
    raise Exception("The live stream is not online! (room status=%s)" % status)
Defensive patterns

Strategy: validation

Validate before calling

import json

def zhanqi_room_live(room_id, fetch):
    d = json.loads(fetch('https://www.zhanqi.tv/api/static/v2.1/room/domain/%s.json' % room_id))['data']
    return d['status'] == '4'

Try / catch

try:
    zhanqi_download(url, ...)
except Exception as e:
    if 'not online' in str(e):
        print('room offline; use a /videos/ URL for VOD or retry while live')
    else:
        raise

Prevention

When it happens

Trigger: Downloading a zhanqi.tv room that is not currently broadcasting (status 0/1/2/3 etc. from the domain API), or a room_id that resolves to a closed/renamed room; the check sits at src/you_get/extractors/zhanqi.py:27 before nickname/stream parsing.

Common situations: Streamers offline at download time; bookmarked rooms that stopped existing; status enum drift (site adding a new live-ish status the extractor doesn't map to '4'); recordings mistakenly addressed with the live-room URL instead of the /videos/ path handled by zhanqi_video.

Related errors


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