diff options
author | Sergey M․ <dstftw@gmail.com> | 2017-02-13 23:44:43 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2017-02-13 23:44:43 +0700 |
commit | 085f169ffebc17ec8b2bfc63aec8f5df57c7bdcf (patch) | |
tree | 610999a1f38927b06e2db55d46c9fdf643940b08 | |
parent | f6d6ca1db3020e7c7771880d0c4b58fdf732a8d5 (diff) |
[xtube] Fix extraction for both kinds of video id (closes #12088)
-rw-r--r-- | youtube_dl/extractor/xtube.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/youtube_dl/extractor/xtube.py b/youtube_dl/extractor/xtube.py index ed3a37649..5584674a0 100644 --- a/youtube_dl/extractor/xtube.py +++ b/youtube_dl/extractor/xtube.py @@ -44,6 +44,9 @@ class XTubeIE(InfoExtractor): }, { 'url': 'xtube:625837', 'only_matching': True, + }, { + 'url': 'xtube:kVTUy_G222_', + 'only_matching': True, }] def _real_extract(self, url): @@ -53,11 +56,16 @@ class XTubeIE(InfoExtractor): if not display_id: display_id = video_id - url = 'http://www.xtube.com/watch.php?v=%s' % video_id - req = sanitized_Request(url) - req.add_header('Cookie', 'age_verified=1; cookiesAccepted=1') - webpage = self._download_webpage(req, display_id) + if video_id.isdigit() and len(video_id) < 11: + url_pattern = 'http://www.xtube.com/video-watch/-%s' + else: + url_pattern = 'http://www.xtube.com/watch.php?v=%s' + + webpage = self._download_webpage( + url_pattern % video_id, display_id, headers={ + 'Cookie': 'age_verified=1; cookiesAccepted=1', + }) sources = self._parse_json(self._search_regex( r'(["\'])sources\1\s*:\s*(?P<sources>{.+?}),', |