From 5ad28e7ffd41deccba33776c1609aa7855601739 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 19 Aug 2021 07:11:24 +0530 Subject: [PATCH] [extractor] Common function `_match_valid_url` --- devscripts/make_lazy_extractors.py | 6 ++++-- yt_dlp/extractor/abcnews.py | 3 +-- yt_dlp/extractor/abcotvs.py | 3 +-- yt_dlp/extractor/acast.py | 3 +-- yt_dlp/extractor/adobetv.py | 6 +++--- yt_dlp/extractor/adultswim.py | 3 +-- yt_dlp/extractor/aenetworks.py | 7 +++---- yt_dlp/extractor/aljazeera.py | 3 +-- yt_dlp/extractor/alura.py | 3 +-- yt_dlp/extractor/amcnetworks.py | 2 +- yt_dlp/extractor/americastestkitchen.py | 5 ++--- yt_dlp/extractor/anvato.py | 2 +- yt_dlp/extractor/apa.py | 2 +- yt_dlp/extractor/appletrailers.py | 2 +- yt_dlp/extractor/arcpublishing.py | 2 +- yt_dlp/extractor/ard.py | 6 +++--- yt_dlp/extractor/arkena.py | 2 +- yt_dlp/extractor/arte.py | 4 ++-- yt_dlp/extractor/asiancrush.py | 4 ++-- yt_dlp/extractor/atresplayer.py | 3 +-- yt_dlp/extractor/audius.py | 5 ++--- yt_dlp/extractor/awaan.py | 5 ++--- yt_dlp/extractor/azmedien.py | 3 +-- yt_dlp/extractor/baidu.py | 3 +-- yt_dlp/extractor/bandcamp.py | 2 +- yt_dlp/extractor/beatport.py | 2 +- yt_dlp/extractor/behindkink.py | 3 +-- yt_dlp/extractor/bellmedia.py | 3 +-- yt_dlp/extractor/bilibili.py | 2 +- yt_dlp/extractor/blackboardcollaborate.py | 3 +-- yt_dlp/extractor/bokecc.py | 3 +-- yt_dlp/extractor/bongacams.py | 3 +-- yt_dlp/extractor/box.py | 3 +-- yt_dlp/extractor/br.py | 3 +-- yt_dlp/extractor/bravotv.py | 2 +- yt_dlp/extractor/breakcom.py | 3 +-- yt_dlp/extractor/brightcove.py | 4 ++-- yt_dlp/extractor/byutv.py | 3 +-- yt_dlp/extractor/c56.py | 3 +-- yt_dlp/extractor/canalplus.py | 3 +-- yt_dlp/extractor/canvas.py | 5 ++--- yt_dlp/extractor/cbsinteractive.py | 3 +-- yt_dlp/extractor/cbssports.py | 3 +-- yt_dlp/extractor/ccma.py | 3 +-- yt_dlp/extractor/channel9.py | 2 +- yt_dlp/extractor/chilloutzone.py | 3 +-- yt_dlp/extractor/cinemax.py | 3 +-- yt_dlp/extractor/cjsw.py | 3 +-- yt_dlp/extractor/cnbc.py | 3 +-- yt_dlp/extractor/cnn.py | 3 +-- yt_dlp/extractor/common.py | 17 ++++++++--------- yt_dlp/extractor/commonprotocols.py | 3 +-- yt_dlp/extractor/condenast.py | 2 +- yt_dlp/extractor/corus.py | 3 +-- yt_dlp/extractor/crunchyroll.py | 2 +- yt_dlp/extractor/cultureunplugged.py | 3 +-- yt_dlp/extractor/dailymotion.py | 2 +- yt_dlp/extractor/dbtv.py | 2 +- yt_dlp/extractor/deezer.py | 3 +-- yt_dlp/extractor/dfb.py | 3 +-- yt_dlp/extractor/digiteka.py | 2 +- yt_dlp/extractor/discovery.py | 3 +-- yt_dlp/extractor/discoverynetworks.py | 3 +-- yt_dlp/extractor/discoveryplusindia.py | 3 +-- yt_dlp/extractor/disney.py | 2 +- yt_dlp/extractor/dlive.py | 3 +-- yt_dlp/extractor/dplay.py | 3 +-- yt_dlp/extractor/drbonanza.py | 3 +-- yt_dlp/extractor/dropbox.py | 2 +- yt_dlp/extractor/drtuber.py | 2 +- yt_dlp/extractor/dtube.py | 3 +-- yt_dlp/extractor/duboku.py | 2 +- yt_dlp/extractor/eagleplatform.py | 2 +- yt_dlp/extractor/einthusan.py | 3 +-- yt_dlp/extractor/eporner.py | 3 +-- yt_dlp/extractor/everyonesmixtape.py | 3 +-- yt_dlp/extractor/fc2.py | 3 +-- yt_dlp/extractor/filmweb.py | 3 +-- yt_dlp/extractor/fivetv.py | 3 +-- yt_dlp/extractor/fourtube.py | 4 ++-- yt_dlp/extractor/foxnews.py | 2 +- yt_dlp/extractor/francetv.py | 5 ++--- yt_dlp/extractor/frontendmasters.py | 2 +- yt_dlp/extractor/funimation.py | 5 ++--- yt_dlp/extractor/funk.py | 3 +-- yt_dlp/extractor/gaia.py | 3 +-- yt_dlp/extractor/gamestar.py | 3 +-- yt_dlp/extractor/gaskrank.py | 2 +- yt_dlp/extractor/gazeta.py | 3 +-- yt_dlp/extractor/gdcvault.py | 2 +- yt_dlp/extractor/gedidigital.py | 2 +- yt_dlp/extractor/giantbomb.py | 3 +-- yt_dlp/extractor/go.py | 2 +- yt_dlp/extractor/godtube.py | 3 +-- yt_dlp/extractor/googlepodcasts.py | 3 +-- yt_dlp/extractor/hearthisat.py | 3 +-- yt_dlp/extractor/hidive.py | 3 +-- yt_dlp/extractor/hotstar.py | 2 +- yt_dlp/extractor/hrti.py | 5 ++--- yt_dlp/extractor/hungama.py | 6 +++--- yt_dlp/extractor/imggaming.py | 3 +-- yt_dlp/extractor/instagram.py | 2 +- yt_dlp/extractor/ivi.py | 2 +- yt_dlp/extractor/ivideon.py | 3 +-- yt_dlp/extractor/jeuxvideo.py | 3 +-- yt_dlp/extractor/jove.py | 3 +-- yt_dlp/extractor/kaltura.py | 2 +- yt_dlp/extractor/kanalplay.py | 3 +-- yt_dlp/extractor/keezmovies.py | 2 +- yt_dlp/extractor/kinja.py | 2 +- yt_dlp/extractor/kusi.py | 3 +-- yt_dlp/extractor/lecturio.py | 4 ++-- yt_dlp/extractor/lego.py | 3 +-- yt_dlp/extractor/libsyn.py | 3 +-- yt_dlp/extractor/line.py | 5 ++--- yt_dlp/extractor/linkedin.py | 2 +- yt_dlp/extractor/linuxacademy.py | 3 +-- yt_dlp/extractor/livestream.py | 6 +++--- yt_dlp/extractor/lnkgo.py | 3 +-- yt_dlp/extractor/localnews8.py | 3 +-- yt_dlp/extractor/lovehomeporn.py | 3 +-- yt_dlp/extractor/lrt.py | 3 +-- yt_dlp/extractor/lynda.py | 4 ++-- yt_dlp/extractor/mailru.py | 2 +- yt_dlp/extractor/mediasite.py | 6 +++--- yt_dlp/extractor/metacafe.py | 2 +- yt_dlp/extractor/metacritic.py | 2 +- yt_dlp/extractor/mgoon.py | 3 +-- yt_dlp/extractor/microsoftvirtualacademy.py | 4 ++-- yt_dlp/extractor/mildom.py | 3 +-- yt_dlp/extractor/minoto.py | 3 +-- yt_dlp/extractor/mit.py | 2 +- yt_dlp/extractor/mixcloud.py | 5 ++--- yt_dlp/extractor/moevideo.py | 3 +-- yt_dlp/extractor/mojvideo.py | 3 +-- yt_dlp/extractor/morningstar.py | 3 +-- yt_dlp/extractor/moviezine.py | 3 +-- yt_dlp/extractor/msn.py | 2 +- yt_dlp/extractor/mtv.py | 4 ++-- yt_dlp/extractor/mxplayer.py | 5 ++--- yt_dlp/extractor/mychannels.py | 3 +-- yt_dlp/extractor/myspace.py | 4 ++-- yt_dlp/extractor/nba.py | 2 +- yt_dlp/extractor/nbc.py | 2 +- yt_dlp/extractor/ndr.py | 5 ++--- yt_dlp/extractor/netzkino.py | 3 +-- yt_dlp/extractor/nexx.py | 2 +- yt_dlp/extractor/nhk.py | 5 ++--- yt_dlp/extractor/nhl.py | 3 +-- yt_dlp/extractor/nick.py | 5 ++--- yt_dlp/extractor/ninecninemedia.py | 3 +-- yt_dlp/extractor/nitter.py | 2 +- yt_dlp/extractor/nova.py | 2 +- yt_dlp/extractor/nrk.py | 6 +++--- yt_dlp/extractor/onet.py | 2 +- yt_dlp/extractor/ooyala.py | 2 +- yt_dlp/extractor/orf.py | 2 +- yt_dlp/extractor/packtpub.py | 5 ++--- yt_dlp/extractor/palcomp3.py | 5 ++--- yt_dlp/extractor/pandoratv.py | 3 +-- yt_dlp/extractor/pbs.py | 2 +- yt_dlp/extractor/peertube.py | 2 +- yt_dlp/extractor/performgroup.py | 3 +-- yt_dlp/extractor/photobucket.py | 3 +-- yt_dlp/extractor/piksel.py | 2 +- yt_dlp/extractor/pinterest.py | 3 +-- yt_dlp/extractor/playfm.py | 3 +-- yt_dlp/extractor/playplustv.py | 3 +-- yt_dlp/extractor/playwire.py | 3 +-- yt_dlp/extractor/podomatic.py | 3 +-- yt_dlp/extractor/pokemon.py | 3 +-- yt_dlp/extractor/popcorntimes.py | 3 +-- yt_dlp/extractor/popcorntv.py | 3 +-- yt_dlp/extractor/porncom.py | 2 +- yt_dlp/extractor/pornhd.py | 3 +-- yt_dlp/extractor/pornhub.py | 8 ++++---- yt_dlp/extractor/pornovoisines.py | 3 +-- yt_dlp/extractor/pornoxo.py | 3 +-- yt_dlp/extractor/presstv.py | 3 +-- yt_dlp/extractor/pyvideo.py | 2 +- yt_dlp/extractor/radiocanada.py | 3 +-- yt_dlp/extractor/radiofrance.py | 2 +- yt_dlp/extractor/rai.py | 4 ++-- yt_dlp/extractor/raywenderlich.py | 2 +- yt_dlp/extractor/rbmaradio.py | 3 +-- yt_dlp/extractor/rcs.py | 4 ++-- yt_dlp/extractor/rcti.py | 7 +++---- yt_dlp/extractor/redbulltv.py | 5 ++--- yt_dlp/extractor/reddit.py | 3 +-- yt_dlp/extractor/rice.py | 2 +- yt_dlp/extractor/rmcdecouverte.py | 3 +-- yt_dlp/extractor/roxwel.py | 3 +-- yt_dlp/extractor/rtbf.py | 2 +- yt_dlp/extractor/rtl2.py | 2 +- yt_dlp/extractor/rts.py | 2 +- yt_dlp/extractor/rtve.py | 3 +-- yt_dlp/extractor/rutv.py | 2 +- yt_dlp/extractor/safari.py | 4 ++-- yt_dlp/extractor/sapo.py | 2 +- yt_dlp/extractor/savefrom.py | 3 +-- yt_dlp/extractor/scrippsnetworks.py | 5 ++--- yt_dlp/extractor/seeker.py | 2 +- yt_dlp/extractor/senateisvp.py | 2 +- yt_dlp/extractor/sevenplus.py | 2 +- yt_dlp/extractor/shahid.py | 2 +- yt_dlp/extractor/simplecast.py | 2 +- yt_dlp/extractor/sina.py | 3 +-- yt_dlp/extractor/sixplay.py | 3 +-- yt_dlp/extractor/slideshare.py | 3 +-- yt_dlp/extractor/snotr.py | 3 +-- yt_dlp/extractor/sohu.py | 2 +- yt_dlp/extractor/soundcloud.py | 8 ++++---- yt_dlp/extractor/soundgasm.py | 2 +- yt_dlp/extractor/spankbang.py | 4 ++-- yt_dlp/extractor/sport5.py | 3 +-- yt_dlp/extractor/springboardplatform.py | 2 +- yt_dlp/extractor/srgssr.py | 5 ++--- yt_dlp/extractor/stanfordoc.py | 2 +- yt_dlp/extractor/steam.py | 2 +- yt_dlp/extractor/stv.py | 3 +-- yt_dlp/extractor/svt.py | 8 ++++---- yt_dlp/extractor/tagesschau.py | 4 ++-- yt_dlp/extractor/tbs.py | 2 +- yt_dlp/extractor/teachable.py | 4 ++-- yt_dlp/extractor/teachertube.py | 2 +- yt_dlp/extractor/techtalks.py | 2 +- yt_dlp/extractor/telemb.py | 2 +- yt_dlp/extractor/testurl.py | 2 +- yt_dlp/extractor/tf1.py | 3 +-- yt_dlp/extractor/theplatform.py | 4 ++-- yt_dlp/extractor/theweatherchannel.py | 3 +-- yt_dlp/extractor/thisav.py | 3 +-- yt_dlp/extractor/tinypic.py | 2 +- yt_dlp/extractor/tnaflix.py | 2 +- yt_dlp/extractor/toongoggles.py | 3 +-- yt_dlp/extractor/traileraddict.py | 2 +- yt_dlp/extractor/trutv.py | 3 +-- yt_dlp/extractor/tubitv.py | 2 +- yt_dlp/extractor/tumblr.py | 3 +-- yt_dlp/extractor/turbo.py | 2 +- yt_dlp/extractor/tv5unis.py | 3 +-- yt_dlp/extractor/tver.py | 3 +-- yt_dlp/extractor/tvigle.py | 3 +-- yt_dlp/extractor/tvnow.py | 16 ++++++++-------- yt_dlp/extractor/tvp.py | 2 +- yt_dlp/extractor/tvplay.py | 2 +- yt_dlp/extractor/twentyfourvideo.py | 3 +-- yt_dlp/extractor/twentythreevideo.py | 3 +-- yt_dlp/extractor/twitcasting.py | 2 +- yt_dlp/extractor/twitter.py | 2 +- yt_dlp/extractor/unistra.py | 2 +- yt_dlp/extractor/uplynk.py | 2 +- yt_dlp/extractor/ustream.py | 4 ++-- yt_dlp/extractor/ustudio.py | 5 ++--- yt_dlp/extractor/vesti.py | 2 +- yt_dlp/extractor/vevo.py | 2 +- yt_dlp/extractor/vgtv.py | 2 +- yt_dlp/extractor/vice.py | 6 +++--- yt_dlp/extractor/viddler.py | 3 +-- yt_dlp/extractor/videomore.py | 2 +- yt_dlp/extractor/vidio.py | 7 +++---- yt_dlp/extractor/vier.py | 4 ++-- yt_dlp/extractor/viewlift.py | 4 ++-- yt_dlp/extractor/viidea.py | 2 +- yt_dlp/extractor/vimeo.py | 4 ++-- yt_dlp/extractor/vine.py | 3 +-- yt_dlp/extractor/viu.py | 2 +- yt_dlp/extractor/vk.py | 4 ++-- yt_dlp/extractor/voicy.py | 3 +-- yt_dlp/extractor/vrt.py | 3 +-- yt_dlp/extractor/vube.py | 3 +-- yt_dlp/extractor/vvvvid.py | 4 ++-- yt_dlp/extractor/walla.py | 2 +- yt_dlp/extractor/watchbox.py | 3 +-- yt_dlp/extractor/watchindianporn.py | 2 +- yt_dlp/extractor/wdr.py | 4 ++-- yt_dlp/extractor/wimtv.py | 2 +- yt_dlp/extractor/xfileshare.py | 2 +- yt_dlp/extractor/xhamster.py | 2 +- yt_dlp/extractor/ximalaya.py | 2 +- yt_dlp/extractor/xstream.py | 2 +- yt_dlp/extractor/xtube.py | 2 +- yt_dlp/extractor/xxxymovies.py | 3 +-- yt_dlp/extractor/yahoo.py | 4 ++-- yt_dlp/extractor/yandexdisk.py | 3 +-- yt_dlp/extractor/yandexmusic.py | 13 ++++++------- yt_dlp/extractor/youjizz.py | 3 +-- yt_dlp/extractor/youporn.py | 2 +- yt_dlp/extractor/youtube.py | 5 ++--- yt_dlp/extractor/zapiks.py | 2 +- yt_dlp/extractor/zattoo.py | 4 ++-- yt_dlp/extractor/zee5.py | 3 +-- yt_dlp/extractor/zoom.py | 3 +-- 293 files changed, 389 insertions(+), 541 deletions(-) diff --git a/devscripts/make_lazy_extractors.py b/devscripts/make_lazy_extractors.py index 6550244f2..727d28204 100644 --- a/devscripts/make_lazy_extractors.py +++ b/devscripts/make_lazy_extractors.py @@ -31,8 +31,10 @@ with open('devscripts/lazy_load_template.py', 'rt') as f: 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 908c83377..296b8cec1 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 0bc69a64f..5bff46634 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 b9355a2c8..63587c5cf 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 bccdf9ca4..12b819206 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 @@ class AdobeTVChannelIE(AdobeTVPlaylistBaseIE): 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 8d1d9ac7d..c97cfc161 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 2a1f08e39..8025de5a3 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 @@ class AENetworksListBaseIE(AENetworksBaseIE): }))['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 c4f915a3c..93f95dd46 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 2681bfc18..f5325de2f 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 1f16d3a33..e38e215d3 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 be960c0f9..6e6099a03 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 7386ae2e6..d688e2c5b 100644 --- a/yt_dlp/extractor/anvato.py +++ b/yt_dlp/extractor/anvato.py @@ -390,7 +390,7 @@ class AnvatoIE(InfoExtractor): '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 cbc1c0ecb..1736cdf56 100644 --- a/yt_dlp/extractor/apa.py +++ b/yt_dlp/extractor/apa.py @@ -42,7 +42,7 @@ class APAIE(InfoExtractor): 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 d3d77a1d0..8140e332b 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 fd2c795ae..5a9b8181a 100644 --- a/yt_dlp/extractor/arcpublishing.py +++ b/yt_dlp/extractor/arcpublishing.py @@ -86,7 +86,7 @@ class ArcPublishingIE(InfoExtractor): 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 8d9339e4d..048d30f27 100644 --- a/yt_dlp/extractor/ard.py +++ b/yt_dlp/extractor/ard.py @@ -199,7 +199,7 @@ class ARDMediathekIE(ARDMediathekBaseIE): 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 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE): 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 fd46b1c77..7b1886141 100644 --- a/yt_dlp/extractor/arkena.py +++ b/yt_dlp/extractor/arkena.py @@ -63,7 +63,7 @@ class ArkenaIE(InfoExtractor): 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 5b38b20dd..c163db9c9 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 66ce7c686..75a632958 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 @@ class AsianCrushPlaylistIE(AsianCrushBaseIE): 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 4afde8f90..8143eb4d7 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 @@ class AtresPlayerIE(InfoExtractor): 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 b4b718790..fa64995d5 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 @@ class AudiusPlaylistIE(AudiusBaseIE): 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 822136dfb..22cc10d98 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 930266990..fee640e14 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 234a661d3..364fd9459 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 @@ class BaiduVideoIE(InfoExtractor): 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 07ceaa0fe..b664145a1 100644 --- a/yt_dlp/extractor/bandcamp.py +++ b/yt_dlp/extractor/bandcamp.py @@ -294,7 +294,7 @@ class BandcampAlbumIE(BandcampIE): 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 ae9c1a739..e1cf8b4fe 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 9bca853b3..2c97f9817 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 9f9de96c6..904c17ed0 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 743fc501e..8aab6a01b 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -144,7 +144,7 @@ class BiliBiliIE(InfoExtractor): 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 95d581c1c..8ae294198 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 14840bd28..6a89d36f4 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 180542fbc..9e7551136 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 aae82d1af..8214086a6 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 a3bc3a10a..7169eceb6 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 e4758baca..139d51c09 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 68c7cf2bb..f38789f99 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 9f643a9e7..31606d3bd 100644 --- a/yt_dlp/extractor/brightcove.py +++ b/yt_dlp/extractor/brightcove.py @@ -290,7 +290,7 @@ class BrightcoveLegacyIE(InfoExtractor): 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 @@ class BrightcoveNewIE(AdobePassIE): '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 7c6c826d7..f4d5086ed 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 cac8fdcba..a853c530c 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 1132ce4a7..211ea267a 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 4688187d9..b417f8577 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 6596e98a6..9d4f75435 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 a891c9a55..b8a6e5967 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 e6ae49352..ea98f8688 100644 --- a/yt_dlp/extractor/ccma.py +++ b/yt_dlp/extractor/ccma.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals 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 258e96ca6..90024dbba 100644 --- a/yt_dlp/extractor/channel9.py +++ b/yt_dlp/extractor/channel9.py @@ -96,7 +96,7 @@ class Channel9IE(InfoExtractor): 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 5aac21299..fd5202b9e 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 7f89d33de..2c3ff8d4f 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 505bdbe16..1dea0d7c7 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 7b9f4536a..da3730cc8 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 2d950fa05..af11d95b4 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 @@ class CNNIE(TurnerBaseIE): 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 8c2566dc5..31356111b 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -447,23 +447,22 @@ class InfoExtractor(object): 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 1fc7779b8..3708c6ad2 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 d5e77af32..54e7af8b0 100644 --- a/yt_dlp/extractor/condenast.py +++ b/yt_dlp/extractor/condenast.py @@ -222,7 +222,7 @@ class CondeNastIE(InfoExtractor): } 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 de61f42e4..8f2706736 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 091e15e8d..256c6943f 100644 --- a/yt_dlp/extractor/crunchyroll.py +++ b/yt_dlp/extractor/crunchyroll.py @@ -413,7 +413,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text 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 bcdf27323..9002e4cef 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 633d39adc..e04e10b86 100644 --- a/yt_dlp/extractor/dailymotion.py +++ b/yt_dlp/extractor/dailymotion.py @@ -204,7 +204,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor): 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 aaedf2e3d..8e73176a6 100644 --- a/yt_dlp/extractor/dbtv.py +++ b/yt_dlp/extractor/dbtv.py @@ -38,7 +38,7 @@ class DBTVIE(InfoExtractor): 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 3f6e007fc..7ba02e552 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 @@ class DeezerBaseInfoExtractor(InfoExtractor): 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 a4d0448c2..97f70fc7b 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 3dfde0d8c..d63204778 100644 --- a/yt_dlp/extractor/digiteka.py +++ b/yt_dlp/extractor/digiteka.py @@ -70,7 +70,7 @@ class DigitekaIE(InfoExtractor): 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 e0139cc86..fd3ad75c7 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 c512b95d0..f43c87160 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 4f2f4f731..51801402c 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 @@ class DiscoveryPlusIndiaShowIE(InfoExtractor): 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 e1ae62ac6..f018cbe9d 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 d95c67a5b..90462c0ab 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 38b08d280..fcc4ce4dc 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 @@ class DPlayIE(InfoExtractor): } 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 164e97c36..ea0f06d3d 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 14b6c00b0..6a7d050aa 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 2baea585b..540b86a16 100644 --- a/yt_dlp/extractor/drtuber.py +++ b/yt_dlp/extractor/drtuber.py @@ -42,7 +42,7 @@ class DrTuberIE(InfoExtractor): 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 114d2dbe3..ad247b7dd 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 fdc695bf4..a87597873 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 36fef07b7..f86731a0c 100644 --- a/yt_dlp/extractor/eagleplatform.py +++ b/yt_dlp/extractor/eagleplatform.py @@ -123,7 +123,7 @@ class EaglePlatformIE(InfoExtractor): 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 4e0f8bc81..7af279a53 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 @@ class EinthusanIE(InfoExtractor): )).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 bfecd3a41..25a0d9799 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 84a9b750e..80cb032be 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 435561147..4d85e62fe 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 56000bc5b..5e323b4f8 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 c4c0f1b3d..be81fccb8 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 be4e81342..d4d955b6b 100644 --- a/yt_dlp/extractor/fourtube.py +++ b/yt_dlp/extractor/fourtube.py @@ -41,7 +41,7 @@ class FourTubeBaseIE(InfoExtractor): 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 63613cb85..18fa0a5ef 100644 --- a/yt_dlp/extractor/foxnews.py +++ b/yt_dlp/extractor/foxnews.py @@ -67,7 +67,7 @@ class FoxNewsIE(AMPIE): 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 ee8a22f9d..202141497 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 @@ class FranceTVIE(InfoExtractor): } 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 f1db33fb1..40b8cb0b4 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 4c61d126b..4d95f1c7c 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 81d1949fd..e5e32608f 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 e9527758f..7821fb783 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 @@ class GaiaIE(InfoExtractor): 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 f00dab2f3..e882fa671 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 1726a6704..03acd2a73 100644 --- a/yt_dlp/extractor/gaskrank.py +++ b/yt_dlp/extractor/gaskrank.py @@ -51,7 +51,7 @@ class GaskrankIE(InfoExtractor): 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 57c67a451..367187080 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 acc6478b8..c3ad6b4ce 100644 --- a/yt_dlp/extractor/gdcvault.py +++ b/yt_dlp/extractor/gdcvault.py @@ -149,7 +149,7 @@ class GDCVaultIE(InfoExtractor): 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 ef9e03e67..ec386c218 100644 --- a/yt_dlp/extractor/gedidigital.py +++ b/yt_dlp/extractor/gedidigital.py @@ -143,7 +143,7 @@ class GediDigitalIE(InfoExtractor): 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 c6477958d..1920923fc 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 7dcdc864f..2ccc6df21 100644 --- a/yt_dlp/extractor/go.py +++ b/yt_dlp/extractor/go.py @@ -161,7 +161,7 @@ class GoIE(AdobePassIE): 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 92efd16b3..96e68b4d2 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 31ad79907..25631e213 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 59043164d..a3d6a055f 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 f26f80265..a5aa0853c 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 @@ class HiDiveIE(InfoExtractor): 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 60fe25eed..e00e58646 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 23f7b1fc9..dc5b9670c 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 c33e387e7..821b16e5d 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 1e43ec95b..ef20a4b9e 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 @@ class ImgGamingBaseIE(InfoExtractor): 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 27deb0af0..9aad804cf 100644 --- a/yt_dlp/extractor/instagram.py +++ b/yt_dlp/extractor/instagram.py @@ -141,7 +141,7 @@ class InstagramIE(InfoExtractor): 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 c167ee500..5e1d89c9b 100644 --- a/yt_dlp/extractor/ivi.py +++ b/yt_dlp/extractor/ivi.py @@ -245,7 +245,7 @@ class IviCompilationIE(InfoExtractor): 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 3ca824f79..01e7b22d4 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 e9f4ed738..77c0f520c 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 27e0e37f6..4b7dfc526 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 4ab0567a5..c8f60ef45 100644 --- a/yt_dlp/extractor/kaltura.py +++ b/yt_dlp/extractor/kaltura.py @@ -229,7 +229,7 @@ class KalturaIE(InfoExtractor): 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 6c3498c67..5e24f7e21 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 @@ class KanalPlayIE(InfoExtractor): 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 cfdd0eb8e..027f43cf0 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 79e3026d2..1be8b4809 100644 --- a/yt_dlp/extractor/kinja.py +++ b/yt_dlp/extractor/kinja.py @@ -129,7 +129,7 @@ class KinjaEmbedIE(InfoExtractor): 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 9833d35eb..707fe1821 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 1b2dcef46..9d2228700 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 1e3c19dfd..b9d8b167c 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 2cf444258..d1fcda4ef 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 41ac8d422..d4bcae6c1 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 e1dca4899..6d54d638a 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 f222a6b2c..2053970d1 100644 --- a/yt_dlp/extractor/linuxacademy.py +++ b/yt_dlp/extractor/linuxacademy.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import json import random -import re from .common import InfoExtractor from ..compat import ( @@ -162,7 +161,7 @@ class LinuxAcademyIE(InfoExtractor): % 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 036b39023..f591289ec 100644 --- a/yt_dlp/extractor/livestream.py +++ b/yt_dlp/extractor/livestream.py @@ -212,7 +212,7 @@ class LivestreamIE(InfoExtractor): 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 @@ class LivestreamOriginalIE(InfoExtractor): 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 3e71852aa..14675968e 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 aad396135..c3e9d10fa 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 8f65a3c03..ca4b5f375 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 89d549858..4024aef73 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 @@ class LRTIE(InfoExtractor): 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 06662be1a..58cf17239 100644 --- a/yt_dlp/extractor/lynda.py +++ b/yt_dlp/extractor/lynda.py @@ -128,7 +128,7 @@ class LyndaIE(LyndaBaseIE): '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 5bfe40649..5d9f80bb3 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 c62233ab7..ace86c2fd 100644 --- a/yt_dlp/extractor/mediasite.py +++ b/yt_dlp/extractor/mediasite.py @@ -170,7 +170,7 @@ class MediasiteIE(InfoExtractor): 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 6366028d2..7b2d4a003 100644 --- a/yt_dlp/extractor/metacafe.py +++ b/yt_dlp/extractor/metacafe.py @@ -130,7 +130,7 @@ class MetacafeIE(InfoExtractor): 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 7d468d78b..1424288e7 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 7bb473900..184c311be 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 8e0aee0e6..46abd2a6d 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 @@ class MicrosoftVirtualAcademyCourseIE(MicrosoftVirtualAcademyBaseIE): 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 939a072ec..c147cbbf6 100644 --- a/yt_dlp/extractor/mildom.py +++ b/yt_dlp/extractor/mildom.py @@ -5,7 +5,6 @@ import base64 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 636731195..dba82db5f 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 e1506a745..60e456978 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 b8ccd0ab4..a0c043d4b 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 @@ class MixcloudIE(MixcloudBaseIE): 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 @@ class MixcloudPlaylistBaseIE(MixcloudBaseIE): 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 eb9b4ce7c..a3f1b3866 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 165e658c9..0421f3f44 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 0093bcd6c..71a22a614 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 85cc6e22f..730da4bd7 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 9ce90a928..f34e2102c 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 303f71cf8..e446a955b 100644 --- a/yt_dlp/extractor/mtv.py +++ b/yt_dlp/extractor/mtv.py @@ -355,7 +355,7 @@ class MTVServicesEmbeddedIE(MTVServicesInfoExtractor): 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 @@ class MTVVideoIE(MTVServicesInfoExtractor): 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 0bad51d15..0f1c439aa 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 @@ class MxplayerIE(InfoExtractor): 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 @@ class MxplayerShowIE(InfoExtractor): 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 b1ffe7848..d820d4eb8 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 c3bf69091..4227d4248 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 366e5d645..3c678c50d 100644 --- a/yt_dlp/extractor/nba.py +++ b/yt_dlp/extractor/nba.py @@ -337,7 +337,7 @@ class NBABaseIE(NBACVPBaseIE): 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 5ebb1c869..f304f191a 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 81abb3120..45aa106c8 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 @@ from ..utils import ( 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 3d1a06d0b..4ad0d8e96 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 586c1b7eb..860d636e2 100644 --- a/yt_dlp/extractor/nexx.py +++ b/yt_dlp/extractor/nexx.py @@ -289,7 +289,7 @@ class NexxIE(InfoExtractor): 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 8a9331a79..950a3d0d4 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 @@ class NhkBaseIE(InfoExtractor): 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 eddfe1f37..d3a5e17e9 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 @@ from ..utils import ( 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 60e6e7315..084538d71 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 @@ class NickIE(MTVServicesInfoExtractor): 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 71fde114c..d1281167a 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 bc80d44c3..a0546cda0 100644 --- a/yt_dlp/extractor/nitter.py +++ b/yt_dlp/extractor/nitter.py @@ -173,7 +173,7 @@ class NitterIE(InfoExtractor): 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 47b9748f0..fdf604d2a 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 6d01a25c3..b556bc6aa 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 @@ class NRKTVSeasonIE(NRKTVSerieBaseIE): 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 @@ class NRKTVSeriesIE(NRKTVSerieBaseIE): 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 219ac349e..bf53ea0b0 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 7204dfecd..20cfa0a87 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 8d537d7ae..428ec97e4 100644 --- a/yt_dlp/extractor/orf.py +++ b/yt_dlp/extractor/orf.py @@ -183,7 +183,7 @@ class ORFTVthekIE(InfoExtractor): 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 11ad3b3b8..c06fca795 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 @@ class PacktPubIE(PacktPubBaseIE): 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 @@ class PacktPubCourseIE(PacktPubBaseIE): 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 fb29d83f9..269e67a57 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 @@ class PalcoMP3BaseIE(InfoExtractor): 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 538738c09..44b462beb 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 d4baa16ee..d68855d62 100644 --- a/yt_dlp/extractor/pbs.py +++ b/yt_dlp/extractor/pbs.py @@ -436,7 +436,7 @@ class PBSIE(InfoExtractor): 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 d1a9d696d..6fe53dcf8 100644 --- a/yt_dlp/extractor/peertube.py +++ b/yt_dlp/extractor/peertube.py @@ -529,7 +529,7 @@ class PeerTubeIE(InfoExtractor): 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 26942bfb3..c00d39375 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 @@ class PerformGroupIE(InfoExtractor): }) 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 6c8bbe1d9..53aebe2d9 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 ecf56ff8f..a362664b2 100644 --- a/yt_dlp/extractor/piksel.py +++ b/yt_dlp/extractor/piksel.py @@ -85,7 +85,7 @@ class PikselIE(InfoExtractor): 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 09aeea340..80e9cd00e 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 @@ class PinterestCollectionIE(PinterestBaseIE): 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 e766ccca3..4298cbe30 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 1e30ab23a..fd72a3717 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 @@ class PlayPlusTVIE(InfoExtractor): 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 4d96a10a7..9c9e597b5 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 e782e3f1f..673a3ab94 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 8750e0e0d..402b574a7 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 7bf7f9858..5f9d0e720 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 9f834fb6c..66d2e5094 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 5726cab3a..83df22141 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 c6052ac9f..9dbd72f1d 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 c2b20ecfd..6d894affd 100644 --- a/yt_dlp/extractor/pornhub.py +++ b/yt_dlp/extractor/pornhub.py @@ -262,7 +262,7 @@ class PornHubIE(PornHubBaseIE): 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 @@ class PornHubPagedPlaylistBaseIE(PornHubPlaylistBaseIE): 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 @@ class PornHubPlaylistIE(PornHubPlaylistBaseIE): 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 b6b71069d..18459fc94 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 2831368b6..489dc2b25 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 b5c279203..bfb2eb71e 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 b8ac93a62..869619723 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 a28b1a24c..4b4445c30 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 @@ class RadioCanadaIE(InfoExtractor): } 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 2b5fea945..082238bbc 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 199253c4a..9f5bed4c4 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 5411ece21..f04d51f7b 100644 --- a/yt_dlp/extractor/raywenderlich.py +++ b/yt_dlp/extractor/raywenderlich.py @@ -72,7 +72,7 @@ class RayWenderlichIE(InfoExtractor): 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 ae7413fb5..9642fbbe1 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 7ee351c60..ace611bc9 100644 --- a/yt_dlp/extractor/rcs.py +++ b/yt_dlp/extractor/rcs.py @@ -203,8 +203,8 @@ class RCSBaseIE(InfoExtractor): 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 278bfd7d7..31d9779dd 100644 --- a/yt_dlp/extractor/rcti.py +++ b/yt_dlp/extractor/rcti.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals 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 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE): 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 @@ class RCTIPlusTVIE(RCTIPlusBaseIE): 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 6d000b372..e7fdcce3e 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 222fa0172..2a1b950bd 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 f855719ac..cf2bb1b51 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 bde6cd5dc..422d47ae9 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 65284643b..84bb1aa00 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 c6ca4cd10..f9979d0a4 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 d7baa3aa5..4e3aa0398 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 aed35f8a9..865a73024 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 d2fb754cf..59832eeac 100644 --- a/yt_dlp/extractor/rtve.py +++ b/yt_dlp/extractor/rtve.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals 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 e66036c79..7e0de994a 100644 --- a/yt_dlp/extractor/rutv.py +++ b/yt_dlp/extractor/rutv.py @@ -123,7 +123,7 @@ class RUTVIE(InfoExtractor): 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 2cc665122..c92e8849b 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 49a9b313a..df202a3a4 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 21e44b69a..98efdc2a4 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 b40b4c4af..84918b67f 100644 --- a/yt_dlp/extractor/scrippsnetworks.py +++ b/yt_dlp/extractor/scrippsnetworks.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals 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 7872dc80d..e5c18c7a5 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 db5ef8b57..8794d47ef 100644 --- a/yt_dlp/extractor/senateisvp.py +++ b/yt_dlp/extractor/senateisvp.py @@ -102,7 +102,7 @@ class SenateISVPIE(InfoExtractor): 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 240afc18f..9f15bd7cc 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 7a08686fa..dc590129c 100644 --- a/yt_dlp/extractor/shahid.py +++ b/yt_dlp/extractor/shahid.py @@ -111,7 +111,7 @@ class ShahidIE(ShahidBaseIE): })) 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 2d0b3c06d..857e9414f 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 408311418..b62b0c3e5 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 7ec66ecf3..3a3a99256 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 e89ebebe7..9b3ad0ad4 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 f77354748..0bb548255 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 a62ed84f1..3bff5c595 100644 --- a/yt_dlp/extractor/sohu.py +++ b/yt_dlp/extractor/sohu.py @@ -97,7 +97,7 @@ class SohuIE(InfoExtractor): '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 13ec96d82..8f0713e13 100644 --- a/yt_dlp/extractor/soundcloud.py +++ b/yt_dlp/extractor/soundcloud.py @@ -557,7 +557,7 @@ class SoundcloudIE(InfoExtractor): } 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 3d78a9d76..d608eb7a7 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 f14bd6d71..d70331bb3 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 a417b5a4e..35c57d62a 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 07d99b579..49ac1f559 100644 --- a/yt_dlp/extractor/springboardplatform.py +++ b/yt_dlp/extractor/springboardplatform.py @@ -57,7 +57,7 @@ class SpringboardPlatformIE(InfoExtractor): 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 2977b5e67..cbc1c47d2 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 @@ class SRGSSRIE(InfoExtractor): 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 ae3dd1380..0003075ac 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 9518f83f1..7f777c40b 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 539220a94..d36a4b6e9 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 4b6284a8d..38e0086b3 100644 --- a/yt_dlp/extractor/svt.py +++ b/yt_dlp/extractor/svt.py @@ -119,7 +119,7 @@ class SVTIE(SVTBaseIE): 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 @@ class SVTPlayIE(SVTPlayBaseIE): 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 @@ class SVTSeriesIE(SVTPlayBaseIE): 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 @@ class SVTPageIE(InfoExtractor): 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 8ceab7e35..25c200455 100644 --- a/yt_dlp/extractor/tagesschau.py +++ b/yt_dlp/extractor/tagesschau.py @@ -78,7 +78,7 @@ class TagesschauPlayerIE(InfoExtractor): } 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 @@ class TagesschauIE(InfoExtractor): 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 f7d7c1836..cad3f2f46 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 2394f86d4..37eae82bc 100644 --- a/yt_dlp/extractor/teachable.py +++ b/yt_dlp/extractor/teachable.py @@ -151,7 +151,7 @@ class TeachableIE(TeachableBaseIE): 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 @@ class TeachableCourseIE(TeachableBaseIE): 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 1272078c5..e22f0114c 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 a5b62c717..78f07319b 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 44d5d220b..ac2d603b6 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 84a14a0bd..8bc512a9c 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 23c2808a1..669eb5015 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 adfe11e31..c56b708b8 100644 --- a/yt_dlp/extractor/theplatform.py +++ b/yt_dlp/extractor/theplatform.py @@ -238,7 +238,7 @@ class ThePlatformIE(ThePlatformBaseIE, AdobePassIE): '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 @@ class ThePlatformFeedIE(ThePlatformBaseIE): 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 b2a8c3797..9e506c9e0 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 dc3dd03c8..4af286e6d 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 bc2def508..39056e52e 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 b3573c6e0..d7617f708 100644 --- a/yt_dlp/extractor/tnaflix.py +++ b/yt_dlp/extractor/tnaflix.py @@ -73,7 +73,7 @@ class TNAFlixNetworkBaseIE(InfoExtractor): } 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 b5ba1c01d..df13d64c0 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 @@ class ToonGogglesIE(InfoExtractor): } 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 747370d12..10100fbcf 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 ce892c8c5..c09ff897c 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 4b3ab4088..2e9b325ba 100644 --- a/yt_dlp/extractor/tubitv.py +++ b/yt_dlp/extractor/tubitv.py @@ -141,5 +141,5 @@ class TubiTvShowIE(InfoExtractor): 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 ae584ad69..adc370127 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 @@ class TumblrIE(InfoExtractor): 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 be3eaa5c2..f6bbf2529 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 eabdc2271..398b85db5 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 a4a30b1e6..943b3ebdd 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 @@ class TVerIE(InfoExtractor): '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 180259aba..aa25ba0dc 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 fc87a69af..b31818477 100644 --- a/yt_dlp/extractor/tvnow.py +++ b/yt_dlp/extractor/tvnow.py @@ -169,7 +169,7 @@ class TVNowIE(TVNowBaseIE): }] 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 @@ class TVNowIE(TVNowNewBaseIE): } 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 @@ class TVNowShowIE(TVNowListBaseIE): 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 accff75b5..1e42b33a4 100644 --- a/yt_dlp/extractor/tvp.py +++ b/yt_dlp/extractor/tvp.py @@ -246,7 +246,7 @@ class TVPWebsiteIE(InfoExtractor): 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 739c61cdd..c60af111c 100644 --- a/yt_dlp/extractor/tvplay.py +++ b/yt_dlp/extractor/tvplay.py @@ -381,7 +381,7 @@ class ViafreeIE(InfoExtractor): 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 74d14049b..ae19e11e1 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 dc5609192..e8cf5a1e9 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 16584e940..3acf1b118 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 ae79ec6e0..485b781ca 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 a724cdbef..685d74f35 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 c0dba0a6a..9adb96943 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 1e29cbe22..8b758795f 100644 --- a/yt_dlp/extractor/ustream.py +++ b/yt_dlp/extractor/ustream.py @@ -165,7 +165,7 @@ class UstreamIE(InfoExtractor): 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 56509beed..92509d1bf 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 5ab716880..002047dbf 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 1aec828be..142ac8dc2 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 22e99e8f0..b6131ff82 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 e37499512..ca4d3edbd 100644 --- a/yt_dlp/extractor/vice.py +++ b/yt_dlp/extractor/vice.py @@ -118,7 +118,7 @@ class ViceIE(ViceBaseIE, AdobePassIE): 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 @@ class ViceShowIE(ViceBaseIE): 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 642358433..ecc48246f 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 05ae74e33..baafdc15d 100644 --- a/yt_dlp/extractor/videomore.py +++ b/yt_dlp/extractor/videomore.py @@ -144,7 +144,7 @@ class VideomoreIE(InfoExtractor): 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 b9ee67d20..2f5ea5c0b 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 @@ class VidioPremierIE(VidioBaseIE): 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 dbd5ba9ba..94aa350e7 100644 --- a/yt_dlp/extractor/vier.py +++ b/yt_dlp/extractor/vier.py @@ -135,7 +135,7 @@ class VierIE(InfoExtractor): 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 55c2b95c2..c3b2e863d 100644 --- a/yt_dlp/extractor/viewlift.py +++ b/yt_dlp/extractor/viewlift.py @@ -92,7 +92,7 @@ class ViewLiftEmbedIE(ViewLiftBaseIE): 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 @@ class ViewLiftIE(ViewLiftBaseIE): 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 a0abbae60..0da06818b 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 8ddd1d298..5c09c8520 100644 --- a/yt_dlp/extractor/vimeo.py +++ b/yt_dlp/extractor/vimeo.py @@ -672,7 +672,7 @@ class VimeoIE(VimeoBaseInfoExtractor): 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 @@ class VimeoReviewIE(VimeoBaseInfoExtractor): 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 27373658a..07fce0daa 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 @@ class VineUserIE(InfoExtractor): 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 b1e5f0af7..1b34c5296 100644 --- a/yt_dlp/extractor/viu.py +++ b/yt_dlp/extractor/viu.py @@ -266,7 +266,7 @@ class ViuOTTIE(InfoExtractor): 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 6b3513ee0..d8a9b9ab4 100644 --- a/yt_dlp/extractor/vk.py +++ b/yt_dlp/extractor/vk.py @@ -308,7 +308,7 @@ class VKIE(VKBaseIE): 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 @@ class VKUserVideosIE(VKBaseIE): '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 ae29c3de2..11ebe76e1 100644 --- a/yt_dlp/extractor/voicy.py +++ b/yt_dlp/extractor/voicy.py @@ -11,7 +11,6 @@ from ..utils import ( 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 2b65d2e5f..10dc94abc 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 c92b47e63..1c8f80ae9 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 bc196f8a0..3faa90fbd 100644 --- a/yt_dlp/extractor/vvvvid.py +++ b/yt_dlp/extractor/vvvvid.py @@ -98,7 +98,7 @@ class VVVVIDIE(InfoExtractor): } 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 cbb548672..00f081bca 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 5a4e46e73..7469fe962 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 fadc539ee..a86819173 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 9658ecea7..f54aa6ff9 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 f32d0afc8..ea953bf77 100644 --- a/yt_dlp/extractor/wimtv.py +++ b/yt_dlp/extractor/wimtv.py @@ -119,7 +119,7 @@ class WimTVIE(InfoExtractor): 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 df9efa9fa..cd97c77dc 100644 --- a/yt_dlp/extractor/xfileshare.py +++ b/yt_dlp/extractor/xfileshare.py @@ -98,7 +98,7 @@ class XFileShareIE(InfoExtractor): 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 1c9398986..7e33c420e 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 a912e54b8..802d1bb1b 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 cd9c465e4..792843df5 100644 --- a/yt_dlp/extractor/xstream.py +++ b/yt_dlp/extractor/xstream.py @@ -112,7 +112,7 @@ class XstreamIE(InfoExtractor): } 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 682e45bef..abd319188 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 e34ebe3a6..0d536015c 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 df1e078ac..741efefc8 100644 --- a/yt_dlp/extractor/yahoo.py +++ b/yt_dlp/extractor/yahoo.py @@ -279,7 +279,7 @@ class YahooIE(InfoExtractor): } 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 @@ class YahooJapanNewsIE(InfoExtractor): 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 6fcd8ee7e..c15f3a4f3 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 c30c438f8..a3558cc12 100644 --- a/yt_dlp/extractor/yandexmusic.py +++ b/yt_dlp/extractor/yandexmusic.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals 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 @@ class YandexMusicAlbumIE(YandexMusicPlaylistBaseIE): 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 @@ class YandexMusicArtistBaseIE(YandexMusicPlaylistBaseIE): }) 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 88aabd272..5f5fbf21c 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 7084d3d12..5feb568e7 100644 --- a/yt_dlp/extractor/youporn.py +++ b/yt_dlp/extractor/youporn.py @@ -74,7 +74,7 @@ class YouPornIE(InfoExtractor): 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 88a7e5b5d..bf007273c 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2088,8 +2088,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 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 f6496f516..161b011ab 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 32dcc03b1..a13d12436 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 7b08c77fc..536604167 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 @@ class Zee5IE(InfoExtractor): 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 7accb6505..25a0902f6 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: