ytdl-org/youtube-dl · warning · ExtractorError

Invalid URL

Error message

Invalid URL

What it means

Raised by FranceTVIE's _real_extract when neither the _VALID_URL 'id' group nor an 'idDiffusion' query parameter yields a video id. The URL matched the loose fallback pattern but carries no usable identifier, so extraction cannot proceed. Marked expected=True — it is a URL problem, not a site problem.

Source

Thrown at youtube_dl/extractor/francetv.py:232

            'thumbnail': urljoin('https://sivideo.webservices.francetelevisions.fr', info.get('image')),
            'duration': int_or_none(info.get('real_duration')) or parse_duration(info.get('duree')),
            'timestamp': int_or_none(try_get(info, lambda x: x['diffusion']['timestamp'])),
            'is_live': is_live,
            'formats': formats,
            'subtitles': subtitles,
        }

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

        if not video_id:
            qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
            video_id = qs.get('idDiffusion', [None])[0]
            catalog = qs.get('catalogue', [None])[0]
            if not video_id:
                raise ExtractorError('Invalid URL', expected=True)

        return self._extract_video(video_id, catalog)


class FranceTVSiteIE(FranceTVBaseInfoExtractor):
    _VALID_URL = r'https?://(?:(?:www\.)?france\.tv|mobile\.france\.tv)/(?:[^/]+/)*(?P<id>[^/]+)\.html'

    _TESTS = [{
        'url': 'https://www.france.tv/france-2/13h15-le-dimanche/140921-les-mysteres-de-jesus.html',
        'info_dict': {
            'id': 'ec217ecc-0733-48cf-ac06-af1347b849d1',
            'ext': 'mp4',
            'title': '13h15, le dimanche... - Les mystères de Jésus',
            'description': 'md5:75efe8d4c0a8205e5904498ffe1e1a42',
            'timestamp': 1502623500,
            'upload_date': '20170813',
        },
        'params': {

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Use the full canonical URL copied from the browser address bar on the video page
  2. For pluton.francetv.fr URLs, ensure the idDiffusion query parameter is present, e.g. ...?idDiffusion=<uuid>
  3. Log the exact URL being passed downstream to find code that strips the query string
  4. Pre-validate URLs against the extractor's _VALID_URL with the id group before calling

Example fix

# before
youtube_dl 'https://www.france.tv/'
# ERROR: Invalid URL

# after
youtube_dl 'https://www.france.tv/france-2/some-show/123456-title.html'
Defensive patterns

Strategy: validation

Validate before calling

# Validate the URL carries a video id before extraction
import re
from youtube_dl.extractor.francetv import FranceTVIE
m = re.match(FranceTVIE._VALID_URL, url)
qs_id = re.search(r'[?&]idDiffusion=([^&]+)', url)
if not (m and m.group('id')) and not qs_id:
    raise ValueError('URL has no FranceTV video id')

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if str(e) == 'Invalid URL':
        reject_url_early(url)  # fix the source of the URL, do not retry

Prevention

When it happens

Trigger: The regex match returns no named 'id' group, and compat_urlparse.parse_qs finds no 'idDiffusion' in the query string. Happens with francetv URLs like bare https://www.france.tv/ or pluton-style links where the id parameter is named differently or empty.

Common situations: Users constructing FranceTV URLs by hand and omitting the id; upstream code passing a normalized/stripped URL that lost its query string; test harnesses feeding only_matching URLs.

Related errors


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