[XTube] Fix extraction.
This commit is contained in:
parent
397b305cfe
commit
bac2ed765f
@ -26,7 +26,6 @@ class XTubeIE(InfoExtractor):
|
|||||||
'title': 'strange erotica',
|
'title': 'strange erotica',
|
||||||
'description': 'contains:an ET kind of thing',
|
'description': 'contains:an ET kind of thing',
|
||||||
'uploader': 'greenshowers',
|
'uploader': 'greenshowers',
|
||||||
'duration': 450,
|
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -51,38 +50,39 @@ class XTubeIE(InfoExtractor):
|
|||||||
req.add_header('Cookie', 'age_verified=1; cookiesAccepted=1')
|
req.add_header('Cookie', 'age_verified=1; cookiesAccepted=1')
|
||||||
webpage = self._download_webpage(req, display_id)
|
webpage = self._download_webpage(req, display_id)
|
||||||
|
|
||||||
flashvars = self._parse_json(
|
sources = self._search_regex(r'sources:\s*({.+?}),', webpage, 'sources')
|
||||||
self._search_regex(
|
|
||||||
r'xt\.playerOps\s*=\s*({.+?});', webpage, 'player ops'),
|
|
||||||
video_id)['flashvars']
|
|
||||||
|
|
||||||
title = flashvars.get('title') or self._search_regex(
|
sourcesdict = self._parse_json(sources, video_id)
|
||||||
r'<h1>([^<]+)</h1>', webpage, 'title')
|
|
||||||
video_url = compat_urllib_parse_unquote(flashvars['video_url'])
|
formats = []
|
||||||
duration = int_or_none(flashvars.get('video_duration'))
|
for formatkey in sourcesdict.keys():
|
||||||
|
curformat = {}
|
||||||
|
curformat['height'] = int(formatkey)
|
||||||
|
curformat['url'] = sourcesdict[formatkey]
|
||||||
|
formats.append(curformat)
|
||||||
|
|
||||||
|
formats = self._sort_formats(formats)
|
||||||
|
|
||||||
|
title = self._search_regex(
|
||||||
|
r'videoTitle:\s*\'(.+?)\',', webpage, 'title')
|
||||||
|
|
||||||
uploader = self._search_regex(
|
uploader = self._search_regex(
|
||||||
r'<input[^>]+name="contentOwnerId"[^>]+value="([^"]+)"',
|
r'<span class=\"nickname\">([^<]+)',
|
||||||
webpage, 'uploader', fatal=False)
|
webpage, 'uploader', fatal=False)
|
||||||
description = self._search_regex(
|
description = self._search_regex(
|
||||||
r'</h1>\s*<p>([^<]+)', webpage, 'description', fatal=False)
|
r'</h1>\s*<p>([^<]+)', webpage, 'description', fatal=False)
|
||||||
view_count = str_to_int(self._search_regex(
|
view_count = str_to_int(self._search_regex(
|
||||||
r'<dt>Views:</dt>\s*<dd>([\d,\.]+)</dd>',
|
r'<dt>Views:</dt>\s*<dd>([\d,\.]+)</dd>',
|
||||||
webpage, 'view count', fatal=False))
|
webpage, 'view count', fatal=False))
|
||||||
comment_count = str_to_int(self._html_search_regex(
|
|
||||||
r'>Comments? \(([\d,\.]+)\)<',
|
|
||||||
webpage, 'comment count', fatal=False))
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'url': video_url,
|
'formats': formats,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'duration': duration,
|
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'comment_count': comment_count,
|
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user