ytdl-org/youtube-dl · error · ExtractorError

Invalid URL

Error message

Invalid URL

What it means

Raised by the PandoraTV extractor when the URL matches _VALID_URL's broad pattern but the user_id or video id groups are empty, AND the fallback query-string parse of 'prgid'/'ch_userid' also yields at least one empty value. It signals the URL is structurally recognizable but missing the identifiers needed to call Pandora's viewJsonApi endpoint.

Source

Thrown at youtube_dl/extractor/pandoratv.py:83

    }, {
        'url': 'http://www.pandora.tv/view/mikakim/53294230#36797454_new',
        'only_matching': True,
    }, {
        'url': 'http://m.pandora.tv/?c=view&ch_userid=mikakim&prgid=54600346',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        mobj = re.match(self._VALID_URL, url)
        user_id = mobj.group('user_id')
        video_id = mobj.group('id')

        if not user_id or not video_id:
            qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
            video_id = qs.get('prgid', [None])[0]
            user_id = qs.get('ch_userid', [None])[0]
            if any(not f for f in (video_id, user_id,)):
                raise ExtractorError('Invalid URL', expected=True)

        data = self._download_json(
            'http://m.pandora.tv/?c=view&m=viewJsonApi&ch_userid=%s&prgid=%s'
            % (user_id, video_id), video_id)

        info = data['data']['rows']['vod_play_info']['result']

        formats = []
        for format_id, format_url in info.items():
            if not format_url:
                continue
            height = self._search_regex(
                r'^v(\d+)[Uu]rl$', format_id, 'height', default=None)
            if not height:
                continue

            play_url = self._download_json(
                'http://m.pandora.tv/?c=api&m=play_url', video_id,

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Open the video in a browser, copy the full canonical video URL containing both ch_userid and prgid
  2. Ensure the URL includes the query string '?prgid=...&ch_userid=...' if using the mobile/pandora.tv root form
  3. Update youtube-dl/yt-dlp — a newer regex may cover the URL shape you have

Example fix

# before
youtube_dl 'https://www.pandora.tv/view/xkxkxk228/#!'  # channel/ambiguous URL
# after
youtube_dl 'https://www.pandora.tv/view/someuser/#!/someuser@26970362'  # full video URL with both ids
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlparse, parse_qs

def is_valid_pandoratv_url(url: str) -> bool:
    q = parse_qs(urlparse(url).query)
    return bool(q.get('prgid', [''])[0] and q.get('ch_userid', [''])[0])

if not is_valid_pandoratv_url(url):
    raise ValueError('Need a PandoraTV video URL with prgid and ch_userid')

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if 'Invalid URL' in str(e):
        # fetch the canonical URL from the page or search result
        ...

Prevention

When it happens

Trigger: A URL like 'https://www.pandora.tv/view/...?prgid=...' where prgid or ch_userid is absent/blank, or a channel URL with no video id. The extractor first tries regex groups, then query params, then gives up with expected=True.

Common situations: Copy-pasting a PandoraTV channel page or playlist page URL instead of a single video URL; URLs truncated when shared through messaging apps; PandoraTV changing their URL scheme so the regex groups no longer capture.

Related errors


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