mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-03 08:19:57 +01:00
[xtube] Fix extraction for both kinds of video id (closes #12088)
This commit is contained in:
parent
f6d6ca1db3
commit
085f169ffe
@ -44,6 +44,9 @@ class XTubeIE(InfoExtractor):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'xtube:625837',
|
'url': 'xtube:625837',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'xtube:kVTUy_G222_',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -53,11 +56,16 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
if not display_id:
|
if not display_id:
|
||||||
display_id = video_id
|
display_id = video_id
|
||||||
url = 'http://www.xtube.com/watch.php?v=%s' % video_id
|
|
||||||
|
|
||||||
req = sanitized_Request(url)
|
if video_id.isdigit() and len(video_id) < 11:
|
||||||
req.add_header('Cookie', 'age_verified=1; cookiesAccepted=1')
|
url_pattern = 'http://www.xtube.com/video-watch/-%s'
|
||||||
webpage = self._download_webpage(req, display_id)
|
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(
|
sources = self._parse_json(self._search_regex(
|
||||||
r'(["\'])sources\1\s*:\s*(?P<sources>{.+?}),',
|
r'(["\'])sources\1\s*:\s*(?P<sources>{.+?}),',
|
||||||
|
Loading…
Reference in New Issue
Block a user