mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-09 01:43:37 +00:00
Fix python2 compatibility and title extraction
This commit is contained in:
parent
4f37c60bf5
commit
a5e386d9fe
|
@ -3321,7 +3321,7 @@ def _real_initialize(self):
|
||||||
|
|
||||||
def _find_videos_in_json(self, extracted):
|
def _find_videos_in_json(self, extracted):
|
||||||
videos = []
|
videos = []
|
||||||
continuation = None
|
c = {}
|
||||||
|
|
||||||
def _real_find(obj):
|
def _real_find(obj):
|
||||||
if obj is None or isinstance(obj, str):
|
if obj is None or isinstance(obj, str):
|
||||||
|
@ -3337,8 +3337,7 @@ def _real_find(obj):
|
||||||
return
|
return
|
||||||
|
|
||||||
if "nextContinuationData" in obj:
|
if "nextContinuationData" in obj:
|
||||||
nonlocal continuation
|
c["continuation"] = obj["nextContinuationData"]
|
||||||
continuation = obj["nextContinuationData"]
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for _, o in obj.items():
|
for _, o in obj.items():
|
||||||
|
@ -3346,7 +3345,7 @@ def _real_find(obj):
|
||||||
|
|
||||||
_real_find(extracted)
|
_real_find(extracted)
|
||||||
|
|
||||||
return videos, continuation
|
return videos, try_get(c, lambda x: x["continuation"])
|
||||||
|
|
||||||
def _entries(self, page):
|
def _entries(self, page):
|
||||||
info = []
|
info = []
|
||||||
|
@ -3380,7 +3379,7 @@ def _entries(self, page):
|
||||||
info.extend(new_info)
|
info.extend(new_info)
|
||||||
|
|
||||||
for video in 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:
|
if not continuation:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue