mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-27 02:44:33 +01:00
[youtube] Make ytcfg.set
config extraction non-fatal
If the markup of the page changes in the future, it might be possible that _FEED_DATA still works, but the other regex does not. SInce it is not necessary for the first page of videos, we make sure the program doesn't exit before extracting them. TL;DR: Extract the first video page even if there are problems
This commit is contained in:
parent
299056ad52
commit
1f93faf60b
@ -3354,7 +3354,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
|
|||||||
def _entries(self, page):
|
def _entries(self, page):
|
||||||
info = []
|
info = []
|
||||||
|
|
||||||
yt_conf = self._parse_json(self._search_regex(self._YTCFG_DATA, page, 'ytcfg.set'), None)
|
yt_conf = self._parse_json(self._search_regex(self._YTCFG_DATA, page, 'ytcfg.set', default="null"), None, fatal=False)
|
||||||
|
|
||||||
search_response = self._parse_json(self._search_regex(self._FEED_DATA, page, 'ytInitialData'), None)
|
search_response = self._parse_json(self._search_regex(self._FEED_DATA, page, 'ytInitialData'), None)
|
||||||
|
|
||||||
@ -3385,7 +3385,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
|
|||||||
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']['runs'][0]['text']))
|
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 or not yt_conf:
|
||||||
break
|
break
|
||||||
|
|
||||||
search_response = self._download_json(
|
search_response = self._download_json(
|
||||||
|
Loading…
Reference in New Issue
Block a user