diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-07-07 02:27:53 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-07-07 02:27:53 +0530 |
commit | 46890374f74b4262a4ac7ff44d75e46316e00192 (patch) | |
tree | 41e3e4d6cbf6127a8f6e799181fc5f44fe36afe7 /yt_dlp/extractor/common.py | |
parent | 60755938b3d00cd3fc259a0843188609b6e6947e (diff) | |
download | hypervideo-pre-46890374f74b4262a4ac7ff44d75e46316e00192.tar.lz hypervideo-pre-46890374f74b4262a4ac7ff44d75e46316e00192.tar.xz hypervideo-pre-46890374f74b4262a4ac7ff44d75e46316e00192.zip |
[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
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r-- | yt_dlp/extractor/common.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 0a27cffed..17d2e7158 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -1038,7 +1038,9 @@ class InfoExtractor(object): 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 @@ class InfoExtractor(object): 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: |