]> Raphaƫl G. Git Repositories - youtubedl/blob - debian/patches/youtube-Fix-extraction.patch
Fix extraction from youtube.
[youtubedl] / debian / patches / youtube-Fix-extraction.patch
1 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= <dstftw@gmail.com>
2 Date: Wed, 24 Apr 2019 09:58:00 +0700
3 Subject: [youtube] Fix extraction (closes #20758, closes #20759, closes
4 #20761, closes #20762, closes #20764, closes #20766, closes #20767, closes
5 #20769, closes #20771, closes #20768, closes #20770)
6 Origin: https://github.com/ytdl-org/youtube-dl/commit/56667d622c3f6e7594a04f8cd5f4371875940725
7 Bug-Debian: https://bugs.debian.org/927862
8
9 ---
10 youtube_dl/extractor/youtube.py | 9 ++++++---
11 1 file changed, 6 insertions(+), 3 deletions(-)
12
13 --- a/youtube_dl/extractor/youtube.py
14 +++ b/youtube_dl/extractor/youtube.py
15 @@ -1648,7 +1648,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor
16 view_count = extract_view_count(get_video_info)
17 if not video_info:
18 video_info = get_video_info
19 - if 'token' in get_video_info:
20 + get_token = get_video_info.get('token') or get_video_info.get('account_playback_token')
21 + if get_token:
22 # Different get_video_info requests may report different results, e.g.
23 # some may report video unavailability, but some may serve it without
24 # any complaint (see https://github.com/rg3/youtube-dl/issues/7362,
25 @@ -1658,7 +1659,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor
26 # due to YouTube measures against IP ranges of hosting providers.
27 # Working around by preferring the first succeeded video_info containing
28 # the token if no such video_info yet was found.
29 - if 'token' not in video_info:
30 + token = video_info.get('token') or video_info.get('account_playback_token')
31 + if not token:
32 video_info = get_video_info
33 break
34
35 @@ -1667,7 +1669,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor
36 r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
37 video_webpage, 'unavailable message', default=None)
38
39 - if 'token' not in video_info:
40 + token = video_info.get('token') or video_info.get('account_playback_token')
41 + if not token:
42 if 'reason' in video_info:
43 if 'The uploader has not made this video available in your country.' in video_info['reason']:
44 regions_allowed = self._html_search_meta(