mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.2 KiB
Python
69 lines
2.2 KiB
Python
![]()
10 years ago
|
import re
|
||
|
|
||
|
from .common import InfoExtractor
|
||
![]()
10 years ago
|
from ..compat import (
|
||
![]()
10 years ago
|
compat_urllib_parse_urlparse,
|
||
![]()
10 years ago
|
)
|
||
|
from ..utils import (
|
||
![]()
10 years ago
|
ExtractorError,
|
||
![]()
10 years ago
|
parse_duration,
|
||
![]()
8 years ago
|
remove_end,
|
||
![]()
10 years ago
|
)
|
||
|
|
||
|
|
||
|
class VuClipIE(InfoExtractor):
|
||
![]()
9 years ago
|
_VALID_URL = r'https?://(?:m\.)?vuclip\.com/w\?.*?cid=(?P<id>[0-9]+)'
|
||
![]()
10 years ago
|
|
||
|
_TEST = {
|
||
![]()
8 years ago
|
'url': 'http://m.vuclip.com/w?cid=1129900602&bu=8589892792&frm=w&z=34801&op=0&oc=843169247§ion=recommend',
|
||
![]()
10 years ago
|
'info_dict': {
|
||
![]()
8 years ago
|
'id': '1129900602',
|
||
![]()
10 years ago
|
'ext': '3gp',
|
||
![]()
8 years ago
|
'title': 'Top 10 TV Convicts',
|
||
|
'duration': 733,
|
||
![]()
10 years ago
|
}
|
||
|
}
|
||
|
|
||
|
def _real_extract(self, url):
|
||
![]()
10 years ago
|
video_id = self._match_id(url)
|
||
![]()
10 years ago
|
webpage = self._download_webpage(url, video_id)
|
||
![]()
10 years ago
|
|
||
![]()
10 years ago
|
ad_m = re.search(
|
||
|
r'''value="No.*?" onClick="location.href='([^"']+)'"''', webpage)
|
||
|
if ad_m:
|
||
|
urlr = compat_urllib_parse_urlparse(url)
|
||
|
adfree_url = urlr.scheme + '://' + urlr.netloc + ad_m.group(1)
|
||
|
webpage = self._download_webpage(
|
||
|
adfree_url, video_id, note='Download post-ad page')
|
||
|
|
||
![]()
10 years ago
|
error_msg = self._html_search_regex(
|
||
|
r'<p class="message">(.*?)</p>', webpage, 'error message',
|
||
|
default=None)
|
||
|
if error_msg:
|
||
|
raise ExtractorError(
|
||
|
'%s said: %s' % (self.IE_NAME, error_msg), expected=True)
|
||
|
|
||
|
# These clowns alternate between two page types
|
||
![]()
8 years ago
|
video_url = self._search_regex(
|
||
|
r'<a[^>]+href="([^"]+)"[^>]*><img[^>]+src="[^"]*/play\.gif',
|
||
|
webpage, 'video URL', default=None)
|
||
|
if video_url:
|
||
|
formats = [{
|
||
|
'url': video_url,
|
||
|
}]
|
||
|
else:
|
||
![]()
8 years ago
|
formats = self._parse_html5_media_entries(url, webpage, video_id)[0]['formats']
|
||
![]()
10 years ago
|
|
||
![]()
8 years ago
|
title = remove_end(self._html_search_regex(
|
||
|
r'<title>(.*?)-\s*Vuclip</title>', webpage, 'title').strip(), ' - Video')
|
||
![]()
10 years ago
|
|
||
![]()
8 years ago
|
duration = parse_duration(self._html_search_regex(
|
||
|
r'[(>]([0-9]+:[0-9]+)(?:<span|\))', webpage, 'duration', fatal=False))
|
||
![]()
10 years ago
|
|
||
|
return {
|
||
|
'id': video_id,
|
||
|
'formats': formats,
|
||
|
'title': title,
|
||
|
'duration': duration,
|
||
|
}
|