1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-21 23:33:10 +00:00

[youtube] Fix XSRF Token regex

This commit is contained in:
DonneyF 2021-01-09 18:41:13 -08:00
parent 98e248faa4
commit 1f2c50dbe8

View file

@ -2374,7 +2374,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
video_annotations = None video_annotations = None
if self._downloader.params.get('writeannotations', False): if self._downloader.params.get('writeannotations', False):
xsrf_token = self._search_regex( xsrf_token = self._search_regex(
r'([\'"])XSRF_TOKEN\1\s*:\s*([\'"])(?P<xsrf_token>[A-Za-z0-9+/=]+)\2', r'([\'"])XSRF_TOKEN\1\s*:\s*([\'"])(?P<xsrf_token>(?:(?!\2).)+)\2',
video_webpage, 'xsrf token', group='xsrf_token', fatal=False) video_webpage, 'xsrf token', group='xsrf_token', fatal=False)
invideo_url = try_get( invideo_url = try_get(
player_response, lambda x: x['annotations'][0]['playerAnnotationsUrlsRenderer']['invideoUrl'], compat_str) player_response, lambda x: x['annotations'][0]['playerAnnotationsUrlsRenderer']['invideoUrl'], compat_str)