mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-12 22:07:22 +08:00
[vidzi] Fix extraction as described in #6819
This commit is contained in:
parent
dd467d33d0
commit
ebd5dcde56
@ -2,6 +2,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .common import InfoExtractor
|
||||
import re
|
||||
import string
|
||||
|
||||
|
||||
class VidziIE(InfoExtractor):
|
||||
@ -16,10 +18,42 @@ class VidziIE(InfoExtractor):
|
||||
},
|
||||
}
|
||||
|
||||
def int2base(self, x, base):
|
||||
digs = string.digits + string.ascii_letters
|
||||
if x < 0:
|
||||
sign = -1
|
||||
elif x == 0:
|
||||
return digs[0]
|
||||
else:
|
||||
sign = 1
|
||||
x *= sign
|
||||
digits = []
|
||||
while x:
|
||||
digits.append(digs[x % base])
|
||||
x = x // base
|
||||
if sign < 0:
|
||||
digits.append('-')
|
||||
digits.reverse()
|
||||
return ''.join(digits)
|
||||
|
||||
def unpack_packer(self, p, a, c, k, s):
|
||||
k = k.split(s)
|
||||
for i in range(int(c) - 1, 1, -1):
|
||||
p = re.sub('\\b' + self.int2base(i, int(a)) + '\\b', k[i], p)
|
||||
return p
|
||||
|
||||
def unpack(self, content):
|
||||
packers = re.findall(r'function\(p,a,c,k,e,d\){.+}\(\'.*\',\d+,\d+,\'[^\']+\'\.split\(\'.\'\)', content)
|
||||
for (packer) in packers:
|
||||
p, a, c, k, s = re.search(r'function\(p,a,c,k,e,d\){.+}\(\'(.*)\',(\d+),(\d+),\'([^\']+)\'\.split\(\'(.)\'\)', packer).groups()
|
||||
content = content.replace(packer, self.unpack_packer(p, a, c, k, s))
|
||||
return content
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
webpage = self.unpack(webpage)
|
||||
video_url = self._html_search_regex(
|
||||
r'{\s*file\s*:\s*"([^"]+)"\s*}', webpage, 'video url')
|
||||
title = self._html_search_regex(
|
||||
|
Loading…
x
Reference in New Issue
Block a user