mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 11:31:29 +01:00
[extractor] Minor improvements (See desc)
1. Allow removal of login hint - extractors can set their own login hint as part of `msg` 2. Cleanup `_merge_subtitles` signature
This commit is contained in:
parent
60755938b3
commit
46890374f7
|
@ -1038,7 +1038,9 @@ def raise_login_required(
|
|||
metadata_available=False, method='any'):
|
||||
if metadata_available and self.get_param('ignore_no_formats_error'):
|
||||
self.report_warning(msg)
|
||||
raise ExtractorError('%s. %s' % (msg, self._LOGIN_HINTS[method]), expected=True)
|
||||
if method is not None:
|
||||
msg = '%s. %s' % (msg, self._LOGIN_HINTS[method])
|
||||
raise ExtractorError(msg, expected=True)
|
||||
|
||||
def raise_geo_restricted(
|
||||
self, msg='This video is not available from your location due to geo restriction',
|
||||
|
@ -3442,16 +3444,8 @@ def _merge_subtitle_items(subtitle_list1, subtitle_list2):
|
|||
return ret
|
||||
|
||||
@classmethod
|
||||
def _merge_subtitles(cls, *dicts, **kwargs):
|
||||
def _merge_subtitles(cls, *dicts, target=None):
|
||||
""" Merge subtitle dictionaries, language by language. """
|
||||
|
||||
target = (lambda target=None: target)(**kwargs)
|
||||
# The above lambda extracts the keyword argument 'target' from kwargs
|
||||
# while ensuring there are no stray ones. When Python 2 support
|
||||
# is dropped, remove it and change the function signature to:
|
||||
#
|
||||
# def _merge_subtitles(cls, *dicts, target=None):
|
||||
|
||||
if target is None:
|
||||
target = {}
|
||||
for d in dicts:
|
||||
|
|
Loading…
Reference in New Issue
Block a user