mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 17:22:31 +01:00
[vuclip] Fix extraction
This commit is contained in:
parent
e7db973328
commit
59c03a9bfb
@ -5,6 +5,7 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse_urlparse,
|
compat_urllib_parse_urlparse,
|
||||||
|
ExtractorError,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
qualities,
|
qualities,
|
||||||
)
|
)
|
||||||
@ -14,13 +15,12 @@ class VuClipIE(InfoExtractor):
|
|||||||
_VALID_URL = r'http://(?:m\.)?vuclip\.com/w\?.*?cid=(?P<id>[0-9]+)'
|
_VALID_URL = r'http://(?:m\.)?vuclip\.com/w\?.*?cid=(?P<id>[0-9]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://m.vuclip.com/w?cid=843902317&fid=63532&z=1007&nvar&frm=index.html&bu=4757321434',
|
'url': 'http://m.vuclip.com/w?cid=922692425&fid=70295&z=1010&nvar&frm=index.html',
|
||||||
'md5': '92ac9d1ccefec4f0bb474661ab144fcf',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '843902317',
|
'id': '922692425',
|
||||||
'ext': '3gp',
|
'ext': '3gp',
|
||||||
'title': 'Movie Trailer: Noah',
|
'title': 'The Toy Soldiers - Hollywood Movie Trailer',
|
||||||
'duration': 139,
|
'duration': 180,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,9 @@ 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')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
#webpage = self._download_webpage(url, video_id)
|
||||||
|
import io
|
||||||
|
webpage = io.open('922692425_http_-_m.vuclip.com_wcid=922692425_fid=70295_z=1010_nvar_frm=index.html.dump', encoding='utf-8').read()
|
||||||
ad_m = re.search(
|
ad_m = re.search(
|
||||||
r'''value="No.*?" onClick="location.href='([^"']+)'"''', webpage)
|
r'''value="No.*?" onClick="location.href='([^"']+)'"''', webpage)
|
||||||
if ad_m:
|
if ad_m:
|
||||||
@ -37,16 +39,32 @@ def _real_extract(self, url):
|
|||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
adfree_url, video_id, note='Download post-ad page')
|
adfree_url, video_id, note='Download post-ad page')
|
||||||
|
|
||||||
|
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
|
||||||
links_code = self._search_regex(
|
links_code = self._search_regex(
|
||||||
r'(?s)<div class="social align_c".*?>(.*?)<hr\s*/?>', webpage,
|
r'''(?xs)
|
||||||
'links')
|
(?:
|
||||||
|
<img\s+src="/im/play.gif".*?>|
|
||||||
|
<!--\ player\ end\ -->\s*</div><!--\ thumb\ end-->
|
||||||
|
)
|
||||||
|
(.*?)
|
||||||
|
(?:
|
||||||
|
<a\s+href="fblike'|<div\s+class="social">
|
||||||
|
)
|
||||||
|
''', webpage, 'links')
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<title>(.*?)-\s*Vuclip</title>', webpage, 'title').strip()
|
r'<title>(.*?)-\s*Vuclip</title>', webpage, 'title').strip()
|
||||||
|
|
||||||
quality_order = qualities(['Reg', 'Hi'])
|
quality_order = qualities(['Reg', 'Hi'])
|
||||||
formats = []
|
formats = []
|
||||||
for url, q in re.findall(
|
for url, q in re.findall(
|
||||||
r'<a href="(?P<url>[^"]+)".*?>(?P<q>[^<]+)</a>', links_code):
|
r'<a\s+href="(?P<url>[^"]+)".*?>(?:<button[^>]*>)?(?P<q>[^<]+)(?:</button>)?</a>', links_code):
|
||||||
format_id = compat_urllib_parse_urlparse(url).scheme + '-' + q
|
format_id = compat_urllib_parse_urlparse(url).scheme + '-' + q
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
@ -56,7 +74,7 @@ def _real_extract(self, url):
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
duration = parse_duration(self._search_regex(
|
duration = parse_duration(self._search_regex(
|
||||||
r'\(([0-9:]+)\)</span></h1>', webpage, 'duration', fatal=False))
|
r'\(([0-9:]+)\)</span>', webpage, 'duration', fatal=False))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user