soimort/you-get · error · ValueError

The live stream is not online!

Error message

The live stream is not online!

What it means

Raised by the Longzhu (star.longzhu.com / y.longzhu.com) extractor after fetching http://liveapi.plu.cn/liveapp/roomstatus?roomId=... — the returned JSON's 'streamUri' field is 4 characters or shorter (effectively empty). you-get treats an empty streamUri as proof that the room exists but is not currently broadcasting, so it aborts with ValueError instead of trying to download a nonexistent stream.

Source

Thrown at src/you_get/extractors/longzhu.py:30

    playlist_not_supported,
)
from ..common import player

def longzhu_download(url, output_dir = '.', merge=True, info_only=False, **kwargs):
    web_domain = url.split('/')[2]
    if (web_domain == 'star.longzhu.com') or (web_domain == 'y.longzhu.com'):
        domain = url.split('/')[3].split('?')[0]
        m_url = 'http://m.longzhu.com/{0}'.format(domain)
        m_html = get_content(m_url)
        room_id_patt = r'var\s*roomId\s*=\s*(\d+);'
        room_id = match1(m_html,room_id_patt)

        json_url = 'http://liveapi.plu.cn/liveapp/roomstatus?roomId={0}'.format(room_id)
        content = get_content(json_url)
        data = json.loads(content)
        streamUri = data['streamUri']
        if len(streamUri) <= 4:
            raise ValueError('The live stream is not online!')
        title = data['title']
        streamer = data['userName']
        title = str.format(streamer,': ',title)

        steam_api_url = 'http://livestream.plu.cn/live/getlivePlayurl?roomId={0}'.format(room_id)
        content = get_content(steam_api_url)
        data = json.loads(content)
        isonline = data.get('isTransfer')
        if isonline == '0':
            raise ValueError('The live stream is not online!')

        real_url = data['playLines'][0]['urls'][0]['securityUrl']

        print_info(site_info, title, 'flv', float('inf'))

        if not info_only:
            download_urls([real_url], title, 'flv', None, output_dir, merge=merge)

View on GitHub (pinned to 049548f3f3)

Solutions

  1. Open the room page in a browser and confirm the broadcaster is actually live right now
  2. Retry the download while the stream is actively broadcasting
  3. If the stream is live but the error persists, inspect the roomstatus JSON (curl 'http://liveapi.plu.cn/liveapp/roomstatus?roomId=<id>') to check whether the 'streamUri' key or its format changed
  4. For ended broadcasts, use a replay.longzhu.com URL (handled by the replay branch) instead of the live-room URL

Example fix

# before
you_get 'http://star.longzhu.com/12345'  # room offline -> ValueError

# after
# verify liveness first
import json, urllib.request
d = json.load(urllib.request.urlopen('http://liveapi.plu.cn/liveapp/roomstatus?roomId=%s' % room_id))
assert len(d['streamUri']) > 4, 'room offline, do not attempt download'
Defensive patterns

Strategy: validation

Validate before calling

import json
from urllib.request import urlopen

def longzhu_room_live(room_id):
    d = json.load(urlopen('http://liveapi.plu.cn/liveapp/roomstatus?roomId=%s' % room_id))
    return len(d.get('streamUri', '')) > 4

Try / catch

try:
    longzhu_download(url, ...)
except ValueError as e:
    if 'not online' in str(e):
        print('room offline, skip')
    else:
        raise

Prevention

When it happens

Trigger: Calling you_get with a URL whose host is star.longzhu.com or y.longzhu.com while the room's roomId resolves to an offline/ended broadcast; the roomstatus API responds 200 with streamUri="" (or similarly tiny), triggering the len(streamUri) <= 4 branch at src/you_get/extractors/longzhu.py:30.

Common situations: Streamers who went offline between page load and API call; bookmarked/VOD-shared links to rooms that no longer broadcast; API schema drift where streamUri is renamed, making len() read as 0 on an absent key (would instead KeyError) or empty default.

Related errors


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