1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[vuclip] Fix extraction

This commit is contained in:
Yen Chi Hsuan 2016-07-11 00:52:25 +08:00
parent ae01850165
commit e2dbcaa1bf
No known key found for this signature in database
GPG key ID: 3FDDD575826C5C30

View file

@ -9,7 +9,7 @@ from ..compat import (
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
parse_duration, parse_duration,
qualities, remove_end,
) )
@ -22,7 +22,7 @@ class VuClipIE(InfoExtractor):
'id': '922692425', 'id': '922692425',
'ext': '3gp', 'ext': '3gp',
'title': 'The Toy Soldiers - Hollywood Movie Trailer', 'title': 'The Toy Soldiers - Hollywood Movie Trailer',
'duration': 180, 'duration': 177,
} }
} }
@ -46,34 +46,21 @@ class VuClipIE(InfoExtractor):
'%s said: %s' % (self.IE_NAME, error_msg), expected=True) '%s said: %s' % (self.IE_NAME, error_msg), expected=True)
# These clowns alternate between two page types # These clowns alternate between two page types
links_code = self._search_regex( video_url = self._search_regex(
r'''(?xs) r'<a[^>]+href="([^"]+)"[^>]*><img[^>]+src="[^"]*/play\.gif',
(?: webpage, 'video URL', default=None)
<img\s+src="[^"]*/play.gif".*?>| if video_url:
<!--\ player\ end\ -->\s*</div><!--\ thumb\ end--> formats = [{
) 'url': video_url,
(.*?) }]
(?: else:
<a\s+href="fblike|<div\s+class="social"> formats = self._parse_html5_media_entries(url, webpage)[0]['formats']
)
''', webpage, 'links')
title = self._html_search_regex(
r'<title>(.*?)-\s*Vuclip</title>', webpage, 'title').strip()
quality_order = qualities(['Reg', 'Hi']) title = remove_end(self._html_search_regex(
formats = [] r'<title>(.*?)-\s*Vuclip</title>', webpage, 'title').strip(), ' - Video')
for url, q in re.findall(
r'<a\s+href="(?P<url>[^"]+)".*?>(?:<button[^>]*>)?(?P<q>[^<]+)(?:</button>)?</a>', links_code):
format_id = compat_urllib_parse_urlparse(url).scheme + '-' + q
formats.append({
'format_id': format_id,
'url': url,
'quality': quality_order(q),
})
self._sort_formats(formats)
duration = parse_duration(self._search_regex( duration = parse_duration(self._html_search_regex(
r'\(([0-9:]+)\)</span>', webpage, 'duration', fatal=False)) r'[(>]([0-9]+:[0-9]+)(?:<span|\))', webpage, 'duration', fatal=False))
return { return {
'id': video_id, 'id': video_id,