mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-02 19:36:45 +00:00
[cliphinter] Fix extraction (closes #18083)
This commit is contained in:
parent
c0345b825f
commit
432cd48410
|
@ -1,19 +1,10 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import int_or_none
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
url_or_none,
|
||||||
_translation_table = {
|
)
|
||||||
'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
|
|
||||||
'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
|
|
||||||
'y': 'l', 'z': 'i',
|
|
||||||
'$': ':', '&': '.', '(': '=', '^': '&', '=': '/',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _decode(s):
|
|
||||||
return ''.join(_translation_table.get(c, c) for c in s)
|
|
||||||
|
|
||||||
|
|
||||||
class CliphunterIE(InfoExtractor):
|
class CliphunterIE(InfoExtractor):
|
||||||
|
@ -60,14 +51,14 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for format_id, f in gexo_files.items():
|
for format_id, f in gexo_files.items():
|
||||||
video_url = f.get('url')
|
video_url = url_or_none(f.get('url'))
|
||||||
if not video_url:
|
if not video_url:
|
||||||
continue
|
continue
|
||||||
fmt = f.get('fmt')
|
fmt = f.get('fmt')
|
||||||
height = f.get('h')
|
height = f.get('h')
|
||||||
format_id = '%s_%sp' % (fmt, height) if fmt and height else format_id
|
format_id = '%s_%sp' % (fmt, height) if fmt and height else format_id
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': _decode(video_url),
|
'url': video_url,
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
'width': int_or_none(f.get('w')),
|
'width': int_or_none(f.get('w')),
|
||||||
'height': int_or_none(height),
|
'height': int_or_none(height),
|
||||||
|
|
Loading…
Reference in a new issue