aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxarantolus <xarantolus@protonmail.com>2020-08-24 14:29:16 +0200
committerxarantolus <xarantolus@protonmail.com>2020-09-06 09:22:47 +0200
commit1f93faf60bb1447ff1aa661e46916e863640ade2 (patch)
treea44bce03a4a515705369ac377676d641e3f0149a
parent299056ad52222911eea22db0b1a0715bef7572ef (diff)
downloadhypervideo-pre-1f93faf60bb1447ff1aa661e46916e863640ade2.tar.lz
hypervideo-pre-1f93faf60bb1447ff1aa661e46916e863640ade2.tar.xz
hypervideo-pre-1f93faf60bb1447ff1aa661e46916e863640ade2.zip
[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
-rw-r--r--youtube_dl/extractor/youtube.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index ec631cd22..ec821cbc0 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -3354,7 +3354,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
def _entries(self, page):
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)
@@ -3385,7 +3385,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
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']))
- if not continuation:
+ if not continuation or not yt_conf:
break
search_response = self._download_json(