mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:57:40 +00:00
[cliphunter] Fix extraction (Closes #7796)
This commit is contained in:
parent
b09c122373
commit
39fa4cc107
1 changed files with 19 additions and 24 deletions
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import determine_ext
|
from ..utils import int_or_none
|
||||||
|
|
||||||
|
|
||||||
_translation_table = {
|
_translation_table = {
|
||||||
|
@ -42,31 +42,26 @@ class CliphunterIE(InfoExtractor):
|
||||||
video_title = self._search_regex(
|
video_title = self._search_regex(
|
||||||
r'mediaTitle = "([^"]+)"', webpage, 'title')
|
r'mediaTitle = "([^"]+)"', webpage, 'title')
|
||||||
|
|
||||||
fmts = {}
|
gexo_files = self._parse_json(
|
||||||
for fmt in ('mp4', 'flv'):
|
self._search_regex(
|
||||||
fmt_list = self._parse_json(self._search_regex(
|
r'var\s+gexoFiles\s*=\s*({.+?});', webpage, 'gexo files'),
|
||||||
r'var %sjson\s*=\s*(\[.*?\]);' % fmt, webpage, '%s formats' % fmt), video_id)
|
video_id)
|
||||||
for f in fmt_list:
|
|
||||||
fmts[f['fname']] = _decode(f['sUrl'])
|
|
||||||
|
|
||||||
qualities = self._parse_json(self._search_regex(
|
|
||||||
r'var player_btns\s*=\s*(.*?);\n', webpage, 'quality info'), video_id)
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for fname, url in fmts.items():
|
for format_id, f in gexo_files.items():
|
||||||
f = {
|
video_url = f.get('url')
|
||||||
'url': url,
|
if not video_url:
|
||||||
}
|
continue
|
||||||
if fname in qualities:
|
fmt = f.get('fmt')
|
||||||
qual = qualities[fname]
|
height = f.get('h')
|
||||||
f.update({
|
format_id = '%s_%sp' % (fmt, height) if fmt and height else format_id
|
||||||
'format_id': '%s_%sp' % (determine_ext(url), qual['h']),
|
formats.append({
|
||||||
'width': qual['w'],
|
'url': _decode(video_url),
|
||||||
'height': qual['h'],
|
'format_id': format_id,
|
||||||
'tbr': qual['br'],
|
'width': int_or_none(f.get('w')),
|
||||||
})
|
'height': int_or_none(height),
|
||||||
formats.append(f)
|
'tbr': int_or_none(f.get('br')),
|
||||||
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
thumbnail = self._search_regex(
|
thumbnail = self._search_regex(
|
||||||
|
|
Loading…
Reference in a new issue