diff --git a/devscripts/make_lazy_extractors.py b/devscripts/make_lazy_extractors.py index 6550244f20..727d28204a 100644 --- a/devscripts/make_lazy_extractors.py +++ b/devscripts/make_lazy_extractors.py @@ -31,8 +31,10 @@ module_template = f.read() module_contents = [ - module_template + '\n' + getsource(InfoExtractor.suitable) + '\n', - 'class LazyLoadSearchExtractor(LazyLoadExtractor):\n pass\n'] + module_template, + getsource(InfoExtractor._match_valid_url), + getsource(InfoExtractor.suitable), + '\nclass LazyLoadSearchExtractor(LazyLoadExtractor):\n pass\n'] ie_template = ''' class {name}({bases}): diff --git a/yt_dlp/extractor/abcnews.py b/yt_dlp/extractor/abcnews.py index 908c833770..296b8cec1d 100644 --- a/yt_dlp/extractor/abcnews.py +++ b/yt_dlp/extractor/abcnews.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .amp import AMPIE from .common import InfoExtractor @@ -59,7 +58,7 @@ class AbcNewsVideoIE(AMPIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('display_id') video_id = mobj.group('id') info_dict = self._extract_feed_info( diff --git a/yt_dlp/extractor/abcotvs.py b/yt_dlp/extractor/abcotvs.py index 0bc69a64f6..5bff466340 100644 --- a/yt_dlp/extractor/abcotvs.py +++ b/yt_dlp/extractor/abcotvs.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -55,7 +54,7 @@ class ABCOTVSIE(InfoExtractor): } def _real_extract(self, url): - site, display_id, video_id = re.match(self._VALID_URL, url).groups() + site, display_id, video_id = self._match_valid_url(url).groups() display_id = display_id or video_id station = self._SITE_MAP[site] diff --git a/yt_dlp/extractor/acast.py b/yt_dlp/extractor/acast.py index b9355a2c81..63587c5cff 100644 --- a/yt_dlp/extractor/acast.py +++ b/yt_dlp/extractor/acast.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -80,7 +79,7 @@ class ACastIE(ACastBaseIE): }] def _real_extract(self, url): - channel, display_id = re.match(self._VALID_URL, url).groups() + channel, display_id = self._match_valid_url(url).groups() episode = self._call_api( '%s/episodes/%s' % (channel, display_id), display_id, {'showInfo': 'true'}) diff --git a/yt_dlp/extractor/adobetv.py b/yt_dlp/extractor/adobetv.py index bccdf9ca42..12b8192060 100644 --- a/yt_dlp/extractor/adobetv.py +++ b/yt_dlp/extractor/adobetv.py @@ -132,7 +132,7 @@ class AdobeTVIE(AdobeTVBaseIE): } def _real_extract(self, url): - language, show_urlname, urlname = re.match(self._VALID_URL, url).groups() + language, show_urlname, urlname = self._match_valid_url(url).groups() if not language: language = 'en' @@ -178,7 +178,7 @@ class AdobeTVShowIE(AdobeTVPlaylistBaseIE): _process_data = AdobeTVBaseIE._parse_video_data def _real_extract(self, url): - language, show_urlname = re.match(self._VALID_URL, url).groups() + language, show_urlname = self._match_valid_url(url).groups() if not language: language = 'en' query = { @@ -215,7 +215,7 @@ def _process_data(self, show_data): show_data['url'], 'AdobeTVShow', str_or_none(show_data.get('id'))) def _real_extract(self, url): - language, channel_urlname, category_urlname = re.match(self._VALID_URL, url).groups() + language, channel_urlname, category_urlname = self._match_valid_url(url).groups() if not language: language = 'en' query = { diff --git a/yt_dlp/extractor/adultswim.py b/yt_dlp/extractor/adultswim.py index 8d1d9ac7da..c97cfc1611 100644 --- a/yt_dlp/extractor/adultswim.py +++ b/yt_dlp/extractor/adultswim.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .turner import TurnerBaseIE from ..utils import ( @@ -89,7 +88,7 @@ class AdultSwimIE(TurnerBaseIE): }] def _real_extract(self, url): - show_path, episode_path = re.match(self._VALID_URL, url).groups() + show_path, episode_path = self._match_valid_url(url).groups() display_id = episode_path or show_path query = '''query { getShowBySlug(slug:"%s") { diff --git a/yt_dlp/extractor/aenetworks.py b/yt_dlp/extractor/aenetworks.py index 2a1f08e39d..8025de5a32 100644 --- a/yt_dlp/extractor/aenetworks.py +++ b/yt_dlp/extractor/aenetworks.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .theplatform import ThePlatformIE from ..utils import ( @@ -170,7 +169,7 @@ class AENetworksIE(AENetworksBaseIE): }] def _real_extract(self, url): - domain, canonical = re.match(self._VALID_URL, url).groups() + domain, canonical = self._match_valid_url(url).groups() return self._extract_aetn_info(domain, 'canonical', '/' + canonical, url) @@ -187,7 +186,7 @@ def _call_api(self, resource, slug, brand, fields): }))['data'][resource] def _real_extract(self, url): - domain, slug = re.match(self._VALID_URL, url).groups() + domain, slug = self._match_valid_url(url).groups() _, brand = self._DOMAIN_MAP[domain] playlist = self._call_api(self._RESOURCE, slug, brand, self._FIELDS) base_url = 'http://watch.%s' % domain @@ -309,7 +308,7 @@ class HistoryPlayerIE(AENetworksBaseIE): _TESTS = [] def _real_extract(self, url): - domain, video_id = re.match(self._VALID_URL, url).groups() + domain, video_id = self._match_valid_url(url).groups() return self._extract_aetn_info(domain, 'id', video_id, url) diff --git a/yt_dlp/extractor/aljazeera.py b/yt_dlp/extractor/aljazeera.py index c4f915a3c1..93f95dd465 100644 --- a/yt_dlp/extractor/aljazeera.py +++ b/yt_dlp/extractor/aljazeera.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor @@ -32,7 +31,7 @@ class AlJazeeraIE(InfoExtractor): BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s' def _real_extract(self, url): - post_type, name = re.match(self._VALID_URL, url).groups() + post_type, name = self._match_valid_url(url).groups() post_type = { 'features': 'post', 'program': 'episode', diff --git a/yt_dlp/extractor/alura.py b/yt_dlp/extractor/alura.py index 2681bfc18d..f5325de2f2 100644 --- a/yt_dlp/extractor/alura.py +++ b/yt_dlp/extractor/alura.py @@ -42,8 +42,7 @@ class AluraIE(InfoExtractor): def _real_extract(self, url): - video_id = self._match_id(url) - course = self._search_regex(self._VALID_URL, url, 'post url', group='course_name') + course, video_id = self._match_valid_url(url) video_url = self._VIDEO_URL % (course, video_id) video_dict = self._download_json(video_url, video_id, 'Searching for videos') diff --git a/yt_dlp/extractor/amcnetworks.py b/yt_dlp/extractor/amcnetworks.py index 1f16d3a33b..e38e215d3f 100644 --- a/yt_dlp/extractor/amcnetworks.py +++ b/yt_dlp/extractor/amcnetworks.py @@ -63,7 +63,7 @@ class AMCNetworksIE(ThePlatformIE): } def _real_extract(self, url): - site, display_id = re.match(self._VALID_URL, url).groups() + site, display_id = self._match_valid_url(url).groups() requestor_id = self._REQUESTOR_ID_MAP[site] page_data = self._download_json( 'https://content-delivery-gw.svc.ds.amcn.com/api/v2/content/amcn/%s/url/%s' diff --git a/yt_dlp/extractor/americastestkitchen.py b/yt_dlp/extractor/americastestkitchen.py index be960c0f93..6e6099a03d 100644 --- a/yt_dlp/extractor/americastestkitchen.py +++ b/yt_dlp/extractor/americastestkitchen.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import ( @@ -69,7 +68,7 @@ class AmericasTestKitchenIE(InfoExtractor): }] def _real_extract(self, url): - resource_type, video_id = re.match(self._VALID_URL, url).groups() + resource_type, video_id = self._match_valid_url(url).groups() is_episode = resource_type == 'episode' if is_episode: resource_type = 'episodes' @@ -114,7 +113,7 @@ class AmericasTestKitchenSeasonIE(InfoExtractor): }] def _real_extract(self, url): - show_name, season_number = re.match(self._VALID_URL, url).groups() + show_name, season_number = self._match_valid_url(url).groups() season_number = int(season_number) slug = 'atk' if show_name == 'americastestkitchen' else 'cco' diff --git a/yt_dlp/extractor/anvato.py b/yt_dlp/extractor/anvato.py index 7386ae2e6b..d688e2c5bc 100644 --- a/yt_dlp/extractor/anvato.py +++ b/yt_dlp/extractor/anvato.py @@ -390,7 +390,7 @@ def _real_extract(self, url): 'countries': smuggled_data.get('geo_countries'), }) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) access_key, video_id = mobj.group('access_key_or_mcp', 'id') if access_key not in self._ANVACK_TABLE: access_key = self._MCP_TO_ACCESS_KEY_TABLE.get( diff --git a/yt_dlp/extractor/apa.py b/yt_dlp/extractor/apa.py index cbc1c0ecb2..1736cdf566 100644 --- a/yt_dlp/extractor/apa.py +++ b/yt_dlp/extractor/apa.py @@ -42,7 +42,7 @@ def _extract_urls(webpage): webpage)] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id, base_url = mobj.group('id', 'base_url') webpage = self._download_webpage( diff --git a/yt_dlp/extractor/appletrailers.py b/yt_dlp/extractor/appletrailers.py index d3d77a1d0b..8140e332be 100644 --- a/yt_dlp/extractor/appletrailers.py +++ b/yt_dlp/extractor/appletrailers.py @@ -94,7 +94,7 @@ class AppleTrailersIE(InfoExtractor): _JSON_RE = r'iTunes.playURL\((.*?)\);' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) movie = mobj.group('movie') uploader_id = mobj.group('company') diff --git a/yt_dlp/extractor/arcpublishing.py b/yt_dlp/extractor/arcpublishing.py index fd2c795aee..5a9b8181a5 100644 --- a/yt_dlp/extractor/arcpublishing.py +++ b/yt_dlp/extractor/arcpublishing.py @@ -86,7 +86,7 @@ def _extract_urls(webpage): return entries def _real_extract(self, url): - org, uuid = re.match(self._VALID_URL, url).groups() + org, uuid = self._match_valid_url(url).groups() for orgs, tmpl in self._POWA_DEFAULTS: if org in orgs: base_api_tmpl = tmpl diff --git a/yt_dlp/extractor/ard.py b/yt_dlp/extractor/ard.py index 8d9339e4d1..048d30f27d 100644 --- a/yt_dlp/extractor/ard.py +++ b/yt_dlp/extractor/ard.py @@ -199,7 +199,7 @@ def suitable(cls, url): def _real_extract(self, url): # determine video id from url - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) document_id = None @@ -325,7 +325,7 @@ class ARDIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('id') player_url = mobj.group('mainurl') + '~playerXml.xml' @@ -525,7 +525,7 @@ def _ARD_extract_playlist(self, url, playlist_id, display_id, client, mode): return self.playlist_result(entries, playlist_title=display_id) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('video_id') display_id = mobj.group('display_id') if display_id: diff --git a/yt_dlp/extractor/arkena.py b/yt_dlp/extractor/arkena.py index fd46b1c771..7b18861410 100644 --- a/yt_dlp/extractor/arkena.py +++ b/yt_dlp/extractor/arkena.py @@ -63,7 +63,7 @@ def _extract_url(webpage): return mobj.group('url') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') account_id = mobj.group('account_id') diff --git a/yt_dlp/extractor/arte.py b/yt_dlp/extractor/arte.py index 5b38b20ddc..c163db9c94 100644 --- a/yt_dlp/extractor/arte.py +++ b/yt_dlp/extractor/arte.py @@ -49,7 +49,7 @@ class ArteTVIE(ArteTVBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') lang = mobj.group('lang') or mobj.group('lang_2') @@ -227,7 +227,7 @@ class ArteTVPlaylistIE(ArteTVBaseIE): }] def _real_extract(self, url): - lang, playlist_id = re.match(self._VALID_URL, url).groups() + lang, playlist_id = self._match_valid_url(url).groups() collection = self._download_json( '%s/collectionData/%s/%s?source=videos' % (self._API_BASE, lang, playlist_id), playlist_id) diff --git a/yt_dlp/extractor/asiancrush.py b/yt_dlp/extractor/asiancrush.py index 66ce7c6869..75a6329589 100644 --- a/yt_dlp/extractor/asiancrush.py +++ b/yt_dlp/extractor/asiancrush.py @@ -111,7 +111,7 @@ class AsianCrushIE(AsianCrushBaseIE): }] def _real_extract(self, url): - host, video_id = re.match(self._VALID_URL, url).groups() + host, video_id = self._match_valid_url(url).groups() if host == 'cocoro.tv': webpage = self._download_webpage(url, video_id) @@ -161,7 +161,7 @@ def _fetch_page(self, domain, parent_id, page): yield self._parse_video_data(video) def _real_extract(self, url): - host, playlist_id = re.match(self._VALID_URL, url).groups() + host, playlist_id = self._match_valid_url(url).groups() if host == 'cocoro.tv': webpage = self._download_webpage(url, playlist_id) diff --git a/yt_dlp/extractor/atresplayer.py b/yt_dlp/extractor/atresplayer.py index 4afde8f90e..8143eb4d75 100644 --- a/yt_dlp/extractor/atresplayer.py +++ b/yt_dlp/extractor/atresplayer.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_HTTPError @@ -75,7 +74,7 @@ def _login(self): self._request_webpage(target_url, None, 'Following Target URL') def _real_extract(self, url): - display_id, video_id = re.match(self._VALID_URL, url).groups() + display_id, video_id = self._match_valid_url(url).groups() try: episode = self._download_json( diff --git a/yt_dlp/extractor/audius.py b/yt_dlp/extractor/audius.py index b4b718790a..fa64995d50 100644 --- a/yt_dlp/extractor/audius.py +++ b/yt_dlp/extractor/audius.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import random -import re from .common import InfoExtractor from ..utils import ExtractorError, try_get, compat_str, str_or_none @@ -124,7 +123,7 @@ class AudiusIE(AudiusBaseIE): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) track_id = try_get(mobj, lambda x: x.group('track_id')) if track_id is None: title = mobj.group('title') @@ -217,7 +216,7 @@ def _build_playlist(self, tracks): def _real_extract(self, url): self._select_api_base() - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) title = mobj.group('title') # uploader = mobj.group('uploader') url = self._prepare_url(url, title) diff --git a/yt_dlp/extractor/awaan.py b/yt_dlp/extractor/awaan.py index 822136dfbc..22cc10d988 100644 --- a/yt_dlp/extractor/awaan.py +++ b/yt_dlp/extractor/awaan.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re import base64 from .common import InfoExtractor @@ -22,7 +21,7 @@ class AWAANIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:awaan|dcndigital)\.ae/(?:#/)?show/(?P\d+)/[^/]+(?:/(?P\d+)/(?P\d+))?' def _real_extract(self, url): - show_id, video_id, season_id = re.match(self._VALID_URL, url).groups() + show_id, video_id, season_id = self._match_valid_url(url).groups() if video_id and int(video_id) > 0: return self.url_result( 'http://awaan.ae/media/%s' % video_id, 'AWAANVideo') @@ -154,7 +153,7 @@ class AWAANSeasonIE(InfoExtractor): def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) - show_id, season_id = re.match(self._VALID_URL, url).groups() + show_id, season_id = self._match_valid_url(url).groups() data = {} if season_id: diff --git a/yt_dlp/extractor/azmedien.py b/yt_dlp/extractor/azmedien.py index 930266990b..fee640e14a 100644 --- a/yt_dlp/extractor/azmedien.py +++ b/yt_dlp/extractor/azmedien.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from .kaltura import KalturaIE @@ -51,7 +50,7 @@ class AZMedienIE(InfoExtractor): _PARTNER_ID = '1719221' def _real_extract(self, url): - host, display_id, article_id, entry_id = re.match(self._VALID_URL, url).groups() + host, display_id, article_id, entry_id = self._match_valid_url(url).groups() if not entry_id: entry_id = self._download_json( diff --git a/yt_dlp/extractor/baidu.py b/yt_dlp/extractor/baidu.py index 234a661d34..364fd94591 100644 --- a/yt_dlp/extractor/baidu.py +++ b/yt_dlp/extractor/baidu.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import unescapeHTML @@ -33,7 +32,7 @@ def _call_api(self, path, category, playlist_id, note): path, category, playlist_id), playlist_id, note) def _real_extract(self, url): - category, playlist_id = re.match(self._VALID_URL, url).groups() + category, playlist_id = self._match_valid_url(url).groups() if category == 'show': category = 'tvshow' if category == 'tv': diff --git a/yt_dlp/extractor/bandcamp.py b/yt_dlp/extractor/bandcamp.py index 07ceaa0fec..b664145a18 100644 --- a/yt_dlp/extractor/bandcamp.py +++ b/yt_dlp/extractor/bandcamp.py @@ -294,7 +294,7 @@ def suitable(cls, url): else super(BandcampAlbumIE, cls).suitable(url)) def _real_extract(self, url): - uploader_id, album_id = re.match(self._VALID_URL, url).groups() + uploader_id, album_id = self._match_valid_url(url).groups() playlist_id = album_id or uploader_id webpage = self._download_webpage(url, playlist_id) tralbum = self._extract_data_attr(webpage, playlist_id) diff --git a/yt_dlp/extractor/beatport.py b/yt_dlp/extractor/beatport.py index ae9c1a7399..e1cf8b4fe7 100644 --- a/yt_dlp/extractor/beatport.py +++ b/yt_dlp/extractor/beatport.py @@ -40,7 +40,7 @@ class BeatportIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) track_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/behindkink.py b/yt_dlp/extractor/behindkink.py index 9bca853b32..2c97f9817d 100644 --- a/yt_dlp/extractor/behindkink.py +++ b/yt_dlp/extractor/behindkink.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import url_basename @@ -24,7 +23,7 @@ class BehindKinkIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/bellmedia.py b/yt_dlp/extractor/bellmedia.py index 9f9de96c61..904c17ed00 100644 --- a/yt_dlp/extractor/bellmedia.py +++ b/yt_dlp/extractor/bellmedia.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -78,7 +77,7 @@ class BellMediaIE(InfoExtractor): } def _real_extract(self, url): - domain, video_id = re.match(self._VALID_URL, url).groups() + domain, video_id = self._match_valid_url(url).groups() domain = domain.split('.')[0] return { '_type': 'url_transparent', diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index 743fc501ec..8aab6a01b4 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -144,7 +144,7 @@ def _report_error(self, result): def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id_bv') or mobj.group('id') av_id, bv_id = self._get_video_id_set(video_id, mobj.group('id_bv') is not None) diff --git a/yt_dlp/extractor/blackboardcollaborate.py b/yt_dlp/extractor/blackboardcollaborate.py index 95d581c1c9..8ae2941984 100644 --- a/yt_dlp/extractor/blackboardcollaborate.py +++ b/yt_dlp/extractor/blackboardcollaborate.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import parse_iso8601 @@ -48,7 +47,7 @@ class BlackboardCollaborateIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) region = mobj.group('region') video_id = mobj.group('id') info = self._download_json( diff --git a/yt_dlp/extractor/bokecc.py b/yt_dlp/extractor/bokecc.py index 14840bd28c..6a89d36f49 100644 --- a/yt_dlp/extractor/bokecc.py +++ b/yt_dlp/extractor/bokecc.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_parse_qs @@ -45,7 +44,7 @@ class BokeCCIE(BokeCCBaseIE): }] def _real_extract(self, url): - qs = compat_parse_qs(re.match(self._VALID_URL, url).group('query')) + qs = compat_parse_qs(self._match_valid_url(url).group('query')) if not qs.get('vid') or not qs.get('uid'): raise ExtractorError('Invalid URL', expected=True) diff --git a/yt_dlp/extractor/bongacams.py b/yt_dlp/extractor/bongacams.py index 180542fbc8..9e7551136e 100644 --- a/yt_dlp/extractor/bongacams.py +++ b/yt_dlp/extractor/bongacams.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -22,7 +21,7 @@ class BongaCamsIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host = mobj.group('host') channel_id = mobj.group('id') diff --git a/yt_dlp/extractor/box.py b/yt_dlp/extractor/box.py index aae82d1aff..8214086a6f 100644 --- a/yt_dlp/extractor/box.py +++ b/yt_dlp/extractor/box.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import ( @@ -30,7 +29,7 @@ class BoxIE(InfoExtractor): } def _real_extract(self, url): - shared_name, file_id = re.match(self._VALID_URL, url).groups() + shared_name, file_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, file_id) request_token = self._parse_json(self._search_regex( r'Box\.config\s*=\s*({.+?});', webpage, diff --git a/yt_dlp/extractor/br.py b/yt_dlp/extractor/br.py index a3bc3a10ac..7169eceb6b 100644 --- a/yt_dlp/extractor/br.py +++ b/yt_dlp/extractor/br.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import ( @@ -86,7 +85,7 @@ class BRIE(InfoExtractor): ] def _real_extract(self, url): - base_url, display_id = re.search(self._VALID_URL, url).groups() + base_url, display_id = self._match_valid_url(url).groups() page = self._download_webpage(url, display_id) xml_url = self._search_regex( r"return BRavFramework\.register\(BRavFramework\('avPlayer_(?:[a-f0-9-]{36})'\)\.setup\({dataURL:'(/(?:[a-z0-9\-]+/)+[a-z0-9/~_.-]+)'}\)\);", page, 'XMLURL') diff --git a/yt_dlp/extractor/bravotv.py b/yt_dlp/extractor/bravotv.py index e4758baca8..139d51c09f 100644 --- a/yt_dlp/extractor/bravotv.py +++ b/yt_dlp/extractor/bravotv.py @@ -42,7 +42,7 @@ class BravoTVIE(AdobePassIE): }] def _real_extract(self, url): - site, display_id = re.match(self._VALID_URL, url).groups() + site, display_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) settings = self._parse_json(self._search_regex( r']+data-drupal-selector="drupal-settings-json"[^>]*>({.+?})', webpage, 'drupal settings'), diff --git a/yt_dlp/extractor/breakcom.py b/yt_dlp/extractor/breakcom.py index 68c7cf2bba..f38789f998 100644 --- a/yt_dlp/extractor/breakcom.py +++ b/yt_dlp/extractor/breakcom.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from .youtube import YoutubeIE @@ -41,7 +40,7 @@ class BreakIE(InfoExtractor): }] def _real_extract(self, url): - display_id, video_id = re.match(self._VALID_URL, url).groups() + display_id, video_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/brightcove.py b/yt_dlp/extractor/brightcove.py index 9f643a9e75..31606d3bda 100644 --- a/yt_dlp/extractor/brightcove.py +++ b/yt_dlp/extractor/brightcove.py @@ -290,7 +290,7 @@ def _real_extract(self, url): url = re.sub(r'(?<=[?&])(videoI(d|D)|idVideo|bctid)', '%40videoPlayer', url) # Change bckey (used by bcove.me urls) to playerKey url = re.sub(r'(?<=[?&])bckey', 'playerKey', url) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) query_str = mobj.group('query') query = compat_urlparse.parse_qs(query_str) @@ -595,7 +595,7 @@ def _real_extract(self, url): 'ip_blocks': smuggled_data.get('geo_ip_blocks'), }) - account_id, player_id, embed, content_type, video_id = re.match(self._VALID_URL, url).groups() + account_id, player_id, embed, content_type, video_id = self._match_valid_url(url).groups() policy_key_id = '%s_%s' % (account_id, player_id) policy_key = self._downloader.cache.load('brightcove', policy_key_id) diff --git a/yt_dlp/extractor/byutv.py b/yt_dlp/extractor/byutv.py index 7c6c826d7c..f4d5086ed7 100644 --- a/yt_dlp/extractor/byutv.py +++ b/yt_dlp/extractor/byutv.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -52,7 +51,7 @@ class BYUtvIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/c56.py b/yt_dlp/extractor/c56.py index cac8fdcba4..a853c530cc 100644 --- a/yt_dlp/extractor/c56.py +++ b/yt_dlp/extractor/c56.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import js_to_json @@ -31,7 +30,7 @@ class C56IE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE) + mobj = self._match_valid_url(url) text_id = mobj.group('textid') webpage = self._download_webpage(url, text_id) diff --git a/yt_dlp/extractor/canalplus.py b/yt_dlp/extractor/canalplus.py index 1132ce4a74..211ea267a2 100644 --- a/yt_dlp/extractor/canalplus.py +++ b/yt_dlp/extractor/canalplus.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -50,7 +49,7 @@ class CanalplusIE(InfoExtractor): }] def _real_extract(self, url): - site, display_id, video_id = re.match(self._VALID_URL, url).groups() + site, display_id, video_id = self._match_valid_url(url).groups() site_id = self._SITE_ID_MAP[site] diff --git a/yt_dlp/extractor/canvas.py b/yt_dlp/extractor/canvas.py index 4688187d9e..b417f8577a 100644 --- a/yt_dlp/extractor/canvas.py +++ b/yt_dlp/extractor/canvas.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from .gigya import GigyaBaseIE @@ -47,7 +46,7 @@ class CanvasIE(InfoExtractor): _REST_API_BASE = 'https://media-services-public.vrt.be/vualto-video-aggregator-web/rest/external/v1' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) site_id, video_id = mobj.group('site_id'), mobj.group('id') data = None @@ -192,7 +191,7 @@ class CanvasEenIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) site_id, display_id = mobj.group('site_id'), mobj.group('id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/cbsinteractive.py b/yt_dlp/extractor/cbsinteractive.py index 6596e98a69..9d4f754354 100644 --- a/yt_dlp/extractor/cbsinteractive.py +++ b/yt_dlp/extractor/cbsinteractive.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .cbs import CBSIE from ..utils import int_or_none @@ -71,7 +70,7 @@ class CBSInteractiveIE(CBSIE): } def _real_extract(self, url): - site, display_id = re.match(self._VALID_URL, url).groups() + site, display_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) data_json = self._html_search_regex( diff --git a/yt_dlp/extractor/cbssports.py b/yt_dlp/extractor/cbssports.py index a891c9a557..b8a6e59678 100644 --- a/yt_dlp/extractor/cbssports.py +++ b/yt_dlp/extractor/cbssports.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re # from .cbs import CBSBaseIE from .common import InfoExtractor @@ -30,7 +29,7 @@ class CBSSportsEmbedIE(InfoExtractor): # return self._extract_feed_info('dJ5BDC', 'VxxJg8Ymh8sE', filter_query, video_id) def _real_extract(self, url): - uuid, pcid = re.match(self._VALID_URL, url).groups() + uuid, pcid = self._match_valid_url(url).groups() query = {'id': uuid} if uuid else {'pcid': pcid} video = self._download_json( 'https://www.cbssports.com/api/content/video/', diff --git a/yt_dlp/extractor/ccma.py b/yt_dlp/extractor/ccma.py index e6ae493521..ea98f8688e 100644 --- a/yt_dlp/extractor/ccma.py +++ b/yt_dlp/extractor/ccma.py @@ -3,7 +3,6 @@ import calendar import datetime -import re from .common import InfoExtractor from ..utils import ( @@ -61,7 +60,7 @@ class CCMAIE(InfoExtractor): }] def _real_extract(self, url): - media_type, media_id = re.match(self._VALID_URL, url).groups() + media_type, media_id = self._match_valid_url(url).groups() media = self._download_json( 'http://dinamics.ccma.cat/pvideo/media.jsp', media_id, query={ diff --git a/yt_dlp/extractor/channel9.py b/yt_dlp/extractor/channel9.py index 258e96ca69..90024dbbad 100644 --- a/yt_dlp/extractor/channel9.py +++ b/yt_dlp/extractor/channel9.py @@ -96,7 +96,7 @@ def _extract_list(self, video_id, rss_url=None): return self.playlist_result(entries, video_id, title_text) def _real_extract(self, url): - content_path, rss = re.match(self._VALID_URL, url).groups() + content_path, rss = self._match_valid_url(url).groups() if rss: return self._extract_list(content_path, url) diff --git a/yt_dlp/extractor/chilloutzone.py b/yt_dlp/extractor/chilloutzone.py index 5aac212991..fd5202b9e4 100644 --- a/yt_dlp/extractor/chilloutzone.py +++ b/yt_dlp/extractor/chilloutzone.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re import json from .common import InfoExtractor @@ -51,7 +50,7 @@ class ChilloutzoneIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/cinemax.py b/yt_dlp/extractor/cinemax.py index 7f89d33de9..2c3ff8d4f9 100644 --- a/yt_dlp/extractor/cinemax.py +++ b/yt_dlp/extractor/cinemax.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .hbo import HBOBaseIE @@ -23,7 +22,7 @@ class CinemaxIE(HBOBaseIE): }] def _real_extract(self, url): - path, video_id = re.match(self._VALID_URL, url).groups() + path, video_id = self._match_valid_url(url).groups() info = self._extract_info('https://www.cinemax.com/%s.xml' % path, video_id) info['id'] = video_id return info diff --git a/yt_dlp/extractor/cjsw.py b/yt_dlp/extractor/cjsw.py index 505bdbe164..1dea0d7c71 100644 --- a/yt_dlp/extractor/cjsw.py +++ b/yt_dlp/extractor/cjsw.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -30,7 +29,7 @@ class CJSWIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) program, episode_id = mobj.group('program', 'id') audio_id = '%s/%s' % (program, episode_id) diff --git a/yt_dlp/extractor/cnbc.py b/yt_dlp/extractor/cnbc.py index 7b9f4536a6..da3730cc82 100644 --- a/yt_dlp/extractor/cnbc.py +++ b/yt_dlp/extractor/cnbc.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import smuggle_url @@ -57,7 +56,7 @@ class CNBCVideoIE(InfoExtractor): } def _real_extract(self, url): - path, display_id = re.match(self._VALID_URL, url).groups() + path, display_id = self._match_valid_url(url).groups() video_id = self._download_json( 'https://webql-redesign.cnbcfm.com/graphql', display_id, query={ 'query': '''{ diff --git a/yt_dlp/extractor/cnn.py b/yt_dlp/extractor/cnn.py index 2d950fa05c..af11d95b43 100644 --- a/yt_dlp/extractor/cnn.py +++ b/yt_dlp/extractor/cnn.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from .turner import TurnerBaseIE @@ -88,7 +87,7 @@ def _extract_timestamp(self, video_data): return None def _real_extract(self, url): - sub_domain, path, page_title = re.match(self._VALID_URL, url).groups() + sub_domain, path, page_title = self._match_valid_url(url).groups() if sub_domain not in ('money', 'edition'): sub_domain = 'edition' config = self._CONFIG[sub_domain] diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 8c2566dc59..31356111bc 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -447,23 +447,22 @@ def __init__(self, downloader=None): self.set_downloader(downloader) @classmethod - def suitable(cls, url): - """Receives a URL and returns True if suitable for this IE.""" - + def _match_valid_url(cls, url): # This does not use has/getattr intentionally - we want to know whether # we have cached the regexp for *this* class, whereas getattr would also # match the superclass if '_VALID_URL_RE' not in cls.__dict__: cls._VALID_URL_RE = re.compile(cls._VALID_URL) - return cls._VALID_URL_RE.match(url) is not None + return cls._VALID_URL_RE.match(url) + + @classmethod + def suitable(cls, url): + """Receives a URL and returns True if suitable for this IE.""" + return cls._match_valid_url(url) is not None @classmethod def _match_id(cls, url): - if '_VALID_URL_RE' not in cls.__dict__: - cls._VALID_URL_RE = re.compile(cls._VALID_URL) - m = cls._VALID_URL_RE.match(url) - assert m - return compat_str(m.group('id')) + return cls._match_valid_url(url).group('id') @classmethod def working(cls): diff --git a/yt_dlp/extractor/commonprotocols.py b/yt_dlp/extractor/commonprotocols.py index 1fc7779b84..3708c6ad27 100644 --- a/yt_dlp/extractor/commonprotocols.py +++ b/yt_dlp/extractor/commonprotocols.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -72,4 +71,4 @@ class ViewSourceIE(InfoExtractor): } def _real_extract(self, url): - return self.url_result(re.match(self._VALID_URL, url).group('url')) + return self.url_result(self._match_valid_url(url).group('url')) diff --git a/yt_dlp/extractor/condenast.py b/yt_dlp/extractor/condenast.py index d5e77af321..54e7af8b09 100644 --- a/yt_dlp/extractor/condenast.py +++ b/yt_dlp/extractor/condenast.py @@ -222,7 +222,7 @@ def _extract_video(self, params): } def _real_extract(self, url): - video_id, player_id, target, url_type, display_id = re.match(self._VALID_URL, url).groups() + video_id, player_id, target, url_type, display_id = self._match_valid_url(url).groups() if video_id: return self._extract_video({ diff --git a/yt_dlp/extractor/corus.py b/yt_dlp/extractor/corus.py index de61f42e41..8f2706736e 100644 --- a/yt_dlp/extractor/corus.py +++ b/yt_dlp/extractor/corus.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .theplatform import ThePlatformFeedIE from ..utils import ( @@ -96,7 +95,7 @@ class CorusIE(ThePlatformFeedIE): } def _real_extract(self, url): - domain, video_id = re.match(self._VALID_URL, url).groups() + domain, video_id = self._match_valid_url(url).groups() site = domain.split('.')[0] path = self._SITE_MAP.get(site, site) if path != 'series': diff --git a/yt_dlp/extractor/crunchyroll.py b/yt_dlp/extractor/crunchyroll.py index 091e15e8d5..256c6943f2 100644 --- a/yt_dlp/extractor/crunchyroll.py +++ b/yt_dlp/extractor/crunchyroll.py @@ -413,7 +413,7 @@ def _get_subtitles(self, video_id, webpage): return subtitles def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') if mobj.group('prefix') == 'm': diff --git a/yt_dlp/extractor/cultureunplugged.py b/yt_dlp/extractor/cultureunplugged.py index bcdf27323e..9002e4cef5 100644 --- a/yt_dlp/extractor/cultureunplugged.py +++ b/yt_dlp/extractor/cultureunplugged.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re import time from .common import InfoExtractor @@ -32,7 +31,7 @@ class CultureUnpluggedIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/dailymotion.py b/yt_dlp/extractor/dailymotion.py index 633d39adc8..e04e10b865 100644 --- a/yt_dlp/extractor/dailymotion.py +++ b/yt_dlp/extractor/dailymotion.py @@ -204,7 +204,7 @@ def _extract_urls(webpage): return urls def _real_extract(self, url): - video_id, playlist_id = re.match(self._VALID_URL, url).groups() + video_id, playlist_id = self._match_valid_url(url).groups() if playlist_id: if not self.get_param('noplaylist'): diff --git a/yt_dlp/extractor/dbtv.py b/yt_dlp/extractor/dbtv.py index aaedf2e3d3..8e73176a67 100644 --- a/yt_dlp/extractor/dbtv.py +++ b/yt_dlp/extractor/dbtv.py @@ -38,7 +38,7 @@ def _extract_urls(webpage): webpage)] def _real_extract(self, url): - display_id, video_id = re.match(self._VALID_URL, url).groups() + display_id, video_id = self._match_valid_url(url).groups() info = { '_type': 'url_transparent', 'id': video_id, diff --git a/yt_dlp/extractor/deezer.py b/yt_dlp/extractor/deezer.py index 3f6e007fce..7ba02e552e 100644 --- a/yt_dlp/extractor/deezer.py +++ b/yt_dlp/extractor/deezer.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import ( @@ -16,7 +15,7 @@ def get_data(self, url): if not self.get_param('test'): self.report_warning('For now, this extractor only supports the 30 second previews. Patches welcome!') - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) data_id = mobj.group('id') webpage = self._download_webpage(url, data_id) diff --git a/yt_dlp/extractor/dfb.py b/yt_dlp/extractor/dfb.py index a4d0448c26..97f70fc7b0 100644 --- a/yt_dlp/extractor/dfb.py +++ b/yt_dlp/extractor/dfb.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import unified_strdate @@ -23,7 +22,7 @@ class DFBIE(InfoExtractor): } def _real_extract(self, url): - display_id, video_id = re.match(self._VALID_URL, url).groups() + display_id, video_id = self._match_valid_url(url).groups() player_info = self._download_xml( 'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id, diff --git a/yt_dlp/extractor/digiteka.py b/yt_dlp/extractor/digiteka.py index 3dfde0d8c7..d63204778c 100644 --- a/yt_dlp/extractor/digiteka.py +++ b/yt_dlp/extractor/digiteka.py @@ -70,7 +70,7 @@ def _extract_url(webpage): return mobj.group('url') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') video_type = mobj.group('embed_type') or mobj.group('site_type') if video_type == 'music': diff --git a/yt_dlp/extractor/discovery.py b/yt_dlp/extractor/discovery.py index e0139cc862..fd3ad75c78 100644 --- a/yt_dlp/extractor/discovery.py +++ b/yt_dlp/extractor/discovery.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import random -import re import string from .discoverygo import DiscoveryGoBaseIE @@ -62,7 +61,7 @@ class DiscoveryIE(DiscoveryGoBaseIE): _API_BASE_URL = 'https://api.discovery.com/v1/' def _real_extract(self, url): - site, show_slug, display_id = re.match(self._VALID_URL, url).groups() + site, show_slug, display_id = self._match_valid_url(url).groups() access_token = None cookies = self._get_cookies(url) diff --git a/yt_dlp/extractor/discoverynetworks.py b/yt_dlp/extractor/discoverynetworks.py index c512b95d05..f43c871602 100644 --- a/yt_dlp/extractor/discoverynetworks.py +++ b/yt_dlp/extractor/discoverynetworks.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .dplay import DPlayIE @@ -35,7 +34,7 @@ class DiscoveryNetworksDeIE(DPlayIE): }] def _real_extract(self, url): - domain, programme, alternate_id = re.match(self._VALID_URL, url).groups() + domain, programme, alternate_id = self._match_valid_url(url).groups() country = 'GB' if domain == 'dplay.co.uk' else 'DE' realm = 'questuk' if country == 'GB' else domain.replace('.', '') return self._get_disco_api_info( diff --git a/yt_dlp/extractor/discoveryplusindia.py b/yt_dlp/extractor/discoveryplusindia.py index 4f2f4f7319..51801402c3 100644 --- a/yt_dlp/extractor/discoveryplusindia.py +++ b/yt_dlp/extractor/discoveryplusindia.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from ..compat import compat_str from ..utils import try_get @@ -95,5 +94,5 @@ def _entries(self, show_name): page_num += 1 def _real_extract(self, url): - show_name = re.match(self._VALID_URL, url).group('show_name') + show_name = self._match_valid_url(url).group('show_name') return self.playlist_result(self._entries(show_name), playlist_id=show_name) diff --git a/yt_dlp/extractor/disney.py b/yt_dlp/extractor/disney.py index e1ae62ac65..f018cbe9dd 100644 --- a/yt_dlp/extractor/disney.py +++ b/yt_dlp/extractor/disney.py @@ -77,7 +77,7 @@ class DisneyIE(InfoExtractor): }] def _real_extract(self, url): - domain, video_id, display_id = re.match(self._VALID_URL, url).groups() + domain, video_id, display_id = self._match_valid_url(url).groups() if not video_id: webpage = self._download_webpage(url, display_id) grill = re.sub(r'"\s*\+\s*"', '', self._search_regex( diff --git a/yt_dlp/extractor/dlive.py b/yt_dlp/extractor/dlive.py index d95c67a5be..90462c0abb 100644 --- a/yt_dlp/extractor/dlive.py +++ b/yt_dlp/extractor/dlive.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import int_or_none @@ -26,7 +25,7 @@ class DLiveVODIE(InfoExtractor): }] def _real_extract(self, url): - uploader_id, vod_id = re.match(self._VALID_URL, url).groups() + uploader_id, vod_id = self._match_valid_url(url).groups() broadcast = self._download_json( 'https://graphigo.prd.dlive.tv/', vod_id, data=json.dumps({'query': '''query { diff --git a/yt_dlp/extractor/dplay.py b/yt_dlp/extractor/dplay.py index 38b08d2805..fcc4ce4dcc 100644 --- a/yt_dlp/extractor/dplay.py +++ b/yt_dlp/extractor/dplay.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import compat_HTTPError @@ -287,7 +286,7 @@ def _get_disco_api_info(self, url, display_id, disco_host, realm, country): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('id') domain = mobj.group('domain').lstrip('www.') country = mobj.group('country') or mobj.group('subdomain_country') or mobj.group('plus_country') diff --git a/yt_dlp/extractor/drbonanza.py b/yt_dlp/extractor/drbonanza.py index 164e97c36b..ea0f06d3da 100644 --- a/yt_dlp/extractor/drbonanza.py +++ b/yt_dlp/extractor/drbonanza.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -26,7 +25,7 @@ class DRBonanzaIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id, display_id = mobj.group('id', 'display_id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/dropbox.py b/yt_dlp/extractor/dropbox.py index 14b6c00b0b..6a7d050aa7 100644 --- a/yt_dlp/extractor/dropbox.py +++ b/yt_dlp/extractor/dropbox.py @@ -26,7 +26,7 @@ class DropboxIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') fn = compat_urllib_parse_unquote(url_basename(url)) title = os.path.splitext(fn)[0] diff --git a/yt_dlp/extractor/drtuber.py b/yt_dlp/extractor/drtuber.py index 2baea585bf..540b86a169 100644 --- a/yt_dlp/extractor/drtuber.py +++ b/yt_dlp/extractor/drtuber.py @@ -42,7 +42,7 @@ def _extract_urls(webpage): webpage) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/dtube.py b/yt_dlp/extractor/dtube.py index 114d2dbe34..ad247b7ddd 100644 --- a/yt_dlp/extractor/dtube.py +++ b/yt_dlp/extractor/dtube.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from socket import timeout from .common import InfoExtractor @@ -32,7 +31,7 @@ class DTubeIE(InfoExtractor): } def _real_extract(self, url): - uploader_id, video_id = re.match(self._VALID_URL, url).groups() + uploader_id, video_id = self._match_valid_url(url).groups() result = self._download_json('https://api.steemit.com/', video_id, data=json.dumps({ 'jsonrpc': '2.0', 'method': 'get_content', diff --git a/yt_dlp/extractor/duboku.py b/yt_dlp/extractor/duboku.py index fdc695bf45..a87597873e 100644 --- a/yt_dlp/extractor/duboku.py +++ b/yt_dlp/extractor/duboku.py @@ -186,7 +186,7 @@ class DubokuPlaylistIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) if mobj is None: raise ExtractorError('Invalid URL: %s' % url) series_id = mobj.group('id') diff --git a/yt_dlp/extractor/eagleplatform.py b/yt_dlp/extractor/eagleplatform.py index 36fef07b72..f86731a0c1 100644 --- a/yt_dlp/extractor/eagleplatform.py +++ b/yt_dlp/extractor/eagleplatform.py @@ -123,7 +123,7 @@ def _get_video_url(self, url_or_request, video_id, note='Downloading JSON metada def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host, video_id = mobj.group('custom_host') or mobj.group('host'), mobj.group('id') headers = {} diff --git a/yt_dlp/extractor/einthusan.py b/yt_dlp/extractor/einthusan.py index 4e0f8bc819..7af279a536 100644 --- a/yt_dlp/extractor/einthusan.py +++ b/yt_dlp/extractor/einthusan.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import ( @@ -48,7 +47,7 @@ def _decrypt(self, encrypted_data, video_id): )).decode('utf-8'), video_id) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host = mobj.group('host') video_id = mobj.group('id') diff --git a/yt_dlp/extractor/eporner.py b/yt_dlp/extractor/eporner.py index bfecd3a418..25a0d97990 100644 --- a/yt_dlp/extractor/eporner.py +++ b/yt_dlp/extractor/eporner.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -51,7 +50,7 @@ class EpornerIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/everyonesmixtape.py b/yt_dlp/extractor/everyonesmixtape.py index 84a9b750e5..80cb032be8 100644 --- a/yt_dlp/extractor/everyonesmixtape.py +++ b/yt_dlp/extractor/everyonesmixtape.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -36,7 +35,7 @@ class EveryonesMixtapeIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) playlist_id = mobj.group('id') pllist_url = 'http://everyonesmixtape.com/mixtape.php?a=getMixes&u=-1&linked=%s&explore=' % playlist_id diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index 435561147f..4d85e62fe1 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import hashlib -import re from .common import InfoExtractor from ..compat import ( @@ -138,7 +137,7 @@ class FC2EmbedIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) query = compat_parse_qs(mobj.group('query')) video_id = query['i'][-1] diff --git a/yt_dlp/extractor/filmweb.py b/yt_dlp/extractor/filmweb.py index 56000bc5ba..5e323b4f8f 100644 --- a/yt_dlp/extractor/filmweb.py +++ b/yt_dlp/extractor/filmweb.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -22,7 +21,7 @@ class FilmwebIE(InfoExtractor): } def _real_extract(self, url): - article_type, article_id = re.match(self._VALID_URL, url).groups() + article_type, article_id = self._match_valid_url(url).groups() if article_type == 'filmnytt': webpage = self._download_webpage(url, article_id) article_id = self._search_regex(r'data-videoid="(\d+)"', webpage, 'article id') diff --git a/yt_dlp/extractor/fivetv.py b/yt_dlp/extractor/fivetv.py index c4c0f1b3d1..be81fccb8f 100644 --- a/yt_dlp/extractor/fivetv.py +++ b/yt_dlp/extractor/fivetv.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import int_or_none @@ -66,7 +65,7 @@ class FiveTVIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') or mobj.group('path') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/fourtube.py b/yt_dlp/extractor/fourtube.py index be4e81342d..d4d955b6b5 100644 --- a/yt_dlp/extractor/fourtube.py +++ b/yt_dlp/extractor/fourtube.py @@ -41,7 +41,7 @@ def _extract_formats(self, url, video_id, media_id, sources): return formats def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) kind, video_id, display_id = mobj.group('kind', 'id', 'display_id') if kind == 'm' or not display_id: @@ -228,7 +228,7 @@ class PornTubeIE(FourTubeBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id, display_id = mobj.group('id', 'display_id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/foxnews.py b/yt_dlp/extractor/foxnews.py index 63613cb85d..18fa0a5efb 100644 --- a/yt_dlp/extractor/foxnews.py +++ b/yt_dlp/extractor/foxnews.py @@ -67,7 +67,7 @@ def _extract_urls(webpage): webpage)] def _real_extract(self, url): - host, video_id = re.match(self._VALID_URL, url).groups() + host, video_id = self._match_valid_url(url).groups() info = self._extract_feed_info( 'http://%s/v/feed/video/%s.js?template=fox' % (host, video_id)) diff --git a/yt_dlp/extractor/francetv.py b/yt_dlp/extractor/francetv.py index ee8a22f9df..202141497c 100644 --- a/yt_dlp/extractor/francetv.py +++ b/yt_dlp/extractor/francetv.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -222,7 +221,7 @@ def sign(manifest_url, manifest_id): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') catalog = mobj.group('catalog') @@ -546,7 +545,7 @@ class FranceTVJeunesseIE(FranceTVBaseInfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) playlist_id = mobj.group('id') playlist = self._download_json( diff --git a/yt_dlp/extractor/frontendmasters.py b/yt_dlp/extractor/frontendmasters.py index f1db33fb16..40b8cb0b4f 100644 --- a/yt_dlp/extractor/frontendmasters.py +++ b/yt_dlp/extractor/frontendmasters.py @@ -207,7 +207,7 @@ class FrontendMastersLessonIE(FrontendMastersPageBaseIE): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) course_name, lesson_name = mobj.group('course_name', 'lesson_name') course = self._download_course(course_name, url) diff --git a/yt_dlp/extractor/funimation.py b/yt_dlp/extractor/funimation.py index 4c61d126bd..4d95f1c7c4 100644 --- a/yt_dlp/extractor/funimation.py +++ b/yt_dlp/extractor/funimation.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import random -import re import string from .common import InfoExtractor @@ -49,7 +48,7 @@ class FunimationPageIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('id').replace('/', '_') if not mobj.group('lang'): url = '%s/en/%s' % (mobj.group('origin'), mobj.group('path')) @@ -304,7 +303,7 @@ class FunimationShowIE(FunimationIE): }] def _real_extract(self, url): - base_url, locale, display_id = re.match(self._VALID_URL, url).groups() + base_url, locale, display_id = self._match_valid_url(url).groups() show_info = self._download_json( 'https://title-api.prd.funimationsvc.com/v2/shows/%s?region=US&deviceType=web&locale=%s' diff --git a/yt_dlp/extractor/funk.py b/yt_dlp/extractor/funk.py index 81d1949fd2..e5e32608fd 100644 --- a/yt_dlp/extractor/funk.py +++ b/yt_dlp/extractor/funk.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from .nexx import NexxIE @@ -31,7 +30,7 @@ class FunkIE(InfoExtractor): }] def _real_extract(self, url): - display_id, nexx_id = re.match(self._VALID_URL, url).groups() + display_id, nexx_id = self._match_valid_url(url).groups() video = self._download_json( 'https://www.funk.net/api/v4.0/videos/' + nexx_id, nexx_id) return { diff --git a/yt_dlp/extractor/gaia.py b/yt_dlp/extractor/gaia.py index e9527758fa..7821fb783d 100644 --- a/yt_dlp/extractor/gaia.py +++ b/yt_dlp/extractor/gaia.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -76,7 +75,7 @@ def _real_initialize(self): self._jwt = auth.get('jwt') def _real_extract(self, url): - display_id, vtype = re.search(self._VALID_URL, url).groups() + display_id, vtype = self._match_valid_url(url).groups() node_id = self._download_json( 'https://brooklyn.gaia.com/pathinfo', display_id, query={ 'path': 'video/' + display_id, diff --git a/yt_dlp/extractor/gamestar.py b/yt_dlp/extractor/gamestar.py index f00dab2f35..e882fa6719 100644 --- a/yt_dlp/extractor/gamestar.py +++ b/yt_dlp/extractor/gamestar.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -34,7 +33,7 @@ class GameStarIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) site = mobj.group('site') video_id = mobj.group('id') diff --git a/yt_dlp/extractor/gaskrank.py b/yt_dlp/extractor/gaskrank.py index 1726a67049..03acd2a731 100644 --- a/yt_dlp/extractor/gaskrank.py +++ b/yt_dlp/extractor/gaskrank.py @@ -51,7 +51,7 @@ def _real_extract(self, url): webpage, default=None) or self._html_search_meta( 'title', webpage, fatal=True) - categories = [re.match(self._VALID_URL, url).group('categories')] + categories = [self._match_valid_url(url).group('categories')] mobj = re.search( r'Video von:\s*(?P[^|]*?)\s*\|\s*vom:\s*(?P[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9][0-9])', diff --git a/yt_dlp/extractor/gazeta.py b/yt_dlp/extractor/gazeta.py index 57c67a4510..367187080e 100644 --- a/yt_dlp/extractor/gazeta.py +++ b/yt_dlp/extractor/gazeta.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -34,7 +33,7 @@ class GazetaIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('id') embed_url = '%s?p=embed' % mobj.group('url') diff --git a/yt_dlp/extractor/gdcvault.py b/yt_dlp/extractor/gdcvault.py index acc6478b86..c3ad6b4cea 100644 --- a/yt_dlp/extractor/gdcvault.py +++ b/yt_dlp/extractor/gdcvault.py @@ -149,7 +149,7 @@ def _login(self, webpage_url, display_id): return start_page def _real_extract(self, url): - video_id, name = re.match(self._VALID_URL, url).groups() + video_id, name = self._match_valid_url(url).groups() display_id = name or video_id webpage_url = 'http://www.gdcvault.com/play/' + video_id diff --git a/yt_dlp/extractor/gedidigital.py b/yt_dlp/extractor/gedidigital.py index ef9e03e670..ec386c2187 100644 --- a/yt_dlp/extractor/gedidigital.py +++ b/yt_dlp/extractor/gedidigital.py @@ -143,7 +143,7 @@ def _clean_formats(formats): def _real_extract(self, url): video_id = self._match_id(url) - url = re.match(self._VALID_URL, url).group('url') + url = self._match_valid_url(url).group('url') webpage = self._download_webpage(url, video_id) title = self._html_search_meta( ['twitter:title', 'og:title'], webpage, fatal=True) diff --git a/yt_dlp/extractor/giantbomb.py b/yt_dlp/extractor/giantbomb.py index c6477958d2..1920923fc1 100644 --- a/yt_dlp/extractor/giantbomb.py +++ b/yt_dlp/extractor/giantbomb.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re import json from .common import InfoExtractor @@ -32,7 +31,7 @@ class GiantBombIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/go.py b/yt_dlp/extractor/go.py index 7dcdc864f9..2ccc6df21e 100644 --- a/yt_dlp/extractor/go.py +++ b/yt_dlp/extractor/go.py @@ -161,7 +161,7 @@ def _extract_videos(self, brand, video_id='-1', show_id='-1'): display_id)['video'] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) sub_domain = remove_start(remove_end(mobj.group('sub_domain') or '', '.go'), 'www.') video_id, display_id = mobj.group('id', 'display_id') site_info = self._SITE_INFO.get(sub_domain, {}) diff --git a/yt_dlp/extractor/godtube.py b/yt_dlp/extractor/godtube.py index 92efd16b3e..96e68b4d20 100644 --- a/yt_dlp/extractor/godtube.py +++ b/yt_dlp/extractor/godtube.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -29,7 +28,7 @@ class GodTubeIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') config = self._download_xml( diff --git a/yt_dlp/extractor/googlepodcasts.py b/yt_dlp/extractor/googlepodcasts.py index 31ad799078..25631e2134 100644 --- a/yt_dlp/extractor/googlepodcasts.py +++ b/yt_dlp/extractor/googlepodcasts.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import ( @@ -56,7 +55,7 @@ class GooglePodcastsIE(GooglePodcastsBaseIE): } def _real_extract(self, url): - b64_feed_url, b64_guid = re.match(self._VALID_URL, url).groups() + b64_feed_url, b64_guid = self._match_valid_url(url).groups() episode = self._batch_execute( 'oNjqVe', b64_guid, [b64_feed_url, b64_guid])[1] return self._extract_episode(episode) diff --git a/yt_dlp/extractor/hearthisat.py b/yt_dlp/extractor/hearthisat.py index 59043164db..a3d6a055fe 100644 --- a/yt_dlp/extractor/hearthisat.py +++ b/yt_dlp/extractor/hearthisat.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -48,7 +47,7 @@ class HearThisAtIE(InfoExtractor): }] def _real_extract(self, url): - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) display_id = '{artist:s} - {title:s}'.format(**m.groupdict()) api_url = url.replace('www.', '').replace('hearthis.at', 'api-v2.hearthis.at') data_json = self._download_json(api_url, display_id) diff --git a/yt_dlp/extractor/hidive.py b/yt_dlp/extractor/hidive.py index f26f802656..a5aa0853ce 100644 --- a/yt_dlp/extractor/hidive.py +++ b/yt_dlp/extractor/hidive.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -55,7 +54,7 @@ def _real_initialize(self): self._LOGIN_URL, None, 'Logging in', data=urlencode_postdata(data)) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) title, key = mobj.group('title', 'key') video_id = '%s/%s' % (title, key) diff --git a/yt_dlp/extractor/hotstar.py b/yt_dlp/extractor/hotstar.py index 60fe25eed9..e00e58646d 100644 --- a/yt_dlp/extractor/hotstar.py +++ b/yt_dlp/extractor/hotstar.py @@ -173,7 +173,7 @@ class HotStarIE(HotStarBaseIE): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') video_type = mobj.group('type') cookies = self._get_cookies(url) diff --git a/yt_dlp/extractor/hrti.py b/yt_dlp/extractor/hrti.py index 23f7b1fc95..dc5b9670c5 100644 --- a/yt_dlp/extractor/hrti.py +++ b/yt_dlp/extractor/hrti.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import compat_HTTPError @@ -135,7 +134,7 @@ class HRTiIE(HRTiBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('short_id') or mobj.group('id') display_id = mobj.group('display_id') or video_id @@ -191,7 +190,7 @@ class HRTiPlaylistIE(HRTiBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) category_id = mobj.group('id') display_id = mobj.group('display_id') or category_id diff --git a/yt_dlp/extractor/hungama.py b/yt_dlp/extractor/hungama.py index c33e387e7a..821b16e5dc 100644 --- a/yt_dlp/extractor/hungama.py +++ b/yt_dlp/extractor/hungama.py @@ -139,9 +139,9 @@ class HungamaAlbumPlaylistIE(InfoExtractor): }] def _real_extract(self, url): - id = self._match_id(url) - webpage = self._download_webpage(url, id) + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) ptrn = r']+?property=[\"\']?music:song:url[\"\']?[^>]+?content=[\"\']?([^\"\']+)' items = re.findall(ptrn, webpage) entries = [self.url_result(item, ie=HungamaSongIE.ie_key()) for item in items] - return self.playlist_result(entries, id) + return self.playlist_result(entries, video_id) diff --git a/yt_dlp/extractor/imggaming.py b/yt_dlp/extractor/imggaming.py index 1e43ec95be..ef20a4b9e8 100644 --- a/yt_dlp/extractor/imggaming.py +++ b/yt_dlp/extractor/imggaming.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import compat_HTTPError @@ -62,7 +61,7 @@ def _extract_dve_api_url(self, media_id, media_type): raise def _real_extract(self, url): - domain, media_type, media_id, playlist_id = re.match(self._VALID_URL, url).groups() + domain, media_type, media_id, playlist_id = self._match_valid_url(url).groups() if playlist_id: if self.get_param('noplaylist'): diff --git a/yt_dlp/extractor/instagram.py b/yt_dlp/extractor/instagram.py index 27deb0af08..9aad804cf8 100644 --- a/yt_dlp/extractor/instagram.py +++ b/yt_dlp/extractor/instagram.py @@ -141,7 +141,7 @@ def _extract_embed_url(webpage): return mobj.group('link') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') url = mobj.group('url') diff --git a/yt_dlp/extractor/ivi.py b/yt_dlp/extractor/ivi.py index c167ee500d..5e1d89c9b3 100644 --- a/yt_dlp/extractor/ivi.py +++ b/yt_dlp/extractor/ivi.py @@ -245,7 +245,7 @@ def _extract_entries(self, html, compilation_id): r']+\bhref=["\']/watch/%s/(\d+)["\']' % compilation_id, html)] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) compilation_id = mobj.group('compilationid') season_id = mobj.group('seasonid') diff --git a/yt_dlp/extractor/ivideon.py b/yt_dlp/extractor/ivideon.py index 3ca824f798..01e7b22d4c 100644 --- a/yt_dlp/extractor/ivideon.py +++ b/yt_dlp/extractor/ivideon.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -38,7 +37,7 @@ class IvideonIE(InfoExtractor): _QUALITIES = ('low', 'mid', 'hi') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) server_id, camera_id = mobj.group('id'), mobj.group('camera_id') camera_name, description = None, None camera_url = compat_urlparse.urljoin( diff --git a/yt_dlp/extractor/jeuxvideo.py b/yt_dlp/extractor/jeuxvideo.py index e9f4ed7384..77c0f520ca 100644 --- a/yt_dlp/extractor/jeuxvideo.py +++ b/yt_dlp/extractor/jeuxvideo.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -25,7 +24,7 @@ class JeuxVideoIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) title = mobj.group(1) webpage = self._download_webpage(url, title) title = self._html_search_meta('name', webpage) or self._og_search_title(webpage) diff --git a/yt_dlp/extractor/jove.py b/yt_dlp/extractor/jove.py index 27e0e37f6e..4b7dfc5264 100644 --- a/yt_dlp/extractor/jove.py +++ b/yt_dlp/extractor/jove.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -41,7 +40,7 @@ class JoveIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/kaltura.py b/yt_dlp/extractor/kaltura.py index 4ab0567a54..c8f60ef455 100644 --- a/yt_dlp/extractor/kaltura.py +++ b/yt_dlp/extractor/kaltura.py @@ -229,7 +229,7 @@ def _get_video_info(self, video_id, partner_id, service_url=None): def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) partner_id, entry_id = mobj.group('partner_id', 'id') ks = None captions = None diff --git a/yt_dlp/extractor/kanalplay.py b/yt_dlp/extractor/kanalplay.py index 6c3498c672..5e24f7e216 100644 --- a/yt_dlp/extractor/kanalplay.py +++ b/yt_dlp/extractor/kanalplay.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -52,7 +51,7 @@ def _get_subtitles(self, channel_id, video_id): return {'sv': [{'ext': 'srt', 'data': self._fix_subtitles(subs)}]} if subs else {} def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') channel_id = mobj.group('channel_id') diff --git a/yt_dlp/extractor/keezmovies.py b/yt_dlp/extractor/keezmovies.py index cfdd0eb8e7..027f43cf01 100644 --- a/yt_dlp/extractor/keezmovies.py +++ b/yt_dlp/extractor/keezmovies.py @@ -35,7 +35,7 @@ class KeezMoviesIE(InfoExtractor): }] def _extract_info(self, url, fatal=True): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = (mobj.group('display_id') if 'display_id' in mobj.groupdict() diff --git a/yt_dlp/extractor/kinja.py b/yt_dlp/extractor/kinja.py index 79e3026d2f..1be8b48091 100644 --- a/yt_dlp/extractor/kinja.py +++ b/yt_dlp/extractor/kinja.py @@ -129,7 +129,7 @@ def _extract_urls(webpage, url): webpage)] def _real_extract(self, url): - video_type, video_id = re.match(self._VALID_URL, url).groups() + video_type, video_id = self._match_valid_url(url).groups() provider = self._PROVIDER_MAP.get(video_type) if provider: diff --git a/yt_dlp/extractor/kusi.py b/yt_dlp/extractor/kusi.py index 9833d35ebc..707fe18213 100644 --- a/yt_dlp/extractor/kusi.py +++ b/yt_dlp/extractor/kusi.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import random -import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote_plus @@ -35,7 +34,7 @@ class KUSIIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) clip_id = mobj.group('clipId') video_id = clip_id or mobj.group('path') diff --git a/yt_dlp/extractor/lecturio.py b/yt_dlp/extractor/lecturio.py index 1b2dcef466..9d2228700c 100644 --- a/yt_dlp/extractor/lecturio.py +++ b/yt_dlp/extractor/lecturio.py @@ -103,7 +103,7 @@ class LecturioIE(LecturioBaseIE): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) nt = mobj.group('nt') or mobj.group('nt_de') lecture_id = mobj.group('id') display_id = nt or lecture_id @@ -196,7 +196,7 @@ class LecturioCourseIE(LecturioBaseIE): }] def _real_extract(self, url): - nt, course_id = re.match(self._VALID_URL, url).groups() + nt, course_id = self._match_valid_url(url).groups() display_id = nt or course_id api_path = 'courses/' + course_id if course_id else 'course/content/' + nt + '.json' course = self._download_json( diff --git a/yt_dlp/extractor/lego.py b/yt_dlp/extractor/lego.py index 1e3c19dfd6..b9d8b167c4 100644 --- a/yt_dlp/extractor/lego.py +++ b/yt_dlp/extractor/lego.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re import uuid from .common import InfoExtractor @@ -64,7 +63,7 @@ class LEGOIE(InfoExtractor): } def _real_extract(self, url): - locale, video_id = re.match(self._VALID_URL, url).groups() + locale, video_id = self._match_valid_url(url).groups() countries = [locale.split('-')[1].upper()] self._initialize_geo_bypass({ 'countries': countries, diff --git a/yt_dlp/extractor/libsyn.py b/yt_dlp/extractor/libsyn.py index 2cf444258a..d1fcda4ef8 100644 --- a/yt_dlp/extractor/libsyn.py +++ b/yt_dlp/extractor/libsyn.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -42,7 +41,7 @@ class LibsynIE(InfoExtractor): }] def _real_extract(self, url): - url, video_id = re.match(self._VALID_URL, url).groups() + url, video_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, video_id) data = self._parse_json(self._search_regex( diff --git a/yt_dlp/extractor/line.py b/yt_dlp/extractor/line.py index 41ac8d422e..d4bcae6c1c 100644 --- a/yt_dlp/extractor/line.py +++ b/yt_dlp/extractor/line.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -31,7 +30,7 @@ class LineTVIE(InfoExtractor): }] def _real_extract(self, url): - series_id, segment = re.match(self._VALID_URL, url).groups() + series_id, segment = self._match_valid_url(url).groups() video_id = '%s_%s' % (series_id, segment) webpage = self._download_webpage(url, video_id) @@ -154,7 +153,7 @@ class LineLiveIE(LineLiveBaseIE): }] def _real_extract(self, url): - channel_id, broadcast_id = re.match(self._VALID_URL, url).groups() + channel_id, broadcast_id = self._match_valid_url(url).groups() broadcast = self._download_json( self._API_BASE_URL + '%s/broadcast/%s' % (channel_id, broadcast_id), broadcast_id) diff --git a/yt_dlp/extractor/linkedin.py b/yt_dlp/extractor/linkedin.py index e1dca4899e..6d54d638ac 100644 --- a/yt_dlp/extractor/linkedin.py +++ b/yt_dlp/extractor/linkedin.py @@ -87,7 +87,7 @@ class LinkedInLearningIE(LinkedInLearningBaseIE): } def _real_extract(self, url): - course_slug, video_slug = re.match(self._VALID_URL, url).groups() + course_slug, video_slug = self._match_valid_url(url).groups() video_data = None formats = [] diff --git a/yt_dlp/extractor/linuxacademy.py b/yt_dlp/extractor/linuxacademy.py index f222a6b2c6..2053970d11 100644 --- a/yt_dlp/extractor/linuxacademy.py +++ b/yt_dlp/extractor/linuxacademy.py @@ -2,7 +2,6 @@ import json import random -import re from .common import InfoExtractor from ..compat import ( @@ -162,7 +161,7 @@ def random_string(): % access_token, None, 'Downloading token validation page') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) chapter_id, lecture_id, course_id = mobj.group('chapter_id', 'lesson_id', 'course_id') item_id = course_id if course_id else '%s-%s' % (chapter_id, lecture_id) diff --git a/yt_dlp/extractor/livestream.py b/yt_dlp/extractor/livestream.py index 036b39023f..f591289ecd 100644 --- a/yt_dlp/extractor/livestream.py +++ b/yt_dlp/extractor/livestream.py @@ -212,7 +212,7 @@ def _extract_event(self, event_data): return self.playlist_result(entries, event_id, event_data['full_name']) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') event = mobj.group('event_id') or mobj.group('event_name') account = mobj.group('account_id') or mobj.group('account_name') @@ -319,7 +319,7 @@ def _extract_folder(self, url, folder_id): return self.playlist_result(entries, folder_id) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) user = mobj.group('user') url_type = mobj.group('type') content_id = mobj.group('id') @@ -359,7 +359,7 @@ class LivestreamShortenerIE(InfoExtractor): _VALID_URL = r'https?://livestre\.am/(?P.+)' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) id = mobj.group('id') webpage = self._download_webpage(url, id) diff --git a/yt_dlp/extractor/lnkgo.py b/yt_dlp/extractor/lnkgo.py index 3e71852aab..14675968e7 100644 --- a/yt_dlp/extractor/lnkgo.py +++ b/yt_dlp/extractor/lnkgo.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -58,7 +57,7 @@ class LnkGoIE(InfoExtractor): _M3U8_TEMPL = 'https://vod.lnk.lt/lnk_vod/lnk/lnk/%s:%s/playlist.m3u8%s' def _real_extract(self, url): - display_id, video_id = re.match(self._VALID_URL, url).groups() + display_id, video_id = self._match_valid_url(url).groups() video_info = self._download_json( 'https://lnk.lt/api/main/video-page/%s/%s/false' % (display_id, video_id or '0'), diff --git a/yt_dlp/extractor/localnews8.py b/yt_dlp/extractor/localnews8.py index aad396135d..c3e9d10fae 100644 --- a/yt_dlp/extractor/localnews8.py +++ b/yt_dlp/extractor/localnews8.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -25,7 +24,7 @@ class LocalNews8IE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/lovehomeporn.py b/yt_dlp/extractor/lovehomeporn.py index 8f65a3c03f..ca4b5f3755 100644 --- a/yt_dlp/extractor/lovehomeporn.py +++ b/yt_dlp/extractor/lovehomeporn.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .nuevo import NuevoBaseIE @@ -23,7 +22,7 @@ class LoveHomePornIE(NuevoBaseIE): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/lrt.py b/yt_dlp/extractor/lrt.py index 89d5498589..4024aef73a 100644 --- a/yt_dlp/extractor/lrt.py +++ b/yt_dlp/extractor/lrt.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -47,7 +46,7 @@ def _extract_js_var(self, webpage, var_name, default): webpage, var_name.replace('_', ' '), default, group=2) def _real_extract(self, url): - path, video_id = re.match(self._VALID_URL, url).groups() + path, video_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, video_id) media_url = self._extract_js_var(webpage, 'main_url', path) diff --git a/yt_dlp/extractor/lynda.py b/yt_dlp/extractor/lynda.py index 06662be1ac..58cf17239f 100644 --- a/yt_dlp/extractor/lynda.py +++ b/yt_dlp/extractor/lynda.py @@ -128,7 +128,7 @@ def _raise_unavailable(self, video_id): 'Video %s is only available for members' % video_id) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') course_id = mobj.group('course_id') @@ -281,7 +281,7 @@ class LyndaCourseIE(LyndaBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) course_path = mobj.group('coursepath') course_id = mobj.group('courseid') diff --git a/yt_dlp/extractor/mailru.py b/yt_dlp/extractor/mailru.py index 5bfe40649d..5d9f80bb31 100644 --- a/yt_dlp/extractor/mailru.py +++ b/yt_dlp/extractor/mailru.py @@ -106,7 +106,7 @@ class MailRuIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) meta_id = mobj.group('metaid') video_id = None diff --git a/yt_dlp/extractor/mediasite.py b/yt_dlp/extractor/mediasite.py index c62233ab7c..ace86c2fd6 100644 --- a/yt_dlp/extractor/mediasite.py +++ b/yt_dlp/extractor/mediasite.py @@ -170,7 +170,7 @@ def __extract_slides(self, *, stream_id, snum, Stream, duration, images): def _real_extract(self, url): url, data = unsmuggle_url(url, {}) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) resource_id = mobj.group('id') query = mobj.group('query') @@ -327,7 +327,7 @@ class MediasiteCatalogIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) mediasite_url = mobj.group('url') catalog_id = mobj.group('catalog_id') current_folder_id = mobj.group('current_folder_id') or catalog_id @@ -403,7 +403,7 @@ class MediasiteNamedCatalogIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) mediasite_url = mobj.group('url') catalog_name = mobj.group('catalog_name') diff --git a/yt_dlp/extractor/metacafe.py b/yt_dlp/extractor/metacafe.py index 6366028d23..7b2d4a0031 100644 --- a/yt_dlp/extractor/metacafe.py +++ b/yt_dlp/extractor/metacafe.py @@ -130,7 +130,7 @@ def report_disclaimer(self): def _real_extract(self, url): # Extract id and simplified title from URL - video_id, display_id = re.match(self._VALID_URL, url).groups() + video_id, display_id = self._match_valid_url(url).groups() # the video may come from an external site m_external = re.match(r'^(\w{2})-(.*)$', video_id) diff --git a/yt_dlp/extractor/metacritic.py b/yt_dlp/extractor/metacritic.py index 7d468d78ba..1424288e74 100644 --- a/yt_dlp/extractor/metacritic.py +++ b/yt_dlp/extractor/metacritic.py @@ -33,7 +33,7 @@ class MetacriticIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) # The xml is not well formatted, there are raw '&' diff --git a/yt_dlp/extractor/mgoon.py b/yt_dlp/extractor/mgoon.py index 7bb473900f..184c311bec 100644 --- a/yt_dlp/extractor/mgoon.py +++ b/yt_dlp/extractor/mgoon.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -41,7 +40,7 @@ class MgoonIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') data = self._download_json(self._API_URL.format(video_id), video_id) diff --git a/yt_dlp/extractor/microsoftvirtualacademy.py b/yt_dlp/extractor/microsoftvirtualacademy.py index 8e0aee0e69..46abd2a6d0 100644 --- a/yt_dlp/extractor/microsoftvirtualacademy.py +++ b/yt_dlp/extractor/microsoftvirtualacademy.py @@ -55,7 +55,7 @@ class MicrosoftVirtualAcademyIE(MicrosoftVirtualAcademyBaseIE): def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) course_id = mobj.group('course_id') video_id = mobj.group('id') @@ -152,7 +152,7 @@ def suitable(cls, url): MicrosoftVirtualAcademyCourseIE, cls).suitable(url) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) course_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/mildom.py b/yt_dlp/extractor/mildom.py index 939a072ecc..c147cbbf60 100644 --- a/yt_dlp/extractor/mildom.py +++ b/yt_dlp/extractor/mildom.py @@ -5,7 +5,6 @@ from datetime import datetime import itertools import json -import re from .common import InfoExtractor from ..utils import ( @@ -162,7 +161,7 @@ class MildomVodIE(MildomBaseIE): _VALID_URL = r'https?://(?:(?:www|m)\.)mildom\.com/playback/(?P\d+)/(?P(?P=user_id)-[a-zA-Z0-9]+)' def _real_extract(self, url): - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) user_id, video_id = m.group('user_id'), m.group('id') url = 'https://www.mildom.com/playback/%s/%s' % (user_id, video_id) diff --git a/yt_dlp/extractor/minoto.py b/yt_dlp/extractor/minoto.py index 6367311956..dba82db5ff 100644 --- a/yt_dlp/extractor/minoto.py +++ b/yt_dlp/extractor/minoto.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -14,7 +13,7 @@ class MinotoIE(InfoExtractor): _VALID_URL = r'(?:minoto:|https?://(?:play|iframe|embed)\.minoto-video\.com/(?P[0-9]+)/)(?P[a-zA-Z0-9]+)' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) player_id = mobj.group('player_id') or '1' video_id = mobj.group('id') video_data = self._download_json('http://play.minoto-video.com/%s/%s.js' % (player_id, video_id), video_id) diff --git a/yt_dlp/extractor/mit.py b/yt_dlp/extractor/mit.py index e1506a745a..60e4569785 100644 --- a/yt_dlp/extractor/mit.py +++ b/yt_dlp/extractor/mit.py @@ -98,7 +98,7 @@ class OCWMITIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) topic = mobj.group('topic') webpage = self._download_webpage(url, topic) diff --git a/yt_dlp/extractor/mixcloud.py b/yt_dlp/extractor/mixcloud.py index b8ccd0ab4c..a0c043d4bd 100644 --- a/yt_dlp/extractor/mixcloud.py +++ b/yt_dlp/extractor/mixcloud.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import itertools -import re from .common import InfoExtractor from ..compat import ( @@ -79,7 +78,7 @@ def _decrypt_xor_cipher(key, ciphertext): for ch, k in compat_zip(ciphertext, itertools.cycle(key))]) def _real_extract(self, url): - username, slug = re.match(self._VALID_URL, url).groups() + username, slug = self._match_valid_url(url).groups() username, slug = compat_urllib_parse_unquote(username), compat_urllib_parse_unquote(slug) track_id = '%s_%s' % (username, slug) @@ -214,7 +213,7 @@ def _get_playlist_title(self, title, slug): return title def _real_extract(self, url): - username, slug = re.match(self._VALID_URL, url).groups() + username, slug = self._match_valid_url(url).groups() username = compat_urllib_parse_unquote(username) if not slug: slug = 'uploads' diff --git a/yt_dlp/extractor/moevideo.py b/yt_dlp/extractor/moevideo.py index eb9b4ce7c5..a3f1b38663 100644 --- a/yt_dlp/extractor/moevideo.py +++ b/yt_dlp/extractor/moevideo.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -54,7 +53,7 @@ class MoeVideoIE(InfoExtractor): ] def _real_extract(self, url): - host, video_id = re.match(self._VALID_URL, url).groups() + host, video_id = self._match_valid_url(url).groups() webpage = self._download_webpage( 'http://%s/video/%s' % (host, video_id), diff --git a/yt_dlp/extractor/mojvideo.py b/yt_dlp/extractor/mojvideo.py index 165e658c94..0421f3f447 100644 --- a/yt_dlp/extractor/mojvideo.py +++ b/yt_dlp/extractor/mojvideo.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -26,7 +25,7 @@ class MojvideoIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/morningstar.py b/yt_dlp/extractor/morningstar.py index 0093bcd6ca..71a22a614c 100644 --- a/yt_dlp/extractor/morningstar.py +++ b/yt_dlp/extractor/morningstar.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -25,7 +24,7 @@ class MorningstarIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/moviezine.py b/yt_dlp/extractor/moviezine.py index 85cc6e22f5..730da4bd70 100644 --- a/yt_dlp/extractor/moviezine.py +++ b/yt_dlp/extractor/moviezine.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -21,7 +20,7 @@ class MoviezineIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/msn.py b/yt_dlp/extractor/msn.py index 9ce90a9281..f34e2102c2 100644 --- a/yt_dlp/extractor/msn.py +++ b/yt_dlp/extractor/msn.py @@ -67,7 +67,7 @@ class MSNIE(InfoExtractor): }] def _real_extract(self, url): - display_id, page_id = re.match(self._VALID_URL, url).groups() + display_id, page_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/mtv.py b/yt_dlp/extractor/mtv.py index 303f71cf82..e446a955b9 100644 --- a/yt_dlp/extractor/mtv.py +++ b/yt_dlp/extractor/mtv.py @@ -355,7 +355,7 @@ def _get_feed_url(self, uri): return self._remove_template_parameter(config['feedWithQueryParams']) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) mgid = mobj.group('mgid') return self._get_videos_info(mgid) @@ -437,7 +437,7 @@ def _get_thumbnail_url(self, uri, itemdoc): return 'http://mtv.mtvnimages.com/uri/' + uri def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('videoid') uri = mobj.groupdict().get('mgid') if uri is None: diff --git a/yt_dlp/extractor/mxplayer.py b/yt_dlp/extractor/mxplayer.py index 0bad51d155..0f1c439aa8 100644 --- a/yt_dlp/extractor/mxplayer.py +++ b/yt_dlp/extractor/mxplayer.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -76,7 +75,7 @@ def _get_stream_urls(self, video_dict): yield stream_type, 'base', stream def _real_extract(self, url): - display_id, video_id = re.match(self._VALID_URL, url).groups() + display_id, video_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, video_id) source = self._parse_json( @@ -170,7 +169,7 @@ def _entries(self, show_id): next_url = season_json.get('next') def _real_extract(self, url): - display_id, show_id = re.match(self._VALID_URL, url).groups() + display_id, show_id = self._match_valid_url(url).groups() return self.playlist_result( self._entries(show_id), playlist_id=show_id, playlist_title=display_id.replace('-', ' ').title()) diff --git a/yt_dlp/extractor/mychannels.py b/yt_dlp/extractor/mychannels.py index b1ffe78489..d820d4eb8f 100644 --- a/yt_dlp/extractor/mychannels.py +++ b/yt_dlp/extractor/mychannels.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor @@ -21,7 +20,7 @@ class MyChannelsIE(InfoExtractor): } def _real_extract(self, url): - id_type, url_id = re.match(self._VALID_URL, url).groups() + id_type, url_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, url_id) video_data = self._html_search_regex(r']+data-%s-id="%s"[^>]+)>' % (id_type, url_id), webpage, 'video data') diff --git a/yt_dlp/extractor/myspace.py b/yt_dlp/extractor/myspace.py index c3bf690919..4227d42481 100644 --- a/yt_dlp/extractor/myspace.py +++ b/yt_dlp/extractor/myspace.py @@ -54,7 +54,7 @@ class MySpaceIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('video_id') or mobj.group('song_id') is_song = mobj.group('mediatype').startswith('music/song') webpage = self._download_webpage(url, video_id) @@ -179,7 +179,7 @@ class MySpaceAlbumIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) playlist_id = mobj.group('id') display_id = mobj.group('title') + playlist_id webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/nba.py b/yt_dlp/extractor/nba.py index 366e5d645b..3c678c50d0 100644 --- a/yt_dlp/extractor/nba.py +++ b/yt_dlp/extractor/nba.py @@ -337,7 +337,7 @@ def _extract_video(self, video, team, extract_all=True): return info def _real_extract(self, url): - team, display_id = re.match(self._VALID_URL, url).groups() + team, display_id = self._match_valid_url(url).groups() if '/play#/' in url: display_id = compat_urllib_parse_unquote(display_id) else: diff --git a/yt_dlp/extractor/nbc.py b/yt_dlp/extractor/nbc.py index 5ebb1c869d..f304f191af 100644 --- a/yt_dlp/extractor/nbc.py +++ b/yt_dlp/extractor/nbc.py @@ -86,7 +86,7 @@ class NBCIE(ThePlatformIE): ] def _real_extract(self, url): - permalink, video_id = re.match(self._VALID_URL, url).groups() + permalink, video_id = self._match_valid_url(url).groups() permalink = 'http' + compat_urllib_parse_unquote(permalink) video_data = self._download_json( 'https://friendship.nbc.co/v2/graphql', video_id, query={ diff --git a/yt_dlp/extractor/ndr.py b/yt_dlp/extractor/ndr.py index 81abb3120f..45aa106c80 100644 --- a/yt_dlp/extractor/ndr.py +++ b/yt_dlp/extractor/ndr.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -17,7 +16,7 @@ class NDRBaseIE(InfoExtractor): def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = next(group for group in mobj.groups() if group) id = mobj.group('id') webpage = self._download_webpage(url, display_id) @@ -205,7 +204,7 @@ class NDREmbedBaseIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') or mobj.group('id_s') ppjson = self._download_json( diff --git a/yt_dlp/extractor/netzkino.py b/yt_dlp/extractor/netzkino.py index 3d1a06d0b5..4ad0d8e96c 100644 --- a/yt_dlp/extractor/netzkino.py +++ b/yt_dlp/extractor/netzkino.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -50,7 +49,7 @@ class NetzkinoIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') api_url = 'https://api.netzkino.de.simplecache.net/capi-2.0a/movies/%s.json?d=www' % video_id diff --git a/yt_dlp/extractor/nexx.py b/yt_dlp/extractor/nexx.py index 586c1b7eb0..860d636e23 100644 --- a/yt_dlp/extractor/nexx.py +++ b/yt_dlp/extractor/nexx.py @@ -289,7 +289,7 @@ def get_cdn_shield_base(shield_type='', static=False): return formats def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) domain_id = mobj.group('domain_id') or mobj.group('domain_id_s') video_id = mobj.group('id') diff --git a/yt_dlp/extractor/nhk.py b/yt_dlp/extractor/nhk.py index 8a9331a79f..950a3d0d4a 100644 --- a/yt_dlp/extractor/nhk.py +++ b/yt_dlp/extractor/nhk.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import urljoin @@ -22,7 +21,7 @@ def _call_api(self, m_id, lang, is_video, is_episode, is_clip): def _extract_episode_info(self, url, episode=None): fetch_episode = episode is None - lang, m_type, episode_id = re.match(NhkVodIE._VALID_URL, url).groups() + lang, m_type, episode_id = NhkVodIE._match_valid_url(url).groups() if episode_id.isdigit(): episode_id = episode_id[:4] + '-' + episode_id[4:] @@ -158,7 +157,7 @@ class NhkVodProgramIE(NhkBaseIE): }] def _real_extract(self, url): - lang, m_type, program_id, episode_type = re.match(self._VALID_URL, url).groups() + lang, m_type, program_id, episode_type = self._match_valid_url(url).groups() episodes = self._call_api( program_id, lang, m_type == 'video', False, episode_type == 'clip') diff --git a/yt_dlp/extractor/nhl.py b/yt_dlp/extractor/nhl.py index eddfe1f371..d3a5e17e94 100644 --- a/yt_dlp/extractor/nhl.py +++ b/yt_dlp/extractor/nhl.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -14,7 +13,7 @@ class NHLBaseIE(InfoExtractor): def _real_extract(self, url): - site, tmp_id = re.match(self._VALID_URL, url).groups() + site, tmp_id = self._match_valid_url(url).groups() video_data = self._download_json( 'https://%s/%s/%sid/v1/%s/details/web-v1.json' % (self._CONTENT_DOMAIN, site[:3], 'item/' if site == 'mlb' else '', tmp_id), tmp_id) diff --git a/yt_dlp/extractor/nick.py b/yt_dlp/extractor/nick.py index 60e6e7315d..084538d711 100644 --- a/yt_dlp/extractor/nick.py +++ b/yt_dlp/extractor/nick.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .mtv import MTVServicesInfoExtractor from ..utils import update_url_query @@ -81,7 +80,7 @@ def _extract_mgid(self, webpage): return mgid def _real_extract(self, url): - domain, video_type, display_id = re.match(self._VALID_URL, url).groups() + domain, video_type, display_id = self._match_valid_url(url).groups() if video_type.startswith("episodes"): return super()._real_extract(url) video_data = self._download_json( @@ -121,7 +120,7 @@ class NickBrIE(MTVServicesInfoExtractor): }] def _real_extract(self, url): - domain, display_id = re.match(self._VALID_URL, url).groups() + domain, display_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) uri = self._search_regex( r'data-(?:contenturi|mgid)="([^"]+)', webpage, 'mgid') diff --git a/yt_dlp/extractor/ninecninemedia.py b/yt_dlp/extractor/ninecninemedia.py index 71fde114c6..d1281167a7 100644 --- a/yt_dlp/extractor/ninecninemedia.py +++ b/yt_dlp/extractor/ninecninemedia.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -20,7 +19,7 @@ class NineCNineMediaIE(InfoExtractor): _API_BASE_TEMPLATE = 'http://capi.9c9media.com/destinations/%s/platforms/desktop/contents/%s/' def _real_extract(self, url): - destination_code, content_id = re.match(self._VALID_URL, url).groups() + destination_code, content_id = self._match_valid_url(url).groups() api_base_url = self._API_BASE_TEMPLATE % (destination_code, content_id) content = self._download_json(api_base_url, content_id, query={ '$include': '[Media.Name,Season,ContentPackages.Duration,ContentPackages.Id]', diff --git a/yt_dlp/extractor/nitter.py b/yt_dlp/extractor/nitter.py index bc80d44c34..a0546cda0f 100644 --- a/yt_dlp/extractor/nitter.py +++ b/yt_dlp/extractor/nitter.py @@ -173,7 +173,7 @@ def _real_extract(self, url): title = self._html_search_regex(r'
]+title="([^"]+)"', webpage, 'uploader name', fatal=False) diff --git a/yt_dlp/extractor/nova.py b/yt_dlp/extractor/nova.py index 47b9748f02..fdf604d2af 100644 --- a/yt_dlp/extractor/nova.py +++ b/yt_dlp/extractor/nova.py @@ -190,7 +190,7 @@ class NovaIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('id') site = mobj.group('site') diff --git a/yt_dlp/extractor/nrk.py b/yt_dlp/extractor/nrk.py index 6d01a25c3e..b556bc6aa4 100644 --- a/yt_dlp/extractor/nrk.py +++ b/yt_dlp/extractor/nrk.py @@ -452,7 +452,7 @@ class NRKTVEpisodeIE(InfoExtractor): }] def _real_extract(self, url): - display_id, season_number, episode_number = re.match(self._VALID_URL, url).groups() + display_id, season_number, episode_number = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) @@ -594,7 +594,7 @@ def suitable(cls, url): else super(NRKTVSeasonIE, cls).suitable(url)) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) domain = mobj.group('domain') serie_kind = mobj.group('serie_kind') serie = mobj.group('serie') @@ -692,7 +692,7 @@ def suitable(cls, url): else super(NRKTVSeriesIE, cls).suitable(url)) def _real_extract(self, url): - site, serie_kind, series_id = re.match(self._VALID_URL, url).groups() + site, serie_kind, series_id = self._match_valid_url(url).groups() is_radio = site == 'radio.nrk' domain = 'radio' if is_radio else 'tv' diff --git a/yt_dlp/extractor/onet.py b/yt_dlp/extractor/onet.py index 219ac349ed..bf53ea0b09 100644 --- a/yt_dlp/extractor/onet.py +++ b/yt_dlp/extractor/onet.py @@ -138,7 +138,7 @@ class OnetIE(OnetBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id, video_id = mobj.group('display_id', 'id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/ooyala.py b/yt_dlp/extractor/ooyala.py index 7204dfecd8..20cfa0a870 100644 --- a/yt_dlp/extractor/ooyala.py +++ b/yt_dlp/extractor/ooyala.py @@ -204,6 +204,6 @@ class OoyalaExternalIE(OoyalaBaseIE): } def _real_extract(self, url): - partner_id, video_id, pcode = re.match(self._VALID_URL, url).groups() + partner_id, video_id, pcode = self._match_valid_url(url).groups() content_tree_url = self._CONTENT_TREE_BASE + 'external_id/%s/%s:%s' % (pcode, partner_id, video_id) return self._extract(content_tree_url, video_id) diff --git a/yt_dlp/extractor/orf.py b/yt_dlp/extractor/orf.py index 8d537d7ae7..428ec97e4f 100644 --- a/yt_dlp/extractor/orf.py +++ b/yt_dlp/extractor/orf.py @@ -183,7 +183,7 @@ def _real_extract(self, url): class ORFRadioIE(InfoExtractor): def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) show_date = mobj.group('date') show_id = mobj.group('show') diff --git a/yt_dlp/extractor/packtpub.py b/yt_dlp/extractor/packtpub.py index 11ad3b3b83..c06fca7952 100644 --- a/yt_dlp/extractor/packtpub.py +++ b/yt_dlp/extractor/packtpub.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import ( @@ -66,7 +65,7 @@ def _real_initialize(self): raise def _real_extract(self, url): - course_id, chapter_id, video_id, display_id = re.match(self._VALID_URL, url).groups() + course_id, chapter_id, video_id, display_id = self._match_valid_url(url).groups() headers = {} if self._TOKEN: @@ -123,7 +122,7 @@ def suitable(cls, url): PacktPubCourseIE, cls).suitable(url) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) url, course_id = mobj.group('url', 'id') course = self._download_json( diff --git a/yt_dlp/extractor/palcomp3.py b/yt_dlp/extractor/palcomp3.py index fb29d83f9f..269e67a57e 100644 --- a/yt_dlp/extractor/palcomp3.py +++ b/yt_dlp/extractor/palcomp3.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -64,7 +63,7 @@ def _real_initialize(self): self._ARTIST_FIELDS_TMPL = self._ARTIST_FIELDS_TMPL % self._MUSIC_FIELDS def _real_extract(self, url): - artist_slug, music_slug = re.match(self._VALID_URL, url).groups() + artist_slug, music_slug = self._match_valid_url(url).groups() artist_fields = self._ARTIST_FIELDS_TMPL % music_slug music = self._call_api(artist_slug, artist_fields)['artist']['music'] return self._parse_music(music) @@ -111,7 +110,7 @@ class PalcoMP3ArtistIE(PalcoMP3BaseIE): @ classmethod def suitable(cls, url): - return False if re.match(PalcoMP3IE._VALID_URL, url) else super(PalcoMP3ArtistIE, cls).suitable(url) + return False if PalcoMP3IE._match_valid_url(url) else super(PalcoMP3ArtistIE, cls).suitable(url) def _real_extract(self, url): artist_slug = self._match_id(url) diff --git a/yt_dlp/extractor/pandoratv.py b/yt_dlp/extractor/pandoratv.py index 538738c090..44b462bebf 100644 --- a/yt_dlp/extractor/pandoratv.py +++ b/yt_dlp/extractor/pandoratv.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -71,7 +70,7 @@ class PandoraTVIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) user_id = mobj.group('user_id') video_id = mobj.group('id') diff --git a/yt_dlp/extractor/pbs.py b/yt_dlp/extractor/pbs.py index d4baa16ee9..d68855d62d 100644 --- a/yt_dlp/extractor/pbs.py +++ b/yt_dlp/extractor/pbs.py @@ -436,7 +436,7 @@ def _real_initialize(self): self._set_cookie('.pbs.org', 'pbsol.station', station) def _extract_webpage(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) description = None diff --git a/yt_dlp/extractor/peertube.py b/yt_dlp/extractor/peertube.py index d1a9d696d4..6fe53dcf87 100644 --- a/yt_dlp/extractor/peertube.py +++ b/yt_dlp/extractor/peertube.py @@ -529,7 +529,7 @@ def _get_subtitles(self, host, video_id): return subtitles def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host = mobj.group('host') or mobj.group('host_2') video_id = mobj.group('id') diff --git a/yt_dlp/extractor/performgroup.py b/yt_dlp/extractor/performgroup.py index 26942bfb3f..c00d393754 100644 --- a/yt_dlp/extractor/performgroup.py +++ b/yt_dlp/extractor/performgroup.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import int_or_none @@ -34,7 +33,7 @@ def _call_api(self, service, auth_token, content_id, referer_url): }) def _real_extract(self, url): - player_id, auth_token = re.search(self._VALID_URL, url).groups() + player_id, auth_token = self._match_valid_url(url).groups() bootstrap = self._call_api('bootstrap', auth_token, player_id, url) video = bootstrap['config']['dataSource']['sourceItems'][0]['videos'][0] video_id = video['uuid'] diff --git a/yt_dlp/extractor/photobucket.py b/yt_dlp/extractor/photobucket.py index 6c8bbe1d95..53aebe2d92 100644 --- a/yt_dlp/extractor/photobucket.py +++ b/yt_dlp/extractor/photobucket.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote @@ -23,7 +22,7 @@ class PhotobucketIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') video_extension = mobj.group('ext') diff --git a/yt_dlp/extractor/piksel.py b/yt_dlp/extractor/piksel.py index ecf56ff8f6..a362664b20 100644 --- a/yt_dlp/extractor/piksel.py +++ b/yt_dlp/extractor/piksel.py @@ -85,7 +85,7 @@ def _call_api(self, app_token, resource, display_id, query, fatal=True): return response def _real_extract(self, url): - ref_id, display_id = re.match(self._VALID_URL, url).groups() + ref_id, display_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) app_token = self._search_regex([ r'clientAPI\s*:\s*"([^"]+)"', diff --git a/yt_dlp/extractor/pinterest.py b/yt_dlp/extractor/pinterest.py index 09aeea3400..80e9cd00ee 100644 --- a/yt_dlp/extractor/pinterest.py +++ b/yt_dlp/extractor/pinterest.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import compat_str @@ -165,7 +164,7 @@ def suitable(cls, url): PinterestCollectionIE, cls).suitable(url) def _real_extract(self, url): - username, slug = re.match(self._VALID_URL, url).groups() + username, slug = self._match_valid_url(url).groups() board = self._call_api( 'Board', slug, { 'slug': slug, diff --git a/yt_dlp/extractor/playfm.py b/yt_dlp/extractor/playfm.py index e766ccca32..4298cbe308 100644 --- a/yt_dlp/extractor/playfm.py +++ b/yt_dlp/extractor/playfm.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -35,7 +34,7 @@ class PlayFMIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') slug = mobj.group('slug') diff --git a/yt_dlp/extractor/playplustv.py b/yt_dlp/extractor/playplustv.py index 1e30ab23a0..fd72a3717a 100644 --- a/yt_dlp/extractor/playplustv.py +++ b/yt_dlp/extractor/playplustv.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import compat_HTTPError @@ -63,7 +62,7 @@ def _real_initialize(self): self._profile = self._call_api('Profiles')['list'][0]['_id'] def _real_extract(self, url): - project_id, media_id = re.match(self._VALID_URL, url).groups() + project_id, media_id = self._match_valid_url(url).groups() media = self._call_api( 'Media', media_id, { 'profileId': self._profile, diff --git a/yt_dlp/extractor/playwire.py b/yt_dlp/extractor/playwire.py index 4d96a10a71..9c9e597b5a 100644 --- a/yt_dlp/extractor/playwire.py +++ b/yt_dlp/extractor/playwire.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -46,7 +45,7 @@ class PlaywireIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) publisher_id, video_id = mobj.group('publisher_id'), mobj.group('id') player = self._download_json( diff --git a/yt_dlp/extractor/podomatic.py b/yt_dlp/extractor/podomatic.py index e782e3f1fd..673a3ab949 100644 --- a/yt_dlp/extractor/podomatic.py +++ b/yt_dlp/extractor/podomatic.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import int_or_none @@ -46,7 +45,7 @@ class PodomaticIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') channel = mobj.group('channel') or mobj.group('channel_2') diff --git a/yt_dlp/extractor/pokemon.py b/yt_dlp/extractor/pokemon.py index 8750e0e0d3..402b574a79 100644 --- a/yt_dlp/extractor/pokemon.py +++ b/yt_dlp/extractor/pokemon.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -50,7 +49,7 @@ class PokemonIE(InfoExtractor): }] def _real_extract(self, url): - video_id, display_id = re.match(self._VALID_URL, url).groups() + video_id, display_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, video_id or display_id) video_data = extract_attributes(self._search_regex( r'(<[^>]+data-video-id="%s"[^>]*>)' % (video_id if video_id else '[a-z0-9]{32}'), diff --git a/yt_dlp/extractor/popcorntimes.py b/yt_dlp/extractor/popcorntimes.py index 7bf7f98587..5f9d0e720b 100644 --- a/yt_dlp/extractor/popcorntimes.py +++ b/yt_dlp/extractor/popcorntimes.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -33,7 +32,7 @@ class PopcorntimesIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id, display_id = mobj.group('id', 'display_id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/popcorntv.py b/yt_dlp/extractor/popcorntv.py index 9f834fb6ce..66d2e50940 100644 --- a/yt_dlp/extractor/popcorntv.py +++ b/yt_dlp/extractor/popcorntv.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -33,7 +32,7 @@ class PopcornTVIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id, video_id = mobj.group('display_id', 'id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/porncom.py b/yt_dlp/extractor/porncom.py index 5726cab3ae..83df22141b 100644 --- a/yt_dlp/extractor/porncom.py +++ b/yt_dlp/extractor/porncom.py @@ -35,7 +35,7 @@ class PornComIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/pornhd.py b/yt_dlp/extractor/pornhd.py index c6052ac9f9..9dbd72f1d2 100644 --- a/yt_dlp/extractor/pornhd.py +++ b/yt_dlp/extractor/pornhd.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -47,7 +46,7 @@ class PornHdIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/pornhub.py b/yt_dlp/extractor/pornhub.py index c2b20ecfdd..6d894affd9 100644 --- a/yt_dlp/extractor/pornhub.py +++ b/yt_dlp/extractor/pornhub.py @@ -262,7 +262,7 @@ def _extract_count(self, pattern, webpage, name): pattern, webpage, '%s count' % name, fatal=False)) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host = mobj.group('host') or 'pornhub.com' video_id = mobj.group('id') @@ -567,7 +567,7 @@ class PornHubUserIE(PornHubPlaylistBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) user_id = mobj.group('id') videos_url = '%s/videos' % mobj.group('url') page = self._extract_page(url) @@ -629,7 +629,7 @@ def is_404(e): break def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host = mobj.group('host') item_id = mobj.group('id') @@ -808,7 +808,7 @@ def download_page(page_num): yield e def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host = mobj.group('host') item_id = mobj.group('id') diff --git a/yt_dlp/extractor/pornovoisines.py b/yt_dlp/extractor/pornovoisines.py index b6b71069d3..18459fc94e 100644 --- a/yt_dlp/extractor/pornovoisines.py +++ b/yt_dlp/extractor/pornovoisines.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -39,7 +38,7 @@ class PornoVoisinesIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/pornoxo.py b/yt_dlp/extractor/pornoxo.py index 2831368b6a..489dc2b259 100644 --- a/yt_dlp/extractor/pornoxo.py +++ b/yt_dlp/extractor/pornoxo.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -26,7 +25,7 @@ class PornoXOIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id, display_id = mobj.groups() webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/presstv.py b/yt_dlp/extractor/presstv.py index b5c279203b..bfb2eb71e3 100644 --- a/yt_dlp/extractor/presstv.py +++ b/yt_dlp/extractor/presstv.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import remove_start @@ -25,7 +24,7 @@ class PressTVIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/pyvideo.py b/yt_dlp/extractor/pyvideo.py index b8ac93a62c..869619723d 100644 --- a/yt_dlp/extractor/pyvideo.py +++ b/yt_dlp/extractor/pyvideo.py @@ -27,7 +27,7 @@ class PyvideoIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) category = mobj.group('category') video_id = mobj.group('id') diff --git a/yt_dlp/extractor/radiocanada.py b/yt_dlp/extractor/radiocanada.py index a28b1a24c4..4b4445c307 100644 --- a/yt_dlp/extractor/radiocanada.py +++ b/yt_dlp/extractor/radiocanada.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_HTTPError @@ -143,7 +142,7 @@ def get_meta(name): } def _real_extract(self, url): - return self._extract_info(*re.match(self._VALID_URL, url).groups()) + return self._extract_info(*self._match_valid_url(url).groups()) class RadioCanadaAudioVideoIE(InfoExtractor): diff --git a/yt_dlp/extractor/radiofrance.py b/yt_dlp/extractor/radiofrance.py index 2b5fea9458..082238bbc8 100644 --- a/yt_dlp/extractor/radiofrance.py +++ b/yt_dlp/extractor/radiofrance.py @@ -23,7 +23,7 @@ class RadioFranceIE(InfoExtractor): } def _real_extract(self, url): - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) video_id = m.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/rai.py b/yt_dlp/extractor/rai.py index 199253c4a1..9f5bed4c41 100644 --- a/yt_dlp/extractor/rai.py +++ b/yt_dlp/extractor/rai.py @@ -270,7 +270,7 @@ class RaiPlayIE(RaiBaseIE): }] def _real_extract(self, url): - base, video_id = re.match(self._VALID_URL, url).groups() + base, video_id = self._match_valid_url(url).groups() media = self._download_json( base + '.json', video_id, 'Downloading video JSON') @@ -363,7 +363,7 @@ class RaiPlayPlaylistIE(InfoExtractor): }] def _real_extract(self, url): - base, playlist_id = re.match(self._VALID_URL, url).groups() + base, playlist_id = self._match_valid_url(url).groups() program = self._download_json( base + '.json', playlist_id, 'Downloading program JSON') diff --git a/yt_dlp/extractor/raywenderlich.py b/yt_dlp/extractor/raywenderlich.py index 5411ece218..f04d51f7b9 100644 --- a/yt_dlp/extractor/raywenderlich.py +++ b/yt_dlp/extractor/raywenderlich.py @@ -72,7 +72,7 @@ def _extract_video_id(data, lesson_id): return compat_str(video_id) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) course_id, lesson_id = mobj.group('course_id', 'id') display_id = '%s/%s' % (course_id, lesson_id) diff --git a/yt_dlp/extractor/rbmaradio.py b/yt_dlp/extractor/rbmaradio.py index ae7413fb5e..9642fbbe1e 100644 --- a/yt_dlp/extractor/rbmaradio.py +++ b/yt_dlp/extractor/rbmaradio.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -30,7 +29,7 @@ class RBMARadioIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) show_id = mobj.group('show_id') episode_id = mobj.group('id') diff --git a/yt_dlp/extractor/rcs.py b/yt_dlp/extractor/rcs.py index 7ee351c604..ace611bc92 100644 --- a/yt_dlp/extractor/rcs.py +++ b/yt_dlp/extractor/rcs.py @@ -203,8 +203,8 @@ def _create_formats(self, urls, video_id): return formats def _real_extract(self, url): - video_id = self._match_id(url) - mobj = re.search(self._VALID_URL, url) + mobj = self._match_valid_url(url) + video_id = mobj.group('id') if 'cdn' not in mobj.groupdict(): raise ExtractorError('CDN not found in url: %s' % url) diff --git a/yt_dlp/extractor/rcti.py b/yt_dlp/extractor/rcti.py index 278bfd7d7e..31d9779dd4 100644 --- a/yt_dlp/extractor/rcti.py +++ b/yt_dlp/extractor/rcti.py @@ -4,7 +4,6 @@ import itertools import json import random -import re import time from .common import InfoExtractor @@ -148,7 +147,7 @@ class RCTIPlusIE(RCTIPlusBaseIE): } def _real_extract(self, url): - match = re.match(self._VALID_URL, url).groupdict() + match = self._match_valid_url(url).groupdict() video_type, video_id, display_id = match['type'], match['id'], match['display_id'] url_api_version = 'v2' if video_type == 'missed-event' else 'v1' @@ -280,7 +279,7 @@ def _entries(self, url, display_id=None, note='Downloading entries JSON', metada yield url_res def _real_extract(self, url): - series_id, display_id = re.match(self._VALID_URL, url).groups() + series_id, display_id = self._match_valid_url(url).groups() series_meta, meta_paths = self._call_api( 'https://api.rctiplus.com/api/v1/program/%s/detail' % series_id, display_id, 'Downloading series metadata') @@ -347,7 +346,7 @@ def suitable(cls, url): return False if RCTIPlusIE.suitable(url) else super(RCTIPlusTVIE, cls).suitable(url) def _real_extract(self, url): - match = re.match(self._VALID_URL, url).groupdict() + match = self._match_valid_url(url).groupdict() tv_id = match.get('tvname') or match.get('eventname') webpage = self._download_webpage(url, tv_id) video_type, video_id = self._search_regex( diff --git a/yt_dlp/extractor/redbulltv.py b/yt_dlp/extractor/redbulltv.py index 6d000b3729..e7fdcce3ed 100644 --- a/yt_dlp/extractor/redbulltv.py +++ b/yt_dlp/extractor/redbulltv.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_HTTPError @@ -161,7 +160,7 @@ class RedBullTVRrnContentIE(InfoExtractor): }] def _real_extract(self, url): - region, lang, rrn_id = re.search(self._VALID_URL, url).groups() + region, lang, rrn_id = self._match_valid_url(url).groups() rrn_id += ':%s-%s' % (lang, region.upper()) return self.url_result( 'https://www.redbull.com/embed/' + rrn_id, @@ -204,7 +203,7 @@ class RedBullIE(InfoExtractor): _LAT_FALLBACK_MAP = ['ar', 'bo', 'car', 'cl', 'co', 'mx', 'pe'] def _real_extract(self, url): - region, lang, filter_type, display_id = re.search(self._VALID_URL, url).groups() + region, lang, filter_type, display_id = self._match_valid_url(url).groups() if filter_type == 'episodes': filter_type = 'episode-videos' elif filter_type == 'live': diff --git a/yt_dlp/extractor/reddit.py b/yt_dlp/extractor/reddit.py index 222fa0172a..2a1b950bd7 100644 --- a/yt_dlp/extractor/reddit.py +++ b/yt_dlp/extractor/reddit.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -98,7 +97,7 @@ class RedditRIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) url, video_id = mobj.group('url', 'id') video_id = self._match_id(url) diff --git a/yt_dlp/extractor/rice.py b/yt_dlp/extractor/rice.py index f855719ac2..cf2bb1b51f 100644 --- a/yt_dlp/extractor/rice.py +++ b/yt_dlp/extractor/rice.py @@ -30,7 +30,7 @@ class RICEIE(InfoExtractor): _NS = 'http://schemas.datacontract.org/2004/07/ensembleVideo.Data.Service.Contracts.Models.Player.Config' def _real_extract(self, url): - qs = compat_parse_qs(re.match(self._VALID_URL, url).group('query')) + qs = compat_parse_qs(self._match_valid_url(url).group('query')) if not qs.get('PortalID') or not qs.get('DestinationID') or not qs.get('ContentID'): raise ExtractorError('Invalid URL', expected=True) diff --git a/yt_dlp/extractor/rmcdecouverte.py b/yt_dlp/extractor/rmcdecouverte.py index bde6cd5dc8..422d47ae9f 100644 --- a/yt_dlp/extractor/rmcdecouverte.py +++ b/yt_dlp/extractor/rmcdecouverte.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from .brightcove import BrightcoveLegacyIE @@ -60,7 +59,7 @@ class RMCDecouverteIE(InfoExtractor): BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1969646226001/default_default/index.html?videoId=%s' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('id') or 'direct' webpage = self._download_webpage(url, display_id) brightcove_legacy_url = BrightcoveLegacyIE._extract_brightcove_url(webpage) diff --git a/yt_dlp/extractor/roxwel.py b/yt_dlp/extractor/roxwel.py index 65284643b4..84bb1aa00b 100644 --- a/yt_dlp/extractor/roxwel.py +++ b/yt_dlp/extractor/roxwel.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import unified_strdate, determine_ext @@ -27,7 +26,7 @@ class RoxwelIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) filename = mobj.group('filename') info_url = 'http://www.roxwel.com/api/videos/%s' % filename info = self._download_json(info_url, filename) diff --git a/yt_dlp/extractor/rtbf.py b/yt_dlp/extractor/rtbf.py index c6ca4cd100..f9979d0a49 100644 --- a/yt_dlp/extractor/rtbf.py +++ b/yt_dlp/extractor/rtbf.py @@ -68,7 +68,7 @@ class RTBFIE(InfoExtractor): ] def _real_extract(self, url): - live, media_id = re.match(self._VALID_URL, url).groups() + live, media_id = self._match_valid_url(url).groups() embed_page = self._download_webpage( 'https://www.rtbf.be/auvio/embed/' + ('direct' if live else 'media'), media_id, query={'id': media_id}) diff --git a/yt_dlp/extractor/rtl2.py b/yt_dlp/extractor/rtl2.py index d7baa3aa5c..4e3aa03984 100644 --- a/yt_dlp/extractor/rtl2.py +++ b/yt_dlp/extractor/rtl2.py @@ -51,7 +51,7 @@ class RTL2IE(InfoExtractor): }] def _real_extract(self, url): - vico_id, vivi_id, display_id = re.match(self._VALID_URL, url).groups() + vico_id, vivi_id, display_id = self._match_valid_url(url).groups() if not vico_id: webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/rts.py b/yt_dlp/extractor/rts.py index aed35f8a98..865a730243 100644 --- a/yt_dlp/extractor/rts.py +++ b/yt_dlp/extractor/rts.py @@ -116,7 +116,7 @@ class RTSIE(SRGSSRIE): ] def _real_extract(self, url): - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) media_id = m.group('rts_id') or m.group('id') display_id = m.group('display_id') or media_id diff --git a/yt_dlp/extractor/rtve.py b/yt_dlp/extractor/rtve.py index d2fb754cf5..59832eeac8 100644 --- a/yt_dlp/extractor/rtve.py +++ b/yt_dlp/extractor/rtve.py @@ -3,7 +3,6 @@ import base64 import io -import re import sys from .common import InfoExtractor @@ -216,7 +215,7 @@ class RTVELiveIE(RTVEALaCartaIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/rutv.py b/yt_dlp/extractor/rutv.py index e66036c795..7e0de994a4 100644 --- a/yt_dlp/extractor/rutv.py +++ b/yt_dlp/extractor/rutv.py @@ -123,7 +123,7 @@ def _extract_url(cls, webpage): return mobj.group('url') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') video_path = mobj.group('path') diff --git a/yt_dlp/extractor/safari.py b/yt_dlp/extractor/safari.py index 2cc6651224..c92e8849bd 100644 --- a/yt_dlp/extractor/safari.py +++ b/yt_dlp/extractor/safari.py @@ -127,7 +127,7 @@ class SafariIE(SafariBaseIE): _UICONF_ID = '29375172' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) reference_id = mobj.group('reference_id') if reference_id: @@ -189,7 +189,7 @@ class SafariApiIE(SafariBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) part = self._download_json( url, '%s/%s' % (mobj.group('course_id'), mobj.group('part')), 'Downloading part JSON') diff --git a/yt_dlp/extractor/sapo.py b/yt_dlp/extractor/sapo.py index 49a9b313a8..df202a3a40 100644 --- a/yt_dlp/extractor/sapo.py +++ b/yt_dlp/extractor/sapo.py @@ -63,7 +63,7 @@ class SapoIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') item = self._download_xml( diff --git a/yt_dlp/extractor/savefrom.py b/yt_dlp/extractor/savefrom.py index 21e44b69ab..98efdc2a4f 100644 --- a/yt_dlp/extractor/savefrom.py +++ b/yt_dlp/extractor/savefrom.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import os.path -import re from .common import InfoExtractor @@ -28,7 +27,7 @@ class SaveFromIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = os.path.splitext(url.split('/')[-1])[0] return self.url_result(mobj.group('url'), video_id=video_id) diff --git a/yt_dlp/extractor/scrippsnetworks.py b/yt_dlp/extractor/scrippsnetworks.py index b40b4c4afd..84918b67f4 100644 --- a/yt_dlp/extractor/scrippsnetworks.py +++ b/yt_dlp/extractor/scrippsnetworks.py @@ -3,7 +3,6 @@ import json import hashlib -import re from .aws import AWSIE from .anvato import AnvatoIE @@ -55,7 +54,7 @@ class ScrippsNetworksWatchIE(AWSIE): _AWS_USER_AGENT = 'aws-sdk-js/2.80.0 callback' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) site_id, video_id = mobj.group('site', 'id') aws_identity_id_json = json.dumps({ @@ -146,7 +145,7 @@ class ScrippsNetworksIE(InfoExtractor): _TP_TEMPL = 'https://link.theplatform.com/s/ip77QC/media/guid/%d/%s?mbr=true' def _real_extract(self, url): - site, guid = re.match(self._VALID_URL, url).groups() + site, guid = self._match_valid_url(url).groups() return self.url_result(smuggle_url( self._TP_TEMPL % (self._ACCOUNT_MAP[site], guid), {'force_smil_url': True}), 'ThePlatform', guid) diff --git a/yt_dlp/extractor/seeker.py b/yt_dlp/extractor/seeker.py index 7872dc80d9..e5c18c7a55 100644 --- a/yt_dlp/extractor/seeker.py +++ b/yt_dlp/extractor/seeker.py @@ -46,7 +46,7 @@ class SeekerIE(InfoExtractor): }] def _real_extract(self, url): - display_id, article_id = re.match(self._VALID_URL, url).groups() + display_id, article_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) entries = [] for jwp_id in re.findall(r'data-video-id="([a-zA-Z0-9]{8})"', webpage): diff --git a/yt_dlp/extractor/senateisvp.py b/yt_dlp/extractor/senateisvp.py index db5ef8b57b..8794d47efc 100644 --- a/yt_dlp/extractor/senateisvp.py +++ b/yt_dlp/extractor/senateisvp.py @@ -102,7 +102,7 @@ def _get_info_for_comm(self, committee): def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) - qs = compat_parse_qs(re.match(self._VALID_URL, url).group('qs')) + qs = compat_parse_qs(self._match_valid_url(url).group('qs')) if not qs.get('filename') or not qs.get('type') or not qs.get('comm'): raise ExtractorError('Invalid URL', expected=True) diff --git a/yt_dlp/extractor/sevenplus.py b/yt_dlp/extractor/sevenplus.py index 240afc18f6..9f15bd7ccc 100644 --- a/yt_dlp/extractor/sevenplus.py +++ b/yt_dlp/extractor/sevenplus.py @@ -43,7 +43,7 @@ class SevenPlusIE(BrightcoveNewIE): }] def _real_extract(self, url): - path, episode_id = re.match(self._VALID_URL, url).groups() + path, episode_id = self._match_valid_url(url).groups() try: media = self._download_json( diff --git a/yt_dlp/extractor/shahid.py b/yt_dlp/extractor/shahid.py index 7a08686fa5..dc590129c3 100644 --- a/yt_dlp/extractor/shahid.py +++ b/yt_dlp/extractor/shahid.py @@ -111,7 +111,7 @@ def _real_initialize(self): })) def _real_extract(self, url): - page_type, video_id = re.match(self._VALID_URL, url).groups() + page_type, video_id = self._match_valid_url(url).groups() if page_type == 'clip': page_type = 'episode' diff --git a/yt_dlp/extractor/simplecast.py b/yt_dlp/extractor/simplecast.py index 2d0b3c06d8..857e9414fa 100644 --- a/yt_dlp/extractor/simplecast.py +++ b/yt_dlp/extractor/simplecast.py @@ -122,7 +122,7 @@ class SimplecastEpisodeIE(SimplecastBaseIE): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) episode = self._call_search_api( 'episode', mobj.group(1), mobj.group(0)) return self._parse_episode(episode) diff --git a/yt_dlp/extractor/sina.py b/yt_dlp/extractor/sina.py index 4083114184..b62b0c3e5b 100644 --- a/yt_dlp/extractor/sina.py +++ b/yt_dlp/extractor/sina.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -56,7 +55,7 @@ class SinaIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') if not video_id: diff --git a/yt_dlp/extractor/sixplay.py b/yt_dlp/extractor/sixplay.py index 7ec66ecf39..3a3a992569 100644 --- a/yt_dlp/extractor/sixplay.py +++ b/yt_dlp/extractor/sixplay.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -41,7 +40,7 @@ class SixPlayIE(InfoExtractor): }] def _real_extract(self, url): - domain, video_id = re.search(self._VALID_URL, url).groups() + domain, video_id = self._match_valid_url(url).groups() service, consumer_name = { '6play.fr': ('6play', 'm6web'), 'rtlplay.be': ('rtlbe_rtl_play', 'rtlbe'), diff --git a/yt_dlp/extractor/slideshare.py b/yt_dlp/extractor/slideshare.py index e89ebebe75..9b3ad0ad49 100644 --- a/yt_dlp/extractor/slideshare.py +++ b/yt_dlp/extractor/slideshare.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re import json from .common import InfoExtractor @@ -27,7 +26,7 @@ class SlideshareIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) page_title = mobj.group('title') webpage = self._download_webpage(url, page_title) slideshare_obj = self._search_regex( diff --git a/yt_dlp/extractor/snotr.py b/yt_dlp/extractor/snotr.py index f773547483..0bb5482554 100644 --- a/yt_dlp/extractor/snotr.py +++ b/yt_dlp/extractor/snotr.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -39,7 +38,7 @@ class SnotrIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/sohu.py b/yt_dlp/extractor/sohu.py index a62ed84f1e..3bff5c595e 100644 --- a/yt_dlp/extractor/sohu.py +++ b/yt_dlp/extractor/sohu.py @@ -97,7 +97,7 @@ def _fetch_data(vid_id, mytv=False): 'Downloading JSON data for %s' % vid_id, headers=self.geo_verification_headers()) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') mytv = mobj.group('mytv') is not None diff --git a/yt_dlp/extractor/soundcloud.py b/yt_dlp/extractor/soundcloud.py index 13ec96d828..8f0713e134 100644 --- a/yt_dlp/extractor/soundcloud.py +++ b/yt_dlp/extractor/soundcloud.py @@ -557,7 +557,7 @@ def extract_count(key): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) track_id = mobj.group('track_id') @@ -637,7 +637,7 @@ class SoundcloudSetIE(SoundcloudPlaylistBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) full_title = '%s/sets/%s' % mobj.group('uploader', 'slug_title') token = mobj.group('token') @@ -789,7 +789,7 @@ class SoundcloudUserIE(SoundcloudPagedPlaylistBaseIE): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) uploader = mobj.group('user') user = self._download_json( @@ -842,7 +842,7 @@ class SoundcloudPlaylistIE(SoundcloudPlaylistBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) playlist_id = mobj.group('id') query = {} diff --git a/yt_dlp/extractor/soundgasm.py b/yt_dlp/extractor/soundgasm.py index 3d78a9d76c..d608eb7a76 100644 --- a/yt_dlp/extractor/soundgasm.py +++ b/yt_dlp/extractor/soundgasm.py @@ -22,7 +22,7 @@ class SoundgasmIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('display_id') webpage = self._download_webpage(url, display_id) diff --git a/yt_dlp/extractor/spankbang.py b/yt_dlp/extractor/spankbang.py index f14bd6d712..d70331bb35 100644 --- a/yt_dlp/extractor/spankbang.py +++ b/yt_dlp/extractor/spankbang.py @@ -70,7 +70,7 @@ class SpankBangIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') or mobj.group('id_2') webpage = self._download_webpage( url.replace('/%s/embed' % video_id, '/%s/video' % video_id), @@ -177,7 +177,7 @@ class SpankBangPlaylistIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) playlist_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/sport5.py b/yt_dlp/extractor/sport5.py index a417b5a4ef..35c57d62a7 100644 --- a/yt_dlp/extractor/sport5.py +++ b/yt_dlp/extractor/sport5.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ExtractorError @@ -36,7 +35,7 @@ class Sport5IE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) media_id = mobj.group('id') webpage = self._download_webpage(url, media_id) diff --git a/yt_dlp/extractor/springboardplatform.py b/yt_dlp/extractor/springboardplatform.py index 07d99b5791..49ac1f559c 100644 --- a/yt_dlp/extractor/springboardplatform.py +++ b/yt_dlp/extractor/springboardplatform.py @@ -57,7 +57,7 @@ def _extract_urls(webpage): webpage)] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') or mobj.group('id_2') index = mobj.group('index') or mobj.group('index_2') diff --git a/yt_dlp/extractor/srgssr.py b/yt_dlp/extractor/srgssr.py index 2977b5e670..cbc1c47d27 100644 --- a/yt_dlp/extractor/srgssr.py +++ b/yt_dlp/extractor/srgssr.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -82,7 +81,7 @@ def _get_media_data(self, bu, media_type, media_id): return media_data def _real_extract(self, url): - bu, media_type, media_id = re.match(self._VALID_URL, url).groups() + bu, media_type, media_id = self._match_valid_url(url).groups() media_data = self._get_media_data(bu, media_type, media_id) title = media_data['title'] @@ -249,7 +248,7 @@ class SRGSSRPlayIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) bu = mobj.group('bu') media_type = mobj.group('type') or mobj.group('type_2') media_id = mobj.group('id') diff --git a/yt_dlp/extractor/stanfordoc.py b/yt_dlp/extractor/stanfordoc.py index ae3dd13807..0003075aca 100644 --- a/yt_dlp/extractor/stanfordoc.py +++ b/yt_dlp/extractor/stanfordoc.py @@ -25,7 +25,7 @@ class StanfordOpenClassroomIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) if mobj.group('course') and mobj.group('video'): # A specific video course = mobj.group('course') diff --git a/yt_dlp/extractor/steam.py b/yt_dlp/extractor/steam.py index 9518f83f12..7f777c40bd 100644 --- a/yt_dlp/extractor/steam.py +++ b/yt_dlp/extractor/steam.py @@ -66,7 +66,7 @@ class SteamIE(InfoExtractor): }] def _real_extract(self, url): - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) fileID = m.group('fileID') if fileID: videourl = url diff --git a/yt_dlp/extractor/stv.py b/yt_dlp/extractor/stv.py index 539220a944..d36a4b6e96 100644 --- a/yt_dlp/extractor/stv.py +++ b/yt_dlp/extractor/stv.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -43,7 +42,7 @@ class STVPlayerIE(InfoExtractor): } def _real_extract(self, url): - ptype, video_id = re.match(self._VALID_URL, url).groups() + ptype, video_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, video_id, fatal=False) or '' props = (self._parse_json(self._search_regex( diff --git a/yt_dlp/extractor/svt.py b/yt_dlp/extractor/svt.py index 4b6284a8d7..38e0086b32 100644 --- a/yt_dlp/extractor/svt.py +++ b/yt_dlp/extractor/svt.py @@ -119,7 +119,7 @@ def _extract_url(webpage): return mobj.group('url') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) widget_id = mobj.group('widget_id') article_id = mobj.group('id') @@ -225,7 +225,7 @@ def _extract_by_video_id(self, video_id, webpage=None): return info_dict def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') svt_id = mobj.group('svt_id') or mobj.group('modal_id') @@ -301,7 +301,7 @@ def suitable(cls, url): return False if SVTIE.suitable(url) or SVTPlayIE.suitable(url) else super(SVTSeriesIE, cls).suitable(url) def _real_extract(self, url): - series_slug, season_id = re.match(self._VALID_URL, url).groups() + series_slug, season_id = self._match_valid_url(url).groups() series = self._download_json( 'https://api.svt.se/contento/graphql', series_slug, @@ -400,7 +400,7 @@ def suitable(cls, url): return False if SVTIE.suitable(url) or SVTPlayIE.suitable(url) else super(SVTPageIE, cls).suitable(url) def _real_extract(self, url): - path, display_id = re.match(self._VALID_URL, url).groups() + path, display_id = self._match_valid_url(url).groups() article = self._download_json( 'https://api.svt.se/nss-api/page/' + path, display_id, diff --git a/yt_dlp/extractor/tagesschau.py b/yt_dlp/extractor/tagesschau.py index 8ceab7e352..25c2004556 100644 --- a/yt_dlp/extractor/tagesschau.py +++ b/yt_dlp/extractor/tagesschau.py @@ -78,7 +78,7 @@ def _extract_via_api(self, kind, video_id): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') # kind = mobj.group('kind').lower() @@ -263,7 +263,7 @@ def _extract_formats(self, download_text, media_kind): return formats def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') or mobj.group('path') display_id = video_id.lstrip('-') diff --git a/yt_dlp/extractor/tbs.py b/yt_dlp/extractor/tbs.py index f7d7c18360..cad3f2f46f 100644 --- a/yt_dlp/extractor/tbs.py +++ b/yt_dlp/extractor/tbs.py @@ -40,7 +40,7 @@ class TBSIE(TurnerBaseIE): }] def _real_extract(self, url): - site, path, display_id = re.match(self._VALID_URL, url).groups() + site, path, display_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) drupal_settings = self._parse_json(self._search_regex( r']+?data-drupal-selector="drupal-settings-json"[^>]*?>({.+?})', diff --git a/yt_dlp/extractor/teachable.py b/yt_dlp/extractor/teachable.py index 2394f86d4b..37eae82bcc 100644 --- a/yt_dlp/extractor/teachable.py +++ b/yt_dlp/extractor/teachable.py @@ -151,7 +151,7 @@ def _extract_url(webpage, source_url): return '%s%s' % (TeachableBaseIE._URL_PREFIX, source_url) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) site = mobj.group('site') or mobj.group('site_t') video_id = mobj.group('id') @@ -248,7 +248,7 @@ def suitable(cls, url): TeachableCourseIE, cls).suitable(url) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) site = mobj.group('site') or mobj.group('site_t') course_id = mobj.group('id') diff --git a/yt_dlp/extractor/teachertube.py b/yt_dlp/extractor/teachertube.py index 1272078c50..e22f0114cf 100644 --- a/yt_dlp/extractor/teachertube.py +++ b/yt_dlp/extractor/teachertube.py @@ -111,7 +111,7 @@ class TeacherTubeUserIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) user_id = mobj.group('user') urls = [] diff --git a/yt_dlp/extractor/techtalks.py b/yt_dlp/extractor/techtalks.py index a5b62c7171..78f07319b6 100644 --- a/yt_dlp/extractor/techtalks.py +++ b/yt_dlp/extractor/techtalks.py @@ -44,7 +44,7 @@ class TechTalksIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) talk_id = mobj.group('id') webpage = self._download_webpage(url, talk_id) rtmp_url = self._search_regex( diff --git a/yt_dlp/extractor/telemb.py b/yt_dlp/extractor/telemb.py index 44d5d220b9..ac2d603b6b 100644 --- a/yt_dlp/extractor/telemb.py +++ b/yt_dlp/extractor/telemb.py @@ -38,7 +38,7 @@ class TeleMBIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/testurl.py b/yt_dlp/extractor/testurl.py index 84a14a0bde..8bc512a9c1 100644 --- a/yt_dlp/extractor/testurl.py +++ b/yt_dlp/extractor/testurl.py @@ -15,7 +15,7 @@ class TestURLIE(InfoExtractor): def _real_extract(self, url): from ..extractor import gen_extractors - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') extractor_id = mobj.group('extractor') all_extractors = gen_extractors() diff --git a/yt_dlp/extractor/tf1.py b/yt_dlp/extractor/tf1.py index 23c2808a15..669eb50151 100644 --- a/yt_dlp/extractor/tf1.py +++ b/yt_dlp/extractor/tf1.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import ( @@ -41,7 +40,7 @@ class TF1IE(InfoExtractor): }] def _real_extract(self, url): - program_slug, slug = re.match(self._VALID_URL, url).groups() + program_slug, slug = self._match_valid_url(url).groups() video = self._download_json( 'https://www.tf1.fr/graphql/web', slug, query={ 'id': '9b80783950b85247541dd1d851f9cc7fa36574af015621f853ab111a679ce26f', diff --git a/yt_dlp/extractor/theplatform.py b/yt_dlp/extractor/theplatform.py index adfe11e314..c56b708b82 100644 --- a/yt_dlp/extractor/theplatform.py +++ b/yt_dlp/extractor/theplatform.py @@ -238,7 +238,7 @@ def _real_extract(self, url): 'countries': smuggled_data.get('geo_countries'), }) - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) provider_id = mobj.group('provider_id') video_id = mobj.group('id') @@ -404,7 +404,7 @@ def _extract_feed_info(self, provider_id, feed_id, filter_query, video_id, custo return ret def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') provider_id = mobj.group('provider_id') diff --git a/yt_dlp/extractor/theweatherchannel.py b/yt_dlp/extractor/theweatherchannel.py index b2a8c3797e..9e506c9e02 100644 --- a/yt_dlp/extractor/theweatherchannel.py +++ b/yt_dlp/extractor/theweatherchannel.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .theplatform import ThePlatformIE from ..utils import ( @@ -33,7 +32,7 @@ class TheWeatherChannelIE(ThePlatformIE): }] def _real_extract(self, url): - asset_name, locale, display_id = re.match(self._VALID_URL, url).groups() + asset_name, locale, display_id = self._match_valid_url(url).groups() if not locale: locale = 'en-US' video_data = list(self._download_json( diff --git a/yt_dlp/extractor/thisav.py b/yt_dlp/extractor/thisav.py index dc3dd03c82..4af286e6d9 100644 --- a/yt_dlp/extractor/thisav.py +++ b/yt_dlp/extractor/thisav.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import remove_end @@ -34,7 +33,7 @@ class ThisAVIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/tinypic.py b/yt_dlp/extractor/tinypic.py index bc2def508c..39056e52e6 100644 --- a/yt_dlp/extractor/tinypic.py +++ b/yt_dlp/extractor/tinypic.py @@ -28,7 +28,7 @@ class TinyPicIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id, 'Downloading page') diff --git a/yt_dlp/extractor/tnaflix.py b/yt_dlp/extractor/tnaflix.py index b3573c6e07..d7617f7084 100644 --- a/yt_dlp/extractor/tnaflix.py +++ b/yt_dlp/extractor/tnaflix.py @@ -73,7 +73,7 @@ def get_child(elem, names): } for i in range(first, last + 1)] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') for display_id_key in ('display_id', 'display_id_2'): if display_id_key in mobj.groupdict(): diff --git a/yt_dlp/extractor/toongoggles.py b/yt_dlp/extractor/toongoggles.py index b5ba1c01d8..df13d64c0b 100644 --- a/yt_dlp/extractor/toongoggles.py +++ b/yt_dlp/extractor/toongoggles.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -63,7 +62,7 @@ def _parse_episode_data(self, episode_data): } def _real_extract(self, url): - show_id, episode_id = re.match(self._VALID_URL, url).groups() + show_id, episode_id = self._match_valid_url(url).groups() if episode_id: episode_data = self._call_api('search', episode_id, { 'filter': 'episode', diff --git a/yt_dlp/extractor/traileraddict.py b/yt_dlp/extractor/traileraddict.py index 747370d12d..10100fbcf3 100644 --- a/yt_dlp/extractor/traileraddict.py +++ b/yt_dlp/extractor/traileraddict.py @@ -20,7 +20,7 @@ class TrailerAddictIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) name = mobj.group('movie') + '/' + mobj.group('trailer_name') webpage = self._download_webpage(url, name) diff --git a/yt_dlp/extractor/trutv.py b/yt_dlp/extractor/trutv.py index ce892c8c50..c09ff897c1 100644 --- a/yt_dlp/extractor/trutv.py +++ b/yt_dlp/extractor/trutv.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .turner import TurnerBaseIE from ..utils import ( @@ -27,7 +26,7 @@ class TruTVIE(TurnerBaseIE): } def _real_extract(self, url): - series_slug, clip_slug, video_id = re.match(self._VALID_URL, url).groups() + series_slug, clip_slug, video_id = self._match_valid_url(url).groups() if video_id: path = 'episode' diff --git a/yt_dlp/extractor/tubitv.py b/yt_dlp/extractor/tubitv.py index 4b3ab4088f..2e9b325bae 100644 --- a/yt_dlp/extractor/tubitv.py +++ b/yt_dlp/extractor/tubitv.py @@ -141,5 +141,5 @@ def _entries(self, show_url, show_name): ie=TubiTvIE.ie_key(), video_id=episode_id) def _real_extract(self, url): - show_name = re.match(self._VALID_URL, url).group('show_name') + show_name = self._match_valid_url(url).group('show_name') return self.playlist_result(self._entries(url, show_name), playlist_id=show_name) diff --git a/yt_dlp/extractor/tumblr.py b/yt_dlp/extractor/tumblr.py index ae584ad697..adc3701275 100644 --- a/yt_dlp/extractor/tumblr.py +++ b/yt_dlp/extractor/tumblr.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -143,7 +142,7 @@ def _login(self): self.report_warning('Login has probably failed') def _real_extract(self, url): - m_url = re.match(self._VALID_URL, url) + m_url = self._match_valid_url(url) video_id = m_url.group('id') blog = m_url.group('blog_name') diff --git a/yt_dlp/extractor/turbo.py b/yt_dlp/extractor/turbo.py index be3eaa5c29..f6bbf2529e 100644 --- a/yt_dlp/extractor/turbo.py +++ b/yt_dlp/extractor/turbo.py @@ -30,7 +30,7 @@ class TurboIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/tv5unis.py b/yt_dlp/extractor/tv5unis.py index eabdc22716..398b85db56 100644 --- a/yt_dlp/extractor/tv5unis.py +++ b/yt_dlp/extractor/tv5unis.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -16,7 +15,7 @@ class TV5UnisBaseIE(InfoExtractor): _GEO_COUNTRIES = ['CA'] def _real_extract(self, url): - groups = re.match(self._VALID_URL, url).groups() + groups = self._match_valid_url(url).groups() product = self._download_json( 'https://api.tv5unis.ca/graphql', groups[0], query={ 'query': '''{ diff --git a/yt_dlp/extractor/tver.py b/yt_dlp/extractor/tver.py index a4a30b1e63..943b3ebdd2 100644 --- a/yt_dlp/extractor/tver.py +++ b/yt_dlp/extractor/tver.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -38,7 +37,7 @@ def _real_initialize(self): 'https://tver.jp/api/access_token.php', None)['token'] def _real_extract(self, url): - path, video_id = re.match(self._VALID_URL, url).groups() + path, video_id = self._match_valid_url(url).groups() main = self._download_json( 'https://api.tver.jp/v4/' + path, video_id, query={'token': self._TOKEN})['main'] diff --git a/yt_dlp/extractor/tvigle.py b/yt_dlp/extractor/tvigle.py index 180259abac..aa25ba0dc1 100644 --- a/yt_dlp/extractor/tvigle.py +++ b/yt_dlp/extractor/tvigle.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -54,7 +53,7 @@ class TvigleIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/tvnow.py b/yt_dlp/extractor/tvnow.py index fc87a69afe..b31818477e 100644 --- a/yt_dlp/extractor/tvnow.py +++ b/yt_dlp/extractor/tvnow.py @@ -169,7 +169,7 @@ def suitable(cls, url): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = '%s/%s' % mobj.group(2, 3) info = self._call_api( @@ -196,7 +196,7 @@ class TVNowNewIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) base_url = re.sub(r'(?:shows|serien)', '_', mobj.group('base_url')) show, episode = mobj.group('show', 'episode') return self.url_result( @@ -243,7 +243,7 @@ class TVNowFilmIE(TVNowBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('title') webpage = self._download_webpage(url, display_id, fatal=False) @@ -424,7 +424,7 @@ def url_repl(proto, suffix): } def _real_extract(self, url): - display_id, video_id = re.match(self._VALID_URL, url).groups() + display_id, video_id = self._match_valid_url(url).groups() info = self._call_api('player/' + video_id, video_id) return self._extract_video(info, video_id, display_id) @@ -466,7 +466,7 @@ class TVNowFilmIE(TVNowIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('title') webpage = self._download_webpage(url, display_id, fatal=False) @@ -552,7 +552,7 @@ class TVNowSeasonIE(TVNowListBaseIE): }] def _real_extract(self, url): - _, show_id, season_id = re.match(self._VALID_URL, url).groups() + _, show_id, season_id = self._match_valid_url(url).groups() return self._extract_items( url, show_id, season_id, {'season': season_id}) @@ -568,7 +568,7 @@ class TVNowAnnualIE(TVNowListBaseIE): }] def _real_extract(self, url): - _, show_id, year, month = re.match(self._VALID_URL, url).groups() + _, show_id, year, month = self._match_valid_url(url).groups() return self._extract_items( url, show_id, '%s-%s' % (year, month), { 'year': int(year), @@ -600,7 +600,7 @@ def suitable(cls, url): else super(TVNowShowIE, cls).suitable(url)) def _real_extract(self, url): - base_url, show_id = re.match(self._VALID_URL, url).groups() + base_url, show_id = self._match_valid_url(url).groups() result = self._call_api( 'teaserrow/format/navigation/' + show_id, show_id) diff --git a/yt_dlp/extractor/tvp.py b/yt_dlp/extractor/tvp.py index accff75b5b..1e42b33a4d 100644 --- a/yt_dlp/extractor/tvp.py +++ b/yt_dlp/extractor/tvp.py @@ -246,7 +246,7 @@ def _entries(self, display_id, playlist_id): video_id=video_id) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id, playlist_id = mobj.group('display_id', 'id') return self.playlist_result( self._entries(display_id, playlist_id), playlist_id) diff --git a/yt_dlp/extractor/tvplay.py b/yt_dlp/extractor/tvplay.py index 739c61cdd4..c60af111c7 100644 --- a/yt_dlp/extractor/tvplay.py +++ b/yt_dlp/extractor/tvplay.py @@ -381,7 +381,7 @@ def suitable(cls, url): return False if TVPlayIE.suitable(url) else super(ViafreeIE, cls).suitable(url) def _real_extract(self, url): - country, path = re.match(self._VALID_URL, url).groups() + country, path = self._match_valid_url(url).groups() content = self._download_json( 'https://viafree-content.mtg-api.com/viafree-content/v1/%s/path/%s' % (country, path), path) program = content['_embedded']['viafreeBlocks'][0]['_embedded']['program'] diff --git a/yt_dlp/extractor/twentyfourvideo.py b/yt_dlp/extractor/twentyfourvideo.py index 74d14049b4..ae19e11e1e 100644 --- a/yt_dlp/extractor/twentyfourvideo.py +++ b/yt_dlp/extractor/twentyfourvideo.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -68,7 +67,7 @@ class TwentyFourVideoIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') host = mobj.group('host') diff --git a/yt_dlp/extractor/twentythreevideo.py b/yt_dlp/extractor/twentythreevideo.py index dc56091925..e8cf5a1e96 100644 --- a/yt_dlp/extractor/twentythreevideo.py +++ b/yt_dlp/extractor/twentythreevideo.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import int_or_none @@ -27,7 +26,7 @@ class TwentyThreeVideoIE(InfoExtractor): }] def _real_extract(self, url): - domain, query, photo_id = re.match(self._VALID_URL, url).groups() + domain, query, photo_id = self._match_valid_url(url).groups() base_url = 'https://%s' % domain photo_data = self._download_json( base_url + '/api/photo/list?' + query, photo_id, query={ diff --git a/yt_dlp/extractor/twitcasting.py b/yt_dlp/extractor/twitcasting.py index 16584e940b..3acf1b1186 100644 --- a/yt_dlp/extractor/twitcasting.py +++ b/yt_dlp/extractor/twitcasting.py @@ -63,7 +63,7 @@ class TwitCastingIE(InfoExtractor): }] def _real_extract(self, url): - uploader_id, video_id = re.match(self._VALID_URL, url).groups() + uploader_id, video_id = self._match_valid_url(url).groups() video_password = self.get_param('videopassword') request_data = None diff --git a/yt_dlp/extractor/twitter.py b/yt_dlp/extractor/twitter.py index ae79ec6e00..485b781ca1 100644 --- a/yt_dlp/extractor/twitter.py +++ b/yt_dlp/extractor/twitter.py @@ -685,7 +685,7 @@ class TwitterShortenerIE(TwitterBaseIE): _BASE_URL = 'https://t.co/' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) eid, id = mobj.group('eid', 'id') if eid: id = eid diff --git a/yt_dlp/extractor/unistra.py b/yt_dlp/extractor/unistra.py index a724cdbef8..685d74f358 100644 --- a/yt_dlp/extractor/unistra.py +++ b/yt_dlp/extractor/unistra.py @@ -33,7 +33,7 @@ class UnistraIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/uplynk.py b/yt_dlp/extractor/uplynk.py index c0dba0a6ad..9adb96943e 100644 --- a/yt_dlp/extractor/uplynk.py +++ b/yt_dlp/extractor/uplynk.py @@ -61,7 +61,7 @@ class UplynkPreplayIE(UplynkIE): _TEST = None def _real_extract(self, url): - path, external_id, video_id = re.match(self._VALID_URL, url).groups() + path, external_id, video_id = self._match_valid_url(url).groups() display_id = video_id or external_id preplay = self._download_json(url, display_id) content_url = 'http://content.uplynk.com/%s.m3u8' % path diff --git a/yt_dlp/extractor/ustream.py b/yt_dlp/extractor/ustream.py index 1e29cbe224..8b758795f4 100644 --- a/yt_dlp/extractor/ustream.py +++ b/yt_dlp/extractor/ustream.py @@ -165,7 +165,7 @@ def resolve_dash_template(template, idx, chunk_hash): return formats def _real_extract(self, url): - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) video_id = m.group('id') # some sites use this embed format (see: https://github.com/ytdl-org/youtube-dl/issues/2990) @@ -258,7 +258,7 @@ class UstreamChannelIE(InfoExtractor): } def _real_extract(self, url): - m = re.match(self._VALID_URL, url) + m = self._match_valid_url(url) display_id = m.group('slug') webpage = self._download_webpage(url, display_id) channel_id = self._html_search_meta('ustream:channel_id', webpage) diff --git a/yt_dlp/extractor/ustudio.py b/yt_dlp/extractor/ustudio.py index 56509beedc..92509d1bf1 100644 --- a/yt_dlp/extractor/ustudio.py +++ b/yt_dlp/extractor/ustudio.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -29,7 +28,7 @@ class UstudioIE(InfoExtractor): } def _real_extract(self, url): - video_id, display_id = re.match(self._VALID_URL, url).groups() + video_id, display_id = self._match_valid_url(url).groups() config = self._download_xml( 'http://v1.ustudio.com/embed/%s/ustudio/config.xml' % video_id, @@ -83,7 +82,7 @@ class UstudioEmbedIE(InfoExtractor): } def _real_extract(self, url): - uploader_id, video_id = re.match(self._VALID_URL, url).groups() + uploader_id, video_id = self._match_valid_url(url).groups() video_data = self._download_json( 'http://app.ustudio.com/embed/%s/%s/config.json' % (uploader_id, video_id), video_id)['videos'][0] diff --git a/yt_dlp/extractor/vesti.py b/yt_dlp/extractor/vesti.py index 5ab7168808..002047dbf6 100644 --- a/yt_dlp/extractor/vesti.py +++ b/yt_dlp/extractor/vesti.py @@ -101,7 +101,7 @@ class VestiIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') page = self._download_webpage(url, video_id, 'Downloading page') diff --git a/yt_dlp/extractor/vevo.py b/yt_dlp/extractor/vevo.py index 1aec828bed..142ac8dc26 100644 --- a/yt_dlp/extractor/vevo.py +++ b/yt_dlp/extractor/vevo.py @@ -212,7 +212,7 @@ class VevoPlaylistIE(VevoBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) playlist_id = mobj.group('id') playlist_kind = mobj.group('kind') diff --git a/yt_dlp/extractor/vgtv.py b/yt_dlp/extractor/vgtv.py index 22e99e8f06..b6131ff828 100644 --- a/yt_dlp/extractor/vgtv.py +++ b/yt_dlp/extractor/vgtv.py @@ -165,7 +165,7 @@ class VGTVIE(XstreamIE): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') host = mobj.group('host') appname = self._HOST_TO_APPNAME[host] if host else mobj.group('appname') diff --git a/yt_dlp/extractor/vice.py b/yt_dlp/extractor/vice.py index e374995128..ca4d3edbd2 100644 --- a/yt_dlp/extractor/vice.py +++ b/yt_dlp/extractor/vice.py @@ -118,7 +118,7 @@ def _extract_url(webpage): return urls[0] if urls else None def _real_extract(self, url): - locale, video_id = re.match(self._VALID_URL, url).groups() + locale, video_id = self._match_valid_url(url).groups() video = self._call_api('videos', 'id', video_id, locale, '''body locked @@ -225,7 +225,7 @@ def _fetch_page(self, locale, show_id, page): video['url'], ViceIE.ie_key(), video.get('id')) def _real_extract(self, url): - locale, display_id = re.match(self._VALID_URL, url).groups() + locale, display_id = self._match_valid_url(url).groups() show = self._call_api('shows', 'slug', display_id, locale, '''dek id title''')[0] @@ -302,7 +302,7 @@ class ViceArticleIE(ViceBaseIE): }] def _real_extract(self, url): - locale, display_id = re.match(self._VALID_URL, url).groups() + locale, display_id = self._match_valid_url(url).groups() article = self._call_api('articles', 'slug', display_id, locale, '''body embed_code''')[0] diff --git a/yt_dlp/extractor/viddler.py b/yt_dlp/extractor/viddler.py index 642358433b..ecc48246f4 100644 --- a/yt_dlp/extractor/viddler.py +++ b/yt_dlp/extractor/viddler.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -75,7 +74,7 @@ class ViddlerIE(InfoExtractor): }] def _real_extract(self, url): - video_id, secret = re.match(self._VALID_URL, url).groups() + video_id, secret = self._match_valid_url(url).groups() query = { 'video_id': video_id, diff --git a/yt_dlp/extractor/videomore.py b/yt_dlp/extractor/videomore.py index 05ae74e333..baafdc15d0 100644 --- a/yt_dlp/extractor/videomore.py +++ b/yt_dlp/extractor/videomore.py @@ -144,7 +144,7 @@ def _extract_url(webpage): return mobj.group('url') def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('sid') or mobj.group('id') partner_id = mobj.group('partner_id') or compat_parse_qs(compat_urllib_parse_urlparse(url).query).get('partner_id', [None])[0] or '97' diff --git a/yt_dlp/extractor/vidio.py b/yt_dlp/extractor/vidio.py index b9ee67d20e..2f5ea5c0b4 100644 --- a/yt_dlp/extractor/vidio.py +++ b/yt_dlp/extractor/vidio.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -110,7 +109,7 @@ class VidioIE(VidioBaseIE): }] def _real_extract(self, url): - match = re.match(self._VALID_URL, url).groupdict() + match = self._match_valid_url(url).groupdict() video_id, display_id = match.get('id'), match.get('display_id') data = self._call_api('https://api.vidio.com/videos/' + video_id, display_id) video = data['videos'][0] @@ -194,7 +193,7 @@ def _playlist_entries(self, playlist_url, display_id): def _real_extract(self, url): url, idata = unsmuggle_url(url, {}) - playlist_id, display_id = re.match(self._VALID_URL, url).groups() + playlist_id, display_id = self._match_valid_url(url).groups() playlist_url = idata.get('url') if playlist_url: # Smuggled data contains an API URL. Download only that playlist @@ -236,7 +235,7 @@ class VidioLiveIE(VidioBaseIE): }] def _real_extract(self, url): - video_id, display_id = re.match(self._VALID_URL, url).groups() + video_id, display_id = self._match_valid_url(url).groups() stream_data = self._call_api( 'https://www.vidio.com/api/livestreamings/%s/detail' % video_id, display_id) stream_meta = stream_data['livestreamings'][0] diff --git a/yt_dlp/extractor/vier.py b/yt_dlp/extractor/vier.py index dbd5ba9bad..94aa350e78 100644 --- a/yt_dlp/extractor/vier.py +++ b/yt_dlp/extractor/vier.py @@ -135,7 +135,7 @@ def _login(self, site): self._logged_in = True def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) embed_id = mobj.group('embed_id') display_id = mobj.group('display_id') or embed_id video_id = mobj.group('id') or embed_id @@ -234,7 +234,7 @@ class VierVideosIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) program = mobj.group('program') site = mobj.group('site') diff --git a/yt_dlp/extractor/viewlift.py b/yt_dlp/extractor/viewlift.py index 55c2b95c24..c3b2e863d7 100644 --- a/yt_dlp/extractor/viewlift.py +++ b/yt_dlp/extractor/viewlift.py @@ -92,7 +92,7 @@ def _extract_url(webpage): return mobj.group('url') def _real_extract(self, url): - domain, film_id = re.match(self._VALID_URL, url).groups() + domain, film_id = self._match_valid_url(url).groups() site = domain.split('.')[-2] if site in self._SITE_MAP: site = self._SITE_MAP[site] @@ -229,7 +229,7 @@ def suitable(cls, url): return False if ViewLiftEmbedIE.suitable(url) else super(ViewLiftIE, cls).suitable(url) def _real_extract(self, url): - domain, path, display_id = re.match(self._VALID_URL, url).groups() + domain, path, display_id = self._match_valid_url(url).groups() site = domain.split('.')[-2] if site in self._SITE_MAP: site = self._SITE_MAP[site] diff --git a/yt_dlp/extractor/viidea.py b/yt_dlp/extractor/viidea.py index a0abbae60f..0da06818b5 100644 --- a/yt_dlp/extractor/viidea.py +++ b/yt_dlp/extractor/viidea.py @@ -117,7 +117,7 @@ class ViideaIE(InfoExtractor): }] def _real_extract(self, url): - lecture_slug, explicit_part_id = re.match(self._VALID_URL, url).groups() + lecture_slug, explicit_part_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, lecture_slug) diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py index 8ddd1d298e..5c09c8520c 100644 --- a/yt_dlp/extractor/vimeo.py +++ b/yt_dlp/extractor/vimeo.py @@ -672,7 +672,7 @@ def _real_extract(self, url): headers['Referer'] = url # Extract ID from URL - video_id, unlisted_hash = re.match(self._VALID_URL, url).groups() + video_id, unlisted_hash = self._match_valid_url(url).groups() if unlisted_hash: token = self._download_json( 'https://vimeo.com/_rv/jwt', video_id, headers={ @@ -1187,7 +1187,7 @@ def _real_initialize(self): self._login() def _real_extract(self, url): - page_url, video_id = re.match(self._VALID_URL, url).groups() + page_url, video_id = self._match_valid_url(url).groups() data = self._download_json( page_url.replace('/review/', '/review/data/'), video_id) if data.get('isLocked') is True: diff --git a/yt_dlp/extractor/vine.py b/yt_dlp/extractor/vine.py index 27373658a9..07fce0daa4 100644 --- a/yt_dlp/extractor/vine.py +++ b/yt_dlp/extractor/vine.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -133,7 +132,7 @@ def suitable(cls, url): return False if VineIE.suitable(url) else super(VineUserIE, cls).suitable(url) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) user = mobj.group('user') u = mobj.group('u') diff --git a/yt_dlp/extractor/viu.py b/yt_dlp/extractor/viu.py index b1e5f0af73..1b34c5296c 100644 --- a/yt_dlp/extractor/viu.py +++ b/yt_dlp/extractor/viu.py @@ -266,7 +266,7 @@ def _login(self, country_code, video_id): def _real_extract(self, url): url, idata = unsmuggle_url(url, {}) - country_code, lang_code, video_id = re.match(self._VALID_URL, url).groups() + country_code, lang_code, video_id = self._match_valid_url(url).groups() query = { 'r': 'vod/ajax-detail', diff --git a/yt_dlp/extractor/vk.py b/yt_dlp/extractor/vk.py index 6b3513ee0f..d8a9b9ab47 100644 --- a/yt_dlp/extractor/vk.py +++ b/yt_dlp/extractor/vk.py @@ -308,7 +308,7 @@ def _extract_sibnet_urls(webpage): webpage)] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('videoid') mv_data = {} @@ -538,7 +538,7 @@ def _fetch_page(self, page_id, section, page): 'http://vk.com/video' + video_id, VKIE.ie_key(), video_id) def _real_extract(self, url): - page_id, section = re.match(self._VALID_URL, url).groups() + page_id, section = self._match_valid_url(url).groups() if not section: section = 'all' diff --git a/yt_dlp/extractor/voicy.py b/yt_dlp/extractor/voicy.py index ae29c3de2d..11ebe76e13 100644 --- a/yt_dlp/extractor/voicy.py +++ b/yt_dlp/extractor/voicy.py @@ -11,7 +11,6 @@ unified_strdate, ) -import re import itertools @@ -81,7 +80,7 @@ class VoicyIE(VoicyBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) assert mobj voice_id = mobj.group('id') channel_id = mobj.group('channel_id') diff --git a/yt_dlp/extractor/vrt.py b/yt_dlp/extractor/vrt.py index 2b65d2e5f3..10dc94abcb 100644 --- a/yt_dlp/extractor/vrt.py +++ b/yt_dlp/extractor/vrt.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -52,7 +51,7 @@ class VRTIE(InfoExtractor): } def _real_extract(self, url): - site, display_id = re.match(self._VALID_URL, url).groups() + site, display_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, display_id) attrs = extract_attributes(self._search_regex( r'(<[^>]+class="vrtvideo( [^"]*)?"[^>]*>)', webpage, 'vrt video')) diff --git a/yt_dlp/extractor/vube.py b/yt_dlp/extractor/vube.py index c92b47e634..1c8f80ae9f 100644 --- a/yt_dlp/extractor/vube.py +++ b/yt_dlp/extractor/vube.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import ( @@ -98,7 +97,7 @@ class VubeIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') video = self._download_json( diff --git a/yt_dlp/extractor/vvvvid.py b/yt_dlp/extractor/vvvvid.py index bc196f8a0a..3faa90fbd6 100644 --- a/yt_dlp/extractor/vvvvid.py +++ b/yt_dlp/extractor/vvvvid.py @@ -98,7 +98,7 @@ def _extract_common_video_info(self, video_data): } def _real_extract(self, url): - show_id, season_id, video_id = re.match(self._VALID_URL, url).groups() + show_id, season_id, video_id = self._match_valid_url(url).groups() response = self._download_info( show_id, 'season/%s' % season_id, @@ -246,7 +246,7 @@ class VVVVIDShowIE(VVVVIDIE): }] def _real_extract(self, url): - base_url, show_id, show_title = re.match(self._VALID_URL, url).groups() + base_url, show_id, show_title = self._match_valid_url(url).groups() seasons = self._download_info( show_id, 'seasons/', show_title) diff --git a/yt_dlp/extractor/walla.py b/yt_dlp/extractor/walla.py index cbb5486724..00f081bcaa 100644 --- a/yt_dlp/extractor/walla.py +++ b/yt_dlp/extractor/walla.py @@ -34,7 +34,7 @@ class WallaIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/watchbox.py b/yt_dlp/extractor/watchbox.py index 5a4e46e73a..7469fe9624 100644 --- a/yt_dlp/extractor/watchbox.py +++ b/yt_dlp/extractor/watchbox.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..compat import compat_str @@ -63,7 +62,7 @@ class WatchBoxIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) kind, video_id = mobj.group('kind', 'id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/watchindianporn.py b/yt_dlp/extractor/watchindianporn.py index fadc539eef..a86819173f 100644 --- a/yt_dlp/extractor/watchindianporn.py +++ b/yt_dlp/extractor/watchindianporn.py @@ -27,7 +27,7 @@ class WatchIndianPornIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/wdr.py b/yt_dlp/extractor/wdr.py index 9658ecea78..f54aa6ff90 100644 --- a/yt_dlp/extractor/wdr.py +++ b/yt_dlp/extractor/wdr.py @@ -240,7 +240,7 @@ class WDRPageIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) display_id = mobj.group('display_id') webpage = self._download_webpage(url, display_id) @@ -342,7 +342,7 @@ class WDRMobileIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) return { 'id': mobj.group('id'), 'title': mobj.group('title'), diff --git a/yt_dlp/extractor/wimtv.py b/yt_dlp/extractor/wimtv.py index f32d0afc8c..ea953bf776 100644 --- a/yt_dlp/extractor/wimtv.py +++ b/yt_dlp/extractor/wimtv.py @@ -119,7 +119,7 @@ def _generate_thumbnail(self, thumb_id, width='720'): thumb_id, width) def _real_extract(self, url): - urlc = re.match(self._VALID_URL, url).groupdict() + urlc = self._match_valid_url(url).groupdict() video_id = urlc['id'] stream_type = is_live = None if urlc['type'] in {'live', 'cast'}: diff --git a/yt_dlp/extractor/xfileshare.py b/yt_dlp/extractor/xfileshare.py index df9efa9fae..cd97c77dc6 100644 --- a/yt_dlp/extractor/xfileshare.py +++ b/yt_dlp/extractor/xfileshare.py @@ -98,7 +98,7 @@ def _extract_urls(webpage): webpage)] def _real_extract(self, url): - host, video_id = re.match(self._VALID_URL, url).groups() + host, video_id = self._match_valid_url(url).groups() url = 'https://%s/' % host + ('embed-%s.html' % video_id if host in ('govid.me', 'vidlo.us') else video_id) webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/xhamster.py b/yt_dlp/extractor/xhamster.py index 1c93989868..7e33c420e4 100644 --- a/yt_dlp/extractor/xhamster.py +++ b/yt_dlp/extractor/xhamster.py @@ -120,7 +120,7 @@ class XHamsterIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') or mobj.group('id_2') display_id = mobj.group('display_id') or mobj.group('display_id_2') diff --git a/yt_dlp/extractor/ximalaya.py b/yt_dlp/extractor/ximalaya.py index a912e54b86..802d1bb1b4 100644 --- a/yt_dlp/extractor/ximalaya.py +++ b/yt_dlp/extractor/ximalaya.py @@ -198,7 +198,7 @@ class XimalayaAlbumIE(XimalayaBaseIE): def _real_extract(self, url): self.scheme = scheme = 'https' if url.startswith('https') else 'http' - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) uid, playlist_id = mobj.group('uid'), mobj.group('id') webpage = self._download_webpage(self._TEMPLATE_URL % (scheme, uid, playlist_id), playlist_id, diff --git a/yt_dlp/extractor/xstream.py b/yt_dlp/extractor/xstream.py index cd9c465e44..792843df58 100644 --- a/yt_dlp/extractor/xstream.py +++ b/yt_dlp/extractor/xstream.py @@ -112,7 +112,7 @@ def _extract_video_info(self, partner_id, video_id): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) partner_id = mobj.group('partner_id') video_id = mobj.group('id') diff --git a/yt_dlp/extractor/xtube.py b/yt_dlp/extractor/xtube.py index 682e45bef3..abd319188d 100644 --- a/yt_dlp/extractor/xtube.py +++ b/yt_dlp/extractor/xtube.py @@ -55,7 +55,7 @@ class XTubeIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/xxxymovies.py b/yt_dlp/extractor/xxxymovies.py index e34ebe3a66..0d536015cc 100644 --- a/yt_dlp/extractor/xxxymovies.py +++ b/yt_dlp/extractor/xxxymovies.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -29,7 +28,7 @@ class XXXYMoviesIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') diff --git a/yt_dlp/extractor/yahoo.py b/yt_dlp/extractor/yahoo.py index df1e078acd..741efefc89 100644 --- a/yt_dlp/extractor/yahoo.py +++ b/yt_dlp/extractor/yahoo.py @@ -279,7 +279,7 @@ def _extract_yahoo_video(self, video_id, country): } def _real_extract(self, url): - url, country, display_id = re.match(self._VALID_URL, url).groups() + url, country, display_id = self._match_valid_url(url).groups() if not country: country = 'us' else: @@ -527,7 +527,7 @@ def _extract_formats(self, json_data, content_id): return formats def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) host = mobj.group('host') display_id = mobj.group('id') or host diff --git a/yt_dlp/extractor/yandexdisk.py b/yt_dlp/extractor/yandexdisk.py index 6fcd8ee7e9..c15f3a4f32 100644 --- a/yt_dlp/extractor/yandexdisk.py +++ b/yt_dlp/extractor/yandexdisk.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..utils import ( @@ -57,7 +56,7 @@ class YandexDiskIE(InfoExtractor): }] def _real_extract(self, url): - domain, video_id = re.match(self._VALID_URL, url).groups() + domain, video_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, video_id) store = self._parse_json(self._search_regex( diff --git a/yt_dlp/extractor/yandexmusic.py b/yt_dlp/extractor/yandexmusic.py index c30c438f8b..a3558cc126 100644 --- a/yt_dlp/extractor/yandexmusic.py +++ b/yt_dlp/extractor/yandexmusic.py @@ -3,7 +3,6 @@ import hashlib import itertools -import re from .common import InfoExtractor from ..compat import compat_str @@ -109,7 +108,7 @@ class YandexMusicTrackIE(YandexMusicBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) tld, album_id, track_id = mobj.group('tld'), mobj.group('album_id'), mobj.group('id') track = self._call_api( @@ -291,7 +290,7 @@ def suitable(cls, url): return False if YandexMusicTrackIE.suitable(url) else super(YandexMusicAlbumIE, cls).suitable(url) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) tld = mobj.group('tld') album_id = mobj.group('id') @@ -342,7 +341,7 @@ class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) tld = mobj.group('tld') user = mobj.group('user') playlist_id = mobj.group('id') @@ -381,7 +380,7 @@ def _call_artist(self, tld, url, artist_id): }) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) tld = mobj.group('tld') artist_id = mobj.group('id') data = self._call_artist(tld, url, artist_id) @@ -410,7 +409,7 @@ class YandexMusicArtistTracksIE(YandexMusicArtistBaseIE): _ARTIST_WHAT = 'tracks' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) tld = mobj.group('tld') artist_id = mobj.group('id') data = self._call_artist(tld, url, artist_id) @@ -440,7 +439,7 @@ class YandexMusicArtistAlbumsIE(YandexMusicArtistBaseIE): _ARTIST_WHAT = 'albums' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) tld = mobj.group('tld') artist_id = mobj.group('id') data = self._call_artist(tld, url, artist_id) diff --git a/yt_dlp/extractor/youjizz.py b/yt_dlp/extractor/youjizz.py index 88aabd272c..5f5fbf21cf 100644 --- a/yt_dlp/extractor/youjizz.py +++ b/yt_dlp/extractor/youjizz.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -32,7 +31,7 @@ class YouJizzIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') or mobj.group('embed_id') webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/youporn.py b/yt_dlp/extractor/youporn.py index 7084d3d121..5feb568e72 100644 --- a/yt_dlp/extractor/youporn.py +++ b/yt_dlp/extractor/youporn.py @@ -74,7 +74,7 @@ def _extract_urls(webpage): webpage) def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 88a7e5b5d8..bf007273cb 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2088,8 +2088,7 @@ def extract_id(cls, url): mobj = re.match(cls._VALID_URL, url, re.VERBOSE) if mobj is None: raise ExtractorError('Invalid URL: %s' % url) - video_id = mobj.group(2) - return video_id + return mobj.group('id') def _extract_chapters_from_json(self, data, duration): chapter_list = traverse_obj( @@ -4452,7 +4451,7 @@ class YoutubeYtBeIE(InfoExtractor): }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') playlist_id = mobj.group('playlist_id') return self.url_result( diff --git a/yt_dlp/extractor/zapiks.py b/yt_dlp/extractor/zapiks.py index f6496f5168..161b011ab6 100644 --- a/yt_dlp/extractor/zapiks.py +++ b/yt_dlp/extractor/zapiks.py @@ -46,7 +46,7 @@ class ZapiksIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + mobj = self._match_valid_url(url) video_id = mobj.group('id') display_id = mobj.group('display_id') or video_id diff --git a/yt_dlp/extractor/zattoo.py b/yt_dlp/extractor/zattoo.py index 32dcc03b11..a13d124360 100644 --- a/yt_dlp/extractor/zattoo.py +++ b/yt_dlp/extractor/zattoo.py @@ -217,7 +217,7 @@ class QuicklineIE(QuicklineBaseIE): } def _real_extract(self, url): - channel_name, video_id = re.match(self._VALID_URL, url).groups() + channel_name, video_id = self._match_valid_url(url).groups() return self._extract_video(channel_name, video_id) @@ -262,7 +262,7 @@ class ZattooIE(ZattooBaseIE): }] def _real_extract(self, url): - channel_name, video_id, record_id = re.match(self._VALID_URL, url).groups() + channel_name, video_id, record_id = self._match_valid_url(url).groups() return self._extract_video(channel_name, video_id, record_id) diff --git a/yt_dlp/extractor/zee5.py b/yt_dlp/extractor/zee5.py index 7b08c77fc6..5366041674 100644 --- a/yt_dlp/extractor/zee5.py +++ b/yt_dlp/extractor/zee5.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json -import re from .common import InfoExtractor from ..compat import compat_str @@ -114,7 +113,7 @@ def _real_initialize(self): self._login() def _real_extract(self, url): - video_id, display_id = re.match(self._VALID_URL, url).group('id', 'display_id') + video_id, display_id = self._match_valid_url(url).group('id', 'display_id') access_token_request = self._download_json( 'https://useraction.zee5.com/token/platform_tokens.php?platform_name=web_app', video_id, note='Downloading access token') diff --git a/yt_dlp/extractor/zoom.py b/yt_dlp/extractor/zoom.py index 7accb6505c..25a0902f65 100644 --- a/yt_dlp/extractor/zoom.py +++ b/yt_dlp/extractor/zoom.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from ..utils import ( @@ -28,7 +27,7 @@ class ZoomIE(InfoExtractor): } def _real_extract(self, url): - base_url, play_id = re.match(self._VALID_URL, url).groups() + base_url, play_id = self._match_valid_url(url).groups() webpage = self._download_webpage(url, play_id) try: