ytdl-org/youtube-dl · error · ExtractorError

Invalid URL: %s

Error message

Invalid URL: %s

What it means

Raised by the LeTvCloud extractor's _real_extract when the URL does not contain both uu= and vu= parameters, which are required to build the media_id and sign the API request. It is expected=True; the offending URL is echoed in the message.

Source

Thrown at youtube_dl/extractor/leeco.py:355

            url = b64decode(play_url['main_url'])
            decoded_url = b64decode(url_basename(url))
            formats.append({
                'url': url,
                'ext': determine_ext(decoded_url),
                'format_id': str_or_none(play_url.get('vtype')),
                'format_note': str_or_none(play_url.get('definition')),
                'width': int_or_none(play_url.get('vwidth')),
                'height': int_or_none(play_url.get('vheight')),
            })

        return formats

    def _real_extract(self, url):
        uu_mobj = re.search(r'uu=([\w]+)', url)
        vu_mobj = re.search(r'vu=([\w]+)', url)

        if not uu_mobj or not vu_mobj:
            raise ExtractorError('Invalid URL: %s' % url, expected=True)

        uu = uu_mobj.group(1)
        vu = vu_mobj.group(1)
        media_id = uu + '_' + vu

        formats = self._get_formats('flash', uu, vu, media_id) + self._get_formats('html5', uu, vu, media_id)
        self._sort_formats(formats)

        return {
            'id': media_id,
            'title': 'Video %s' % media_id,
            'formats': formats,
        }

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Re-copy the full embed URL including the complete ?uu=...&vu=... query string
  2. Ensure uu and vu values contain only word characters (letters, digits, underscore) — anything else fails the [\w]+ match
  3. URL-decode HTML-escaped ampersands (& -> &) before passing the URL
  4. Take the URL directly from the iframe src attribute on the embedding page

Example fix

# before
# http://player.pstream.net/e/...  (missing query)

# after
# http://player.pstream.net/e/...?uu=abc123&vu=def456
Defensive patterns

Strategy: validation

Validate before calling

import re
from urllib.parse import urlparse, parse_qs

def letv_cloud_url_valid(url):
    q = parse_qs(urlparse(url).query)
    uu, vu = q.get('uu', [''])[0], q.get('vu', [''])[0]
    return bool(re.fullmatch(r'\w+', uu)) and bool(re.fullmatch(r'\w+', vu))

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if 'Invalid URL:' in str(e):
        re_fetch_embed_src(parent_page)  # URL lost its query string; recopy it
    else:
        raise

Prevention

When it happens

Trigger: Passing a Letv Cloud URL that matched _VALID_URL but lacks the uu or vu query parameter — e.g. a bare player URL, a URL where parameters were stripped during copy/paste or HTML-unescape, or a mutated embed URL.

Common situations: Copying embed URLs without their query string; CMS transforms stripping unknown query params; URL-decoding mangling uu/vu (both must be [\w]+ — any punctuation breaks the regex); hand-building Letv Cloud URLs from partial examples.

Related errors


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