diff options
author | xarantolus <xarantolus@protonmail.com> | 2020-07-31 10:05:11 +0200 |
---|---|---|
committer | xarantolus <xarantolus@protonmail.com> | 2020-09-06 09:22:47 +0200 |
commit | 299056ad52222911eea22db0b1a0715bef7572ef (patch) | |
tree | 2292bdf25f4a75b2ed95b5db5730617c155d1f49 | |
parent | f536080701c29829d6eebefeb4915307ee44e7d8 (diff) | |
download | hypervideo-pre-299056ad52222911eea22db0b1a0715bef7572ef.tar.lz hypervideo-pre-299056ad52222911eea22db0b1a0715bef7572ef.tar.xz hypervideo-pre-299056ad52222911eea22db0b1a0715bef7572ef.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 d97e0ab4e..ec631cd22 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -3325,7 +3325,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): @@ -3341,8 +3341,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor): return if "nextContinuationData" in obj: - nonlocal continuation - continuation = obj["nextContinuationData"] + c["continuation"] = obj["nextContinuationData"] return for _, o in obj.items(): @@ -3350,7 +3349,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor): _real_find(extracted) - return videos, continuation + return videos, try_get(c, lambda x: x["continuation"]) def _entries(self, page): info = [] @@ -3384,7 +3383,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 |