mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-12-23 06:57:54 +01:00
[beeg] API v5 (Closes #7846)
This commit is contained in:
parent
f377f44dae
commit
d63cfc3f0f
@ -34,15 +34,29 @@ class BeegIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
video = self._download_json(
|
video = self._download_json(
|
||||||
'http://beeg.com/api/v4/video/%s' % video_id, video_id)
|
'http://beeg.com/api/v5/video/%s' % video_id, video_id)
|
||||||
|
|
||||||
|
def split(o, e):
|
||||||
|
def cut(s, x):
|
||||||
|
n.append(s[:x])
|
||||||
|
return s[x:]
|
||||||
|
n = []
|
||||||
|
r = len(o) % e
|
||||||
|
if r > 0:
|
||||||
|
o = cut(o, r)
|
||||||
|
while len(o) > e:
|
||||||
|
o = cut(o, e)
|
||||||
|
n.append(o)
|
||||||
|
return n
|
||||||
|
|
||||||
def decrypt_key(key):
|
def decrypt_key(key):
|
||||||
# Reverse engineered from http://static.beeg.com/cpl/1067.js
|
# Reverse engineered from http://static.beeg.com/cpl/1105.js
|
||||||
a = '8RPUUCS35ZWp3ADnKcSmpH71ZusrROo'
|
a = '5ShMcIQlssOd7zChAIOlmeTZDaUxULbJRnywYaiB'
|
||||||
e = compat_urllib_parse_unquote(key)
|
e = compat_urllib_parse_unquote(key)
|
||||||
return ''.join([
|
o = ''.join([
|
||||||
compat_chr(compat_ord(e[n]) - compat_ord(a[n % len(a)]) % 25)
|
compat_chr(compat_ord(e[n]) - compat_ord(a[n % len(a)]) % 21)
|
||||||
for n in range(len(e))])
|
for n in range(len(e))])
|
||||||
|
return ''.join(split(o, 3)[::-1])
|
||||||
|
|
||||||
def decrypt_url(encrypted_url):
|
def decrypt_url(encrypted_url):
|
||||||
encrypted_url = self._proto_relative_url(
|
encrypted_url = self._proto_relative_url(
|
||||||
|
Loading…
Reference in New Issue
Block a user