1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-17 13:49:19 -04:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Siddhartha Sahu
376aa24b15
Improve default subtitle language selection (#6240)
Authored by: sdht0
2023-02-17 01:25:01 +05:30
Simon Sawicki
c9d14bd22a
[extractor/crunchyroll] Fix incorrect premium-only error
Closes #6234

Authored by: Grub4K
2023-02-16 15:54:11 +01:00
bashonly
149eb0bbf3
[extractor/youtube] Fix uploader_id extraction
Closes #6247
Authored by: bashonly
2023-02-16 08:51:45 -06:00
3 changed files with 9 additions and 5 deletions

View File

@ -2810,10 +2810,14 @@ class YoutubeDL:
self.params.get('subtitleslangs'), {'all': all_sub_langs}, use_regex=True) self.params.get('subtitleslangs'), {'all': all_sub_langs}, use_regex=True)
except re.error as e: except re.error as e:
raise ValueError(f'Wrong regex for subtitlelangs: {e.pattern}') raise ValueError(f'Wrong regex for subtitlelangs: {e.pattern}')
elif normal_sub_langs:
requested_langs = ['en'] if 'en' in normal_sub_langs else normal_sub_langs[:1]
else: else:
requested_langs = ['en'] if 'en' in all_sub_langs else all_sub_langs[:1] requested_langs = LazyList(itertools.chain(
['en'] if 'en' in normal_sub_langs else [],
filter(lambda f: f.startswith('en'), normal_sub_langs),
['en'] if 'en' in all_sub_langs else [],
filter(lambda f: f.startswith('en'), all_sub_langs),
normal_sub_langs, all_sub_langs,
))[:1]
if requested_langs: if requested_langs:
self.to_screen(f'[info] {video_id}: Downloading subtitles: {", ".join(requested_langs)}') self.to_screen(f'[info] {video_id}: Downloading subtitles: {", ".join(requested_langs)}')

View File

@ -160,7 +160,7 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
episode_response = self._download_json( episode_response = self._download_json(
f'{api_domain}/cms/v2{bucket}/episodes/{internal_id}', display_id, f'{api_domain}/cms/v2{bucket}/episodes/{internal_id}', display_id,
note='Retrieving episode metadata', query=params) note='Retrieving episode metadata', query=params)
if episode_response.get('is_premium_only') and not episode_response.get('playback'): if episode_response.get('is_premium_only') and not bucket.endswith('crunchyroll'):
if self.is_logged_in: if self.is_logged_in:
raise ExtractorError('This video is for premium members only', expected=True) raise ExtractorError('This video is for premium members only', expected=True)
else: else:

View File

@ -4120,7 +4120,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'thumbnail': traverse_obj(original_thumbnails, (-1, 'url')), 'thumbnail': traverse_obj(original_thumbnails, (-1, 'url')),
'description': video_description, 'description': video_description,
'uploader': get_first(video_details, 'author'), 'uploader': get_first(video_details, 'author'),
'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None, 'uploader_id': self._search_regex(r'/(?:channel/|user/|@)([^/?&#]+)', owner_profile_url, 'uploader id', default=None),
'uploader_url': owner_profile_url, 'uploader_url': owner_profile_url,
'channel_id': channel_id, 'channel_id': channel_id,
'channel_url': format_field(channel_id, None, 'https://www.youtube.com/channel/%s'), 'channel_url': format_field(channel_id, None, 'https://www.youtube.com/channel/%s'),