diff options
author | xarantolus <xarantolus@protonmail.com> | 2020-07-31 10:05:11 +0200 |
---|---|---|
committer | xarantolus <xarantolus@protonmail.com> | 2020-07-31 10:05:11 +0200 |
commit | a5e386d9feb0e54013ec5aa1ba106869240fb995 (patch) | |
tree | 5bb0a36b689d5c5e475149d5cfab887e7133b684 | |
parent | 4f37c60bf5f2af245985d314f0f64f473644feef (diff) | |
download | hypervideo-pre-a5e386d9feb0e54013ec5aa1ba106869240fb995.tar.lz hypervideo-pre-a5e386d9feb0e54013ec5aa1ba106869240fb995.tar.xz hypervideo-pre-a5e386d9feb0e54013ec5aa1ba106869240fb995.zip |
Fix python2 compatibility and title extraction
-rw-r--r-- | youtube_dl/extractor/youtube.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index f6bed3f68..ad8db2c2d 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -3321,7 +3321,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor): def _find_videos_in_json(self, extracted): videos = [] - continuation = None + c = {} def _real_find(obj): if obj is None or isinstance(obj, str): @@ -3337,8 +3337,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor): return if "nextContinuationData" in obj: - nonlocal continuation - continuation = obj["nextContinuationData"] + c["continuation"] = obj["nextContinuationData"] return for _, o in obj.items(): @@ -3346,7 +3345,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor): _real_find(extracted) - return videos, continuation + return videos, try_get(c, lambda x: x["continuation"]) def _entries(self, page): info = [] @@ -3380,7 +3379,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor): info.extend(new_info) for video in new_info: - yield self.url_result(try_get(video, lambda x: x['videoId']), YoutubeIE.ie_key(), video_title=try_get(video, lambda x: x['title']['simpleText'])) + yield self.url_result(try_get(video, lambda x: x['videoId']), YoutubeIE.ie_key(), video_title=try_get(video, lambda x: x['title']['runs'][0]['text'])) if not continuation: break |