ytdl-org/youtube-dl · error · ExtractorError

Failed to get video URL

Error message

Failed to get video URL

What it means

SohuIE's per-part URL resolution loop asks Sohu's CDN allot server for each clip's real URL and retries while part_info['url'] keeps failing the validity check. After more than 5 retries the loop raises 'Failed to get video URL' - notably WITHOUT expected=True, so youtube-dl treats it as an unexpected extraction failure. It means the CDN's URL-dispensing endpoint never returned a usable URL for a clip.

Source

Thrown at youtube_dl/extractor/sohu.py:171

                    if cdnId is not None:
                        params['idc'] = cdnId

                    download_note = 'Downloading %s video URL part %d of %d' % (
                        format_id, i + 1, part_count)

                    if retries > 0:
                        download_note += ' (retry #%d)' % retries
                    part_info = self._parse_json(self._download_webpage(
                        'http://%s/?%s' % (allot, compat_urllib_parse_urlencode(params)),
                        video_id, download_note), video_id)

                    video_url = part_info['url']
                    cdnId = part_info.get('nid')

                    retries += 1
                    if retries > 5:
                        raise ExtractorError('Failed to get video URL')

                formats.append({
                    'url': video_url,
                    'format_id': format_id,
                    'filesize': int_or_none(
                        try_get(data, lambda x: x['clipsBytes'][i])),
                    'width': int_or_none(data.get('width')),
                    'height': int_or_none(data.get('height')),
                    'fps': int_or_none(data.get('fps')),
                })
            self._sort_formats(formats)

            playlist.append({
                'id': '%s_part%d' % (video_id, i + 1),
                'title': title,
                'duration': vid_data['data']['clipsDuration'][i],
                'formats': formats,
            })

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Retry later - transient allot-server flakiness is the most common cause.
  2. Select a different quality format (-f nor/high/super/ori) since only some formats' clips may be broken.
  3. Route through a mainland-China VPN if outside CN.
  4. If persistent for a specific video, the asset's clips are corrupt server-side; report it or use another source.

Example fix

// before
if retries > 5:
    raise ExtractorError('Failed to get video URL')

// after (skip the broken part instead of failing the whole video)
if retries > 5:
    self.report_warning('Part %d of %s failed; skipping' % (i, format_id))
    continue
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(3):
    try:
        extract(url)
        break
    except ExtractorError as e:
        if 'Failed to get video URL' == str(e) and attempt < 2:
            sleep(backoff(attempt)); continue
        raise

Prevention

When it happens

Trigger: Downloading a multi-part Sohu video where the request to http://<allot>/?<params> repeatedly returns JSON whose 'url' is empty or fails the re-check (e.g. 'clip is illegal' or invalid host). Each bad answer increments retries; exceeding 5 aborts the whole extraction.

Common situations: CDN nodes under load or returning junk for certain formats (try a different -f); geo-restricted clips whose allot answers are valid in CN only; rate limiting from hammering the allot endpoint; occasional transient CDN inconsistency for 4K (h2654k) streams.

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/ef040baed840acd2. Report an issue: GitHub.