A feature-rich command-line audio/video downloader
[ie/once] Remove extractor (#13164)
bashonlyf475e8b529d1
diff --git a/yt_dlp/extractor/espn.py b/yt_dlp/extractor/espn.pyindex 552f9af12e..37e74bc08e 100644--- a/yt_dlp/extractor/espn.py+++ b/yt_dlp/extractor/espn.py@@ -5,7 +5,6 @@ import urllib.parsefrom .adobepass import AdobePassIEfrom .common import InfoExtractor-from .once import OnceIEfrom ..utils import (determine_ext,dict_get,@@ -16,7 +15,7 @@ from ..utils import ()-class ESPNIE(OnceIE):+class ESPNIE(InfoExtractor):_VALID_URL = r'''(?x)https?://(?:@@ -131,9 +130,7 @@ class ESPNIE(OnceIE):returnformat_urls.add(source_url)ext = determine_ext(source_url)- if OnceIE.suitable(source_url):- formats.extend(self._extract_once_formats(source_url))- elif ext == 'smil':+ if ext == 'smil':formats.extend(self._extract_smil_formats(source_url, video_id, fatal=False))elif ext == 'f4m':diff --git a/yt_dlp/extractor/gamespot.py b/yt_dlp/extractor/gamespot.pyindex cd3f9655d8..2799a27bac 100644--- a/yt_dlp/extractor/gamespot.py+++ b/yt_dlp/extractor/gamespot.py@@ -1,9 +1,9 @@import urllib.parse-from .once import OnceIE+from .common import InfoExtractor-class GameSpotIE(OnceIE):+class GameSpotIE(InfoExtractor):_VALID_URL = r'https?://(?:www\.)?gamespot\.com/(?:video|article|review)s/(?:[^/]+/\d+-|embed/)(?P<id>\d+)'_TESTS = [{'url': 'http://www.gamespot.com/videos/arma-3-community-guide-sitrep-i/2300-6410818/',diff --git a/yt_dlp/extractor/once.py b/yt_dlp/extractor/once.pydeleted file mode 100644index 989f10abb1..0000000000--- a/yt_dlp/extractor/once.py+++ /dev/null@@ -1,40 +0,0 @@-import re--from .common import InfoExtractor---class OnceIE(InfoExtractor): # XXX: Conventionally, base classes should end with BaseIE/InfoExtractor- _VALID_URL = r'https?://.+?\.unicornmedia\.com/now/(?:ads/vmap/)?[^/]+/[^/]+/(?P<domain_id>[^/]+)/(?P<application_id>[^/]+)/(?:[^/]+/)?(?P<media_item_id>[^/]+)/content\.(?:once|m3u8|mp4)'- ADAPTIVE_URL_TEMPLATE = 'http://once.unicornmedia.com/now/master/playlist/%s/%s/%s/content.m3u8'- PROGRESSIVE_URL_TEMPLATE = 'http://once.unicornmedia.com/now/media/progressive/%s/%s/%s/%s/content.mp4'-- def _extract_once_formats(self, url, http_formats_preference=None):- domain_id, application_id, media_item_id = re.match(- OnceIE._VALID_URL, url).groups()- formats = self._extract_m3u8_formats(- self.ADAPTIVE_URL_TEMPLATE % (- domain_id, application_id, media_item_id),- media_item_id, 'mp4', m3u8_id='hls', fatal=False)- progressive_formats = []- for adaptive_format in formats:- # Prevent advertisement from embedding into m3u8 playlist (see- # https://github.com/ytdl-org/youtube-dl/issues/8893#issuecomment-199912684)- adaptive_format['url'] = re.sub(- r'\badsegmentlength=\d+', r'adsegmentlength=0', adaptive_format['url'])- rendition_id = self._search_regex(- r'/now/media/playlist/[^/]+/[^/]+/([^/]+)',- adaptive_format['url'], 'redition id', default=None)- if rendition_id:- progressive_format = adaptive_format.copy()- progressive_format.update({- 'url': self.PROGRESSIVE_URL_TEMPLATE % (- domain_id, application_id, rendition_id, media_item_id),- 'format_id': adaptive_format['format_id'].replace(- 'hls', 'http'),- 'protocol': 'http',- 'preference': http_formats_preference,- })- progressive_formats.append(progressive_format)- self._check_formats(progressive_formats, media_item_id)- formats.extend(progressive_formats)- return formatsdiff --git a/yt_dlp/extractor/theplatform.py b/yt_dlp/extractor/theplatform.pyindex b73bea18fd..ebe2ac2962 100644--- a/yt_dlp/extractor/theplatform.py+++ b/yt_dlp/extractor/theplatform.py@@ -4,7 +4,6 @@ import reimport timefrom .adobepass import AdobePassIE-from .once import OnceIEfrom ..networking import HEADRequest, Requestfrom ..utils import (ExtractorError,@@ -26,7 +25,7 @@ default_ns = 'http://www.w3.org/2005/SMIL21/Language'_x = lambda p: xpath_with_ns(p, {'smil': default_ns})-class ThePlatformBaseIE(OnceIE):+class ThePlatformBaseIE(AdobePassIE):_TP_TLD = 'com'def _extract_theplatform_smil(self, smil_url, video_id, note='Downloading SMIL data'):@@ -54,16 +53,13 @@ class ThePlatformBaseIE(OnceIE):formats = []for _format in smil_formats:- if OnceIE.suitable(_format['url']):- formats.extend(self._extract_once_formats(_format['url']))- else:- media_url = _format['url']- if determine_ext(media_url) == 'm3u8':- hdnea2 = self._get_cookies(media_url).get('hdnea2')- if hdnea2:- _format['url'] = update_url_query(media_url, {'hdnea3': hdnea2.value})+ media_url = _format['url']+ if determine_ext(media_url) == 'm3u8':+ hdnea2 = self._get_cookies(media_url).get('hdnea2')+ if hdnea2:+ _format['url'] = update_url_query(media_url, {'hdnea3': hdnea2.value})- formats.append(_format)+ formats.append(_format)return formats, subtitles@@ -129,7 +125,7 @@ class ThePlatformBaseIE(OnceIE):return self._parse_theplatform_metadata(info)-class ThePlatformIE(ThePlatformBaseIE, AdobePassIE):+class ThePlatformIE(ThePlatformBaseIE):_VALID_URL = r'''(?x)(?:https?://(?:link|player)\.theplatform\.com/[sp]/(?P<provider_id>[^/]+)/(?:(?:(?:[^/]+/)+select/)?(?P<media>media/(?:guid/\d+/)?)?|(?P<config>(?:[^/\?]+/(?:swf|config)|onsite)/select/))?diff --git a/yt_dlp/extractor/voxmedia.py b/yt_dlp/extractor/voxmedia.pyindex e9b0047a47..995ef21859 100644--- a/yt_dlp/extractor/voxmedia.py+++ b/yt_dlp/extractor/voxmedia.py@@ -1,7 +1,6 @@import urllib.parsefrom .common import InfoExtractor-from .once import OnceIEfrom ..utils import (ExtractorError,int_or_none,@@ -10,7 +9,7 @@ from ..utils import ()-class VoxMediaVolumeIE(OnceIE):+class VoxMediaVolumeIE(InfoExtractor):_VALID_URL = r'https?://volume\.vox-cdn\.com/embed/(?P<id>[0-9a-f]{9})'def _real_extract(self, url):@@ -57,7 +56,8 @@ class VoxMediaVolumeIE(OnceIE):if not provider_video_id:continueif provider_video_type == 'brightcove':- info['formats'] = self._extract_once_formats(provider_video_id)+ # TODO: Find embed example or confirm that Vox has stopped using Brightcove+ raise ExtractorError('Vox Brightcove embeds are currently unsupported')else:info.update({'_type': 'url_transparent',@@ -155,20 +155,6 @@ class VoxMediaIE(InfoExtractor):},}],'skip': 'Page no longer contain videos',- }, {- # volume embed, Brightcove Once- 'url': 'https://www.recode.net/2014/6/17/11628066/post-post-pc-ceo-the-full-code-conference-video-of-microsofts-satya',- 'md5': '2dbc77b8b0bff1894c2fce16eded637d',- 'info_dict': {- 'id': '1231c973d',- 'ext': 'mp4',- 'title': 'Post-Post-PC CEO: The Full Code Conference Video of Microsoft\'s Satya Nadella',- 'description': 'The longtime veteran was chosen earlier this year as the software giant\'s third leader in its history.',- 'timestamp': 1402938000,- 'upload_date': '20140616',- 'duration': 4114,- },- 'add_ie': ['VoxMediaVolume'],}]def _real_extract(self, url):