mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[tube8] Improve _VALID_URL and add display_id
This commit is contained in:
parent
516812df41
commit
58e7071a2c
1 changed files with 23 additions and 14 deletions
|
@ -14,27 +14,35 @@
|
||||||
|
|
||||||
|
|
||||||
class Tube8IE(InfoExtractor):
|
class Tube8IE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?tube8\.com/(?:gay/|shemale/)?(?:[^/]+/){2}(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?tube8\.com/(?:[^/]+/)+(?P<display_id>[^/]+)/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
'url': 'http://www.tube8.com/teen/kasia-music-video/229795/',
|
{
|
||||||
'md5': '44bf12b98313827dd52d35b8706a4ea0',
|
'url': 'http://www.tube8.com/teen/kasia-music-video/229795/',
|
||||||
'info_dict': {
|
'md5': '44bf12b98313827dd52d35b8706a4ea0',
|
||||||
'id': '229795',
|
'info_dict': {
|
||||||
'ext': 'mp4',
|
'id': '229795',
|
||||||
'description': 'hot teen Kasia grinding',
|
'display_id': 'kasia-music-video',
|
||||||
'uploader': 'unknown',
|
'ext': 'mp4',
|
||||||
'title': 'Kasia music video',
|
'description': 'hot teen Kasia grinding',
|
||||||
'age_limit': 18,
|
'uploader': 'unknown',
|
||||||
}
|
'title': 'Kasia music video',
|
||||||
}
|
'age_limit': 18,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.tube8.com/shemale/teen/blonde-cd-gets-kidnapped-by-two-blacks-and-punished-for-being-a-slutty-girl/19569151/',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
display_id = mobj.group('display_id')
|
||||||
|
|
||||||
req = compat_urllib_request.Request(url)
|
req = compat_urllib_request.Request(url)
|
||||||
req.add_header('Cookie', 'age_verified=1')
|
req.add_header('Cookie', 'age_verified=1')
|
||||||
webpage = self._download_webpage(req, video_id)
|
webpage = self._download_webpage(req, display_id)
|
||||||
|
|
||||||
flashvars = json.loads(self._html_search_regex(
|
flashvars = json.loads(self._html_search_regex(
|
||||||
r'var flashvars\s*=\s*({.+?})', webpage, 'flashvars'))
|
r'var flashvars\s*=\s*({.+?})', webpage, 'flashvars'))
|
||||||
|
@ -70,6 +78,7 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
|
|
Loading…
Reference in a new issue