single quotes
This commit is contained in:
parent
6d4dd47f73
commit
56c6e3ec6c
@ -2487,7 +2487,7 @@ class InfoExtractor(object):
|
|||||||
"""
|
"""
|
||||||
mobj = re.search(
|
mobj = re.search(
|
||||||
r'new Clappr.Player\((?P<json>{.+?})\);',
|
r'new Clappr.Player\((?P<json>{.+?})\);',
|
||||||
webpage.replace("\n", "").replace("\t", ""))
|
webpage.replace('\n', '').replace('\t', ''))
|
||||||
if mobj:
|
if mobj:
|
||||||
try:
|
try:
|
||||||
clappr_data = self._parse_json(mobj.group('json'), video_id=video_id, transform_source=transform_source)
|
clappr_data = self._parse_json(mobj.group('json'), video_id=video_id, transform_source=transform_source)
|
||||||
@ -2508,9 +2508,9 @@ class InfoExtractor(object):
|
|||||||
'subtitles': {},
|
'subtitles': {},
|
||||||
}
|
}
|
||||||
info_dict['formats'] = self._extract_url_list_formats(
|
info_dict['formats'] = self._extract_url_list_formats(
|
||||||
clappr_data.get("sources", [clappr_data.get("source")]), video_id=video_id, m3u8_id=m3u8_id, mpd_id=mpd_id, rtmp_params=rtmp_params, base_url=base_url)
|
clappr_data.get('sources', [clappr_data.get('source')]), video_id=video_id, m3u8_id=m3u8_id, mpd_id=mpd_id, rtmp_params=rtmp_params, base_url=base_url)
|
||||||
|
|
||||||
thumbnail = clappr_data.get("poster")
|
thumbnail = clappr_data.get('poster')
|
||||||
if thumbnail:
|
if thumbnail:
|
||||||
info_dict['thumbnail'] = thumbnail
|
info_dict['thumbnail'] = thumbnail
|
||||||
|
|
||||||
@ -2523,7 +2523,7 @@ class InfoExtractor(object):
|
|||||||
subtitles = clappr_data.get('externalTracks') or clappr_data.get('playback', {}).get('externalTracks')
|
subtitles = clappr_data.get('externalTracks') or clappr_data.get('playback', {}).get('externalTracks')
|
||||||
if subtitles:
|
if subtitles:
|
||||||
for sub in subtitles:
|
for sub in subtitles:
|
||||||
if sub.get('kind', "subtitles") != "subtitles":
|
if sub.get('kind', 'subtitles') != 'subtitles':
|
||||||
continue
|
continue
|
||||||
lang = sub.get('lang') or sub.get('language') or sub.get('label', 'undefined')
|
lang = sub.get('lang') or sub.get('language') or sub.get('label', 'undefined')
|
||||||
src = sub.get('src')
|
src = sub.get('src')
|
||||||
@ -2537,8 +2537,8 @@ class InfoExtractor(object):
|
|||||||
subtitle = clappr_data.get('subtitle')
|
subtitle = clappr_data.get('subtitle')
|
||||||
if subtitle:
|
if subtitle:
|
||||||
if isinstance(subtitle, dict):
|
if isinstance(subtitle, dict):
|
||||||
src = subtitle.get("src")
|
src = subtitle.get('src')
|
||||||
lang = subtitle.get("lang") or subtitle.get('label')
|
lang = subtitle.get('lang') or subtitle.get('label')
|
||||||
else:
|
else:
|
||||||
src = subtitle
|
src = subtitle
|
||||||
if src:
|
if src:
|
||||||
@ -2547,7 +2547,7 @@ class InfoExtractor(object):
|
|||||||
if not lang:
|
if not lang:
|
||||||
lang = src.split('/')[-1]
|
lang = src.split('/')[-1]
|
||||||
if video_id in lang:
|
if video_id in lang:
|
||||||
lang = lang.replace("%s_" % video_id, '').replace(video_id, '').replace(".%s" % ext, '')
|
lang = lang.replace('%s_' % video_id, '').replace(video_id, '').replace('.%s' % ext, '')
|
||||||
info_dict['subtitles'].setdefault(lang, []).append({
|
info_dict['subtitles'].setdefault(lang, []).append({
|
||||||
'url': src,
|
'url': src,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
@ -2626,7 +2626,7 @@ class InfoExtractor(object):
|
|||||||
if base_url:
|
if base_url:
|
||||||
source_url = compat_urlparse.urljoin(base_url, source_url)
|
source_url = compat_urlparse.urljoin(base_url, source_url)
|
||||||
ext = mimetype2ext(mime) or determine_ext(source_url, 'mp4')
|
ext = mimetype2ext(mime) or determine_ext(source_url, 'mp4')
|
||||||
if ext == "m3u8":
|
if ext == 'm3u8':
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
source_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
source_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
m3u8_id=m3u8_id, fatal=False, preference=1))
|
m3u8_id=m3u8_id, fatal=False, preference=1))
|
||||||
@ -2636,16 +2636,16 @@ class InfoExtractor(object):
|
|||||||
elif ext == 'smil':
|
elif ext == 'smil':
|
||||||
formats.extend(self._extract_smil_formats(
|
formats.extend(self._extract_smil_formats(
|
||||||
source_url, video_id, fatal=False))
|
source_url, video_id, fatal=False))
|
||||||
elif ext == "f4m":
|
elif ext == 'f4m':
|
||||||
formats.extend(self._extract_f4m_formats(
|
formats.extend(self._extract_f4m_formats(
|
||||||
source_url, video_id, m3u8_id=m3u8_id, fatal=False))
|
source_url, video_id, m3u8_id=m3u8_id, fatal=False))
|
||||||
else:
|
else:
|
||||||
urlh = self._request_webpage(source_url, video_id, note="Checking format %d information" % format_id, fatal=False)
|
urlh = self._request_webpage(source_url, video_id, note='Checking format %d information' % format_id, fatal=False)
|
||||||
size = int(urlh.headers.get('Content-Length'))
|
size = int(urlh.headers.get('Content-Length'))
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': source_url,
|
'url': source_url,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
'format_id': "%d" % format_id,
|
'format_id': '%d' % format_id,
|
||||||
'filesize': size,
|
'filesize': size,
|
||||||
'preference': int(size / 1024 / 1024 / 10),
|
'preference': int(size / 1024 / 1024 / 10),
|
||||||
})
|
})
|
||||||
|
@ -31,11 +31,11 @@ class VidloxIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
page_url = "https://vidlox.me/%s" % video_id
|
page_url = 'https://vidlox.me/%s' % video_id
|
||||||
phantom = PhantomJSwrapper(self, required_version='2.0')
|
phantom = PhantomJSwrapper(self, required_version='2.0')
|
||||||
|
|
||||||
# download page for couple simple test
|
# download page for couple simple test
|
||||||
webpage = self._download_webpage(page_url, video_id).replace("\n", "").replace("\t", "")
|
webpage = self._download_webpage(page_url, video_id).replace('\n', '').replace('\t', '')
|
||||||
if 'File not found' in webpage:
|
if 'File not found' in webpage:
|
||||||
raise ExtractorError('File not found', expected=True, video_id=video_id)
|
raise ExtractorError('File not found', expected=True, video_id=video_id)
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class VidloxIE(InfoExtractor):
|
|||||||
# extract tilte and download embed
|
# extract tilte and download embed
|
||||||
title = self._html_search_regex(r'<title[^>]*?>(?P<title>.+?)\s*</title>', webpage, 'title').replace('Watch ', '', 1)
|
title = self._html_search_regex(r'<title[^>]*?>(?P<title>.+?)\s*</title>', webpage, 'title').replace('Watch ', '', 1)
|
||||||
webpage = None
|
webpage = None
|
||||||
page_url = "https://vidlox.me/embed-%s.html" % video_id
|
page_url = 'https://vidlox.me/embed-%s.html' % video_id
|
||||||
|
|
||||||
# execute JS
|
# execute JS
|
||||||
webpage, _ = phantom.get(page_url, webpage, video_id=video_id)
|
webpage, _ = phantom.get(page_url, webpage, video_id=video_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user