Remove allow-u from extractors

This commit is contained in:
Simon Sawicki 2024-12-20 21:53:33 +01:00
parent 6e7072c53a
commit ec8b22b1c1
No known key found for this signature in database
19 changed files with 48 additions and 35 deletions

View file

@ -87,7 +87,7 @@ class GloboIE(InfoExtractor):
video = self._download_json( video = self._download_json(
f'http://api.globovideos.com/videos/{video_id}/playlist', f'http://api.globovideos.com/videos/{video_id}/playlist',
video_id)['videos'][0] video_id)['videos'][0]
if not self.get_param('allow_unplayable_formats') and video.get('encrypted') is True: if video.get('encrypted') is True:
self.report_drm(video_id) self.report_drm(video_id)
title = video['title'] title = video['title']

View file

@ -236,7 +236,7 @@ class HotStarIE(HotStarBaseIE):
self._call_api_v1( self._call_api_v1(
f'{video_type}/detail', video_id, fatal=False, query={'tas': 10000, 'contentId': video_id}), f'{video_type}/detail', video_id, fatal=False, query={'tas': 10000, 'contentId': video_id}),
('body', 'results', 'item', {dict})) or {} ('body', 'results', 'item', {dict})) or {}
if not self.get_param('allow_unplayable_formats') and video_data.get('drmProtected'): if video_data.get('drmProtected'):
self.report_drm(video_id) self.report_drm(video_id)
# See https://github.com/yt-dlp/yt-dlp/issues/396 # See https://github.com/yt-dlp/yt-dlp/issues/396

View file

@ -140,13 +140,14 @@ class IviIE(InfoExtractor):
quality = qualities(self._KNOWN_FORMATS) quality = qualities(self._KNOWN_FORMATS)
formats = [] formats = []
has_drm = False
for f in result.get('files', []): for f in result.get('files', []):
f_url = f.get('url') f_url = f.get('url')
content_format = f.get('content_format') content_format = f.get('content_format')
if not f_url: if not f_url:
continue continue
if (not self.get_param('allow_unplayable_formats') if '-MDRM-' in content_format or '-FPS-' in content_format:
and ('-MDRM-' in content_format or '-FPS-' in content_format)): has_drm = True
continue continue
formats.append({ formats.append({
'url': f_url, 'url': f_url,
@ -154,6 +155,8 @@ class IviIE(InfoExtractor):
'quality': quality(content_format), 'quality': quality(content_format),
'filesize': int_or_none(f.get('size_in_bytes')), 'filesize': int_or_none(f.get('size_in_bytes')),
}) })
if not formats and has_drm:
self.report_drm(video_id)
compilation = result.get('compilation') compilation = result.get('compilation')
episode = title if compilation else None episode = title if compilation else None

View file

@ -464,6 +464,7 @@ class KalturaIE(InfoExtractor):
formats = [] formats = []
subtitles = {} subtitles = {}
has_drm = False
for f in flavor_assets: for f in flavor_assets:
# Continue if asset is not ready # Continue if asset is not ready
if f.get('status') != 2: if f.get('status') != 2:
@ -473,7 +474,8 @@ class KalturaIE(InfoExtractor):
if f.get('fileExt') == 'chun': if f.get('fileExt') == 'chun':
continue continue
# DRM-protected video, cannot be decrypted # DRM-protected video, cannot be decrypted
if not self.get_param('allow_unplayable_formats') and f.get('fileExt') == 'wvm': if f.get('fileExt') == 'wvm':
has_drm = True
continue continue
if not f.get('fileExt'): if not f.get('fileExt'):
# QT indicates QuickTime; some videos have broken fileExt # QT indicates QuickTime; some videos have broken fileExt
@ -513,6 +515,9 @@ class KalturaIE(InfoExtractor):
formats.extend(fmts) formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles) self._merge_subtitles(subs, target=subtitles)
if not formats and has_drm:
self.report_drm(entry_id)
if captions: if captions:
for caption in captions.get('objects', []): for caption in captions.get('objects', []):
# Continue if caption is not ready # Continue if caption is not ready

View file

@ -91,11 +91,13 @@ class LimelightBaseIE(InfoExtractor):
formats = [] formats = []
urls = [] urls = []
has_drm = False
for stream in pc_item.get('streams', []): for stream in pc_item.get('streams', []):
stream_url = stream.get('url') stream_url = stream.get('url')
if not stream_url or stream_url in urls: if not stream_url or stream_url in urls:
continue continue
if not self.get_param('allow_unplayable_formats') and stream.get('drmProtected'): if stream.get('drmProtected'):
has_drm = True
continue continue
urls.append(stream_url) urls.append(stream_url)
ext = determine_ext(stream_url) ext = determine_ext(stream_url)
@ -159,8 +161,8 @@ class LimelightBaseIE(InfoExtractor):
format_id = mobile_url.get('targetMediaPlatform') format_id = mobile_url.get('targetMediaPlatform')
if not media_url or media_url in urls: if not media_url or media_url in urls:
continue continue
if (format_id in ('Widevine', 'SmoothStreaming') if format_id in ('Widevine', 'SmoothStreaming'):
and not self.get_param('allow_unplayable_formats', False)): has_drm = True
continue continue
urls.append(media_url) urls.append(media_url)
ext = determine_ext(media_url) ext = determine_ext(media_url)
@ -179,6 +181,9 @@ class LimelightBaseIE(InfoExtractor):
'ext': ext, 'ext': ext,
}) })
if not formats and has_drm:
self.report_drm(video_id)
subtitles = {} subtitles = {}
for flag in mobile_item.get('flags'): for flag in mobile_item.get('flags'):
if flag == 'ClosedCaptions': if flag == 'ClosedCaptions':

View file

@ -29,8 +29,7 @@ class NineCNineMediaIE(InfoExtractor):
'$include': '[HasClosedCaptions]', '$include': '[HasClosedCaptions]',
}) })
if (not self.get_param('allow_unplayable_formats') if try_get(content_package, lambda x: x['Constraints']['Security']['Type']):
and try_get(content_package, lambda x: x['Constraints']['Security']['Type'])):
self.report_drm(content_id) self.report_drm(content_id)
manifest_base_url = content_package_url + 'manifest.' manifest_base_url = content_package_url + 'manifest.'

View file

@ -85,7 +85,7 @@ class NineNowIE(InfoExtractor):
else: else:
raise ExtractorError('Unable to find video data') raise ExtractorError('Unable to find video data')
if not self.get_param('allow_unplayable_formats') and try_get(common_data, lambda x: x['episode']['video']['drm'], bool): if try_get(common_data, lambda x: x['episode']['video']['drm'], bool):
self.report_drm(display_id) self.report_drm(display_id)
brightcove_id = try_get( brightcove_id = try_get(
common_data, lambda x: x['episode']['video']['brightcoveId'], str) or 'ref:{}'.format(common_data['episode']['video']['referenceId']) common_data, lambda x: x['episode']['video']['brightcoveId'], str) or 'ref:{}'.format(common_data['episode']['video']['referenceId'])

View file

@ -65,8 +65,7 @@ class NovaEmbedIE(InfoExtractor):
for format_dict in format_list: for format_dict in format_list:
if not isinstance(format_dict, dict): if not isinstance(format_dict, dict):
continue continue
if (not self.get_param('allow_unplayable_formats') if traverse_obj(format_dict, ('drm', 'keySystem')):
and traverse_obj(format_dict, ('drm', 'keySystem'))):
has_drm = True has_drm = True
continue continue
format_url = url_or_none(format_dict.get('src')) format_url = url_or_none(format_dict.get('src'))

View file

@ -275,9 +275,8 @@ class NPOIE(InfoExtractor):
'url': stream_url, 'url': stream_url,
}) })
if not formats: if not formats and drm:
if not self.get_param('allow_unplayable_formats') and drm: self.report_drm(video_id)
self.report_drm(video_id)
info = { info = {
'id': video_id, 'id': video_id,

View file

@ -31,7 +31,7 @@ class ProSiebenSat1BaseIE(InfoExtractor):
'ids': clip_id, 'ids': clip_id,
})[0] })[0]
if not self.get_param('allow_unplayable_formats') and video.get('is_protected') is True: if video.get('is_protected') is True:
self.report_drm(clip_id) self.report_drm(clip_id)
formats = [] formats = []

View file

@ -340,9 +340,8 @@ class RaiPlayIE(RaiBaseIE):
media = self._download_json( media = self._download_json(
f'{base}.json', video_id, 'Downloading video JSON') f'{base}.json', video_id, 'Downloading video JSON')
if not self.get_param('allow_unplayable_formats'): if traverse_obj(media, (('program_info', None), 'rights_management', 'rights', 'drm')):
if traverse_obj(media, (('program_info', None), 'rights_management', 'rights', 'drm')): self.report_drm(video_id)
self.report_drm(video_id)
video = media['video'] video = media['video']
relinker_info = self._extract_relinker_info(video['content_url'], video_id) relinker_info = self._extract_relinker_info(video['content_url'], video_id)

View file

@ -337,12 +337,16 @@ class RTBFIE(RedBeeBaseIE):
'height': height, 'height': height,
}) })
has_drm = False
mpd_url = None if data.get('isLive') else data.get('urlDash') mpd_url = None if data.get('isLive') else data.get('urlDash')
if mpd_url and (self.get_param('allow_unplayable_formats') or not data.get('drm')): if mpd_url:
fmts, subs = self._extract_mpd_formats_and_subtitles( if data.get('drm'):
mpd_url, media_id, mpd_id='dash', fatal=False) has_drm = True
formats.extend(fmts) else:
self._merge_subtitles(subs, target=subtitles) fmts, subs = self._extract_mpd_formats_and_subtitles(
mpd_url, media_id, mpd_id='dash', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
audio_url = data.get('urlAudio') audio_url = data.get('urlAudio')
if audio_url: if audio_url:
@ -365,6 +369,9 @@ class RTBFIE(RedBeeBaseIE):
formats.extend(fmts) formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles) self._merge_subtitles(subs, target=subtitles)
if not formats and has_drm:
self.report_drm(media_id)
return { return {
'id': media_id, 'id': media_id,
'formats': formats, 'formats': formats,

View file

@ -237,8 +237,7 @@ class RuutuIE(InfoExtractor):
return value or None return value or None
if not formats: if not formats:
if (not self.get_param('allow_unplayable_formats') if xpath_text(video_xml, './Clip/DRM', default=None):
and xpath_text(video_xml, './Clip/DRM', default=None)):
self.report_drm(video_id) self.report_drm(video_id)
ns_st_cds = pv('ns_st_cds') ns_st_cds = pv('ns_st_cds')
if ns_st_cds != 'free': if ns_st_cds != 'free':

View file

@ -111,7 +111,7 @@ class ShahidIE(ShahidBaseIE):
playout = self._call_api( playout = self._call_api(
'playout/new/url/' + video_id, video_id)['playout'] 'playout/new/url/' + video_id, video_id)['playout']
if not self.get_param('allow_unplayable_formats') and playout.get('drm'): if playout.get('drm'):
self.report_drm(video_id) self.report_drm(video_id)
formats = self._extract_m3u8_formats(re.sub( formats = self._extract_m3u8_formats(re.sub(

View file

@ -142,7 +142,7 @@ class SonyLIVIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
content = self._call_api( content = self._call_api(
'1.5', 'IN/CONTENT/VIDEOURL/VOD/' + video_id, video_id) '1.5', 'IN/CONTENT/VIDEOURL/VOD/' + video_id, video_id)
if not self.get_param('allow_unplayable_formats') and content.get('isEncrypted'): if content.get('isEncrypted'):
self.report_drm(video_id) self.report_drm(video_id)
dash_url = content['videoURL'] dash_url = content['videoURL']
headers = { headers = {

View file

@ -126,8 +126,7 @@ class ToggleIE(InfoExtractor):
}) })
if not formats: if not formats:
for meta in (info.get('Metas') or []): for meta in (info.get('Metas') or []):
if (not self.get_param('allow_unplayable_formats') if meta.get('Key') == 'Encryption' and meta.get('Value') == '1':
and meta.get('Key') == 'Encryption' and meta.get('Value') == '1'):
self.report_drm(video_id) self.report_drm(video_id)
# Most likely because geo-blocked if no formats and no DRM # Most likely because geo-blocked if no formats and no DRM

View file

@ -68,7 +68,7 @@ class TouTvIE(RadioCanadaIE): # XXX: Do not subclass from concrete IE
}) })
# IsDrm does not necessarily mean the video is DRM protected (see # IsDrm does not necessarily mean the video is DRM protected (see
# https://github.com/ytdl-org/youtube-dl/issues/13994). # https://github.com/ytdl-org/youtube-dl/issues/13994).
if not self.get_param('allow_unplayable_formats') and metadata.get('IsDrm'): if metadata.get('IsDrm'):
self.report_warning('This video is probably DRM protected.', path) self.report_warning('This video is probably DRM protected.', path)
video_id = metadata['IdMedia'] video_id = metadata['IdMedia']
details = metadata['Details'] details = metadata['Details']

View file

@ -261,8 +261,7 @@ class VidioLiveIE(VidioBaseIE):
formats = [] formats = []
if stream_meta.get('is_drm'): if stream_meta.get('is_drm'):
if not self.get_param('allow_unplayable_formats'): self.report_drm(video_id)
self.report_drm(video_id)
if stream_meta.get('is_premium'): if stream_meta.get('is_premium'):
sources = self._download_json( sources = self._download_json(
f'https://www.vidio.com/interactions_stream.json?video_id={video_id}&type=livestreamings', f'https://www.vidio.com/interactions_stream.json?video_id={video_id}&type=livestreamings',

View file

@ -4511,7 +4511,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
self.write_debug(f'{video_id}: Video is in Post-Live Manifestless mode') self.write_debug(f'{video_id}: Video is in Post-Live Manifestless mode')
if not formats: if not formats:
if not self.get_param('allow_unplayable_formats') and traverse_obj(streaming_data, (..., 'licenseInfos')): if traverse_obj(streaming_data, (..., 'licenseInfos')):
self.report_drm(video_id) self.report_drm(video_id)
pemr = get_first( pemr = get_first(
playability_statuses, playability_statuses,