|
|
@ -954,7 +954,7 @@ class YoutubeDL:
|
|
|
|
self.to_screen('Deleting existing file')
|
|
|
|
self.to_screen('Deleting existing file')
|
|
|
|
|
|
|
|
|
|
|
|
def raise_no_formats(self, info, forced=False, *, msg=None):
|
|
|
|
def raise_no_formats(self, info, forced=False, *, msg=None):
|
|
|
|
has_drm = info.get('__has_drm')
|
|
|
|
has_drm = info.get('_has_drm')
|
|
|
|
ignored, expected = self.params.get('ignore_no_formats_error'), bool(msg)
|
|
|
|
ignored, expected = self.params.get('ignore_no_formats_error'), bool(msg)
|
|
|
|
msg = msg or has_drm and 'This video is DRM protected' or 'No video formats found!'
|
|
|
|
msg = msg or has_drm and 'This video is DRM protected' or 'No video formats found!'
|
|
|
|
if forced or not ignored:
|
|
|
|
if forced or not ignored:
|
|
|
@ -1052,7 +1052,7 @@ class YoutubeDL:
|
|
|
|
# For fields playlist_index, playlist_autonumber and autonumber convert all occurrences
|
|
|
|
# For fields playlist_index, playlist_autonumber and autonumber convert all occurrences
|
|
|
|
# of %(field)s to %(field)0Nd for backward compatibility
|
|
|
|
# of %(field)s to %(field)0Nd for backward compatibility
|
|
|
|
field_size_compat_map = {
|
|
|
|
field_size_compat_map = {
|
|
|
|
'playlist_index': number_of_digits(info_dict.get('_last_playlist_index') or 0),
|
|
|
|
'playlist_index': number_of_digits(info_dict.get('__last_playlist_index') or 0),
|
|
|
|
'playlist_autonumber': number_of_digits(info_dict.get('n_entries') or 0),
|
|
|
|
'playlist_autonumber': number_of_digits(info_dict.get('n_entries') or 0),
|
|
|
|
'autonumber': self.params.get('autonumber_size') or 5,
|
|
|
|
'autonumber': self.params.get('autonumber_size') or 5,
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1764,7 +1764,7 @@ class YoutubeDL:
|
|
|
|
entry['__x_forwarded_for_ip'] = x_forwarded_for
|
|
|
|
entry['__x_forwarded_for_ip'] = x_forwarded_for
|
|
|
|
extra = {
|
|
|
|
extra = {
|
|
|
|
'n_entries': n_entries,
|
|
|
|
'n_entries': n_entries,
|
|
|
|
'_last_playlist_index': max(playlistitems) if playlistitems else (playlistend or n_entries),
|
|
|
|
'__last_playlist_index': max(playlistitems) if playlistitems else (playlistend or n_entries),
|
|
|
|
'playlist_count': ie_result.get('playlist_count'),
|
|
|
|
'playlist_count': ie_result.get('playlist_count'),
|
|
|
|
'playlist_index': playlist_index,
|
|
|
|
'playlist_index': playlist_index,
|
|
|
|
'playlist_autonumber': i,
|
|
|
|
'playlist_autonumber': i,
|
|
|
@ -2436,10 +2436,11 @@ class YoutubeDL:
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
formats = info_dict['formats']
|
|
|
|
formats = info_dict['formats']
|
|
|
|
|
|
|
|
|
|
|
|
info_dict['__has_drm'] = any(f.get('has_drm') for f in formats)
|
|
|
|
# or None ensures --clean-infojson removes it
|
|
|
|
|
|
|
|
info_dict['_has_drm'] = any(f.get('has_drm') for f in formats) or None
|
|
|
|
if not self.params.get('allow_unplayable_formats'):
|
|
|
|
if not self.params.get('allow_unplayable_formats'):
|
|
|
|
formats = [f for f in formats if not f.get('has_drm')]
|
|
|
|
formats = [f for f in formats if not f.get('has_drm')]
|
|
|
|
if info_dict['__has_drm'] and all(
|
|
|
|
if info_dict['_has_drm'] and all(
|
|
|
|
f.get('acodec') == f.get('vcodec') == 'none' for f in formats):
|
|
|
|
f.get('acodec') == f.get('vcodec') == 'none' for f in formats):
|
|
|
|
self.report_warning(
|
|
|
|
self.report_warning(
|
|
|
|
'This video is DRM protected and only images are available for download. '
|
|
|
|
'This video is DRM protected and only images are available for download. '
|
|
|
@ -3266,9 +3267,9 @@ class YoutubeDL:
|
|
|
|
info_dict.setdefault('_type', 'video')
|
|
|
|
info_dict.setdefault('_type', 'video')
|
|
|
|
|
|
|
|
|
|
|
|
if remove_private_keys:
|
|
|
|
if remove_private_keys:
|
|
|
|
reject = lambda k, v: v is None or (k.startswith('_') and k != '_type') or k in {
|
|
|
|
reject = lambda k, v: v is None or k.startswith('__') or k in {
|
|
|
|
'requested_downloads', 'requested_formats', 'requested_subtitles', 'requested_entries',
|
|
|
|
'requested_downloads', 'requested_formats', 'requested_subtitles', 'requested_entries',
|
|
|
|
'entries', 'filepath', 'infojson_filename', 'original_url', 'playlist_autonumber',
|
|
|
|
'entries', 'filepath', '_filename', 'infojson_filename', 'original_url', 'playlist_autonumber',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
reject = lambda k, v: False
|
|
|
|
reject = lambda k, v: False
|
|
|
|