Simplify extractor
This commit is contained in:
parent
14775e07e9
commit
1426441ad7
@ -62,45 +62,13 @@ class ScreencastIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
video_url = self._html_search_regex(
|
json_url = self._html_search_regex(
|
||||||
r'<embed name="Video".*?src="([^"]+)"', webpage,
|
r'json\+oembed" href="([^"]+)"', webpage,
|
||||||
'QuickTime embed', default=None)
|
'json embed', default=None)
|
||||||
|
data = self._download_json(json_url,video_id)
|
||||||
if video_url is None:
|
video_url = data.get('url')
|
||||||
flash_vars_s = self._html_search_regex(
|
title = data.get('title') or self._og_search_title(webpage, default=None)
|
||||||
r'<param name="flashVars" value="([^"]+)"', webpage, 'flash vars',
|
thumbnail = data.get('thumbnail_url') or self._og_search_thumbnail(webpage, default=None)
|
||||||
default=None)
|
|
||||||
if not flash_vars_s:
|
|
||||||
flash_vars_s = self._html_search_regex(
|
|
||||||
r'<param name="initParams" value="([^"]+)"', webpage, 'flash vars',
|
|
||||||
default=None)
|
|
||||||
if flash_vars_s:
|
|
||||||
flash_vars_s = flash_vars_s.replace(',', '&')
|
|
||||||
if flash_vars_s:
|
|
||||||
flash_vars = compat_parse_qs(flash_vars_s)
|
|
||||||
video_url_raw = compat_urllib_request.quote(
|
|
||||||
flash_vars['content'][0])
|
|
||||||
video_url = video_url_raw.replace('http%3A', 'http:')
|
|
||||||
|
|
||||||
if video_url is None:
|
|
||||||
video_url = self._html_search_meta(
|
|
||||||
'og:video', webpage, default=None)
|
|
||||||
|
|
||||||
if video_url is None:
|
|
||||||
video_url = self._html_search_regex(
|
|
||||||
r'"MediaContentUrl":"([^"]+)"', webpage, 'embeds', default=None)
|
|
||||||
|
|
||||||
if video_url is None:
|
|
||||||
raise ExtractorError('Cannot find video')
|
|
||||||
|
|
||||||
title = self._og_search_title(webpage, default=None)
|
|
||||||
if title is None:
|
|
||||||
title = self._html_search_regex(
|
|
||||||
[r'<b>Title:</b> ([^<]+)</div>',
|
|
||||||
r'class="tabSeperator">></span><span class="tabText">(.+?)<',
|
|
||||||
r'<title>([^<]+)</title>'],
|
|
||||||
webpage, 'title')
|
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
|
||||||
description = self._og_search_description(webpage, default=None)
|
description = self._og_search_description(webpage, default=None)
|
||||||
if description is None:
|
if description is None:
|
||||||
description = self._html_search_meta('description', webpage)
|
description = self._html_search_meta('description', webpage)
|
||||||
@ -112,3 +80,4 @@ class ScreencastIE(InfoExtractor):
|
|||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user