A feature-rich command-line audio/video downloader
[rmcdecouverte] Generalize `_VALID_URL` Closes #291
pukkandand8ec40b39f29
diff --git a/yt_dlp/extractor/rmcdecouverte.py b/yt_dlp/extractor/rmcdecouverte.pyindex ecd16d130a..655a58f9e9 100644--- a/yt_dlp/extractor/rmcdecouverte.py+++ b/yt_dlp/extractor/rmcdecouverte.py@@ -13,7 +13,7 @@ from ..utils import smuggle_urlclass RMCDecouverteIE(InfoExtractor):- _VALID_URL = r'https?://rmcdecouverte\.bfmtv\.com/(?:[^/]+/(?P<id>[^?#/]+)|(?P<live_id>mediaplayer-direct))'+ _VALID_URL = r'https?://rmcdecouverte\.bfmtv\.com/(?:[^?#]*_(?P<id>\d+)|mediaplayer-direct)/?(?:[#?]|$)'_TESTS = [{'url': 'https://rmcdecouverte.bfmtv.com/vestiges-de-guerre_22240/les-bunkers-secrets-domaha-beach_25303/',@@ -45,6 +45,13 @@ class RMCDecouverteIE(InfoExtractor):'skip_download': True,},'skip': 'only available for a week',+ }, {+ 'url': 'https://rmcdecouverte.bfmtv.com/avions-furtifs-la-technologie-de-lextreme_10598',+ 'only_matching': True,+ },{+ # The website accepts any URL as long as it has _\d+ at the end+ 'url': 'https://rmcdecouverte.bfmtv.com/any/thing/can/go/here/_10598',+ 'only_matching': True,}, {# live, geo restricted, bypassable'url': 'https://rmcdecouverte.bfmtv.com/mediaplayer-direct/',@@ -54,7 +61,7 @@ class RMCDecouverteIE(InfoExtractor):def _real_extract(self, url):mobj = re.match(self._VALID_URL, url)- display_id = mobj.group('id') or mobj.group('live_id')+ display_id = mobj.group('id') or 'direct'webpage = self._download_webpage(url, display_id)brightcove_legacy_url = BrightcoveLegacyIE._extract_brightcove_url(webpage)if brightcove_legacy_url: