[youtube] fix for new base.js (close #823)

This commit is contained in:
Mort Yao 2015-12-22 11:58:09 +01:00
parent 371d5f2fed
commit 12465a6a30

View File

@ -51,9 +51,10 @@ class YouTube(VideoExtractor):
code = re.sub(r'(\w+).split\(""\)', r'list(\1)', code)
return code
js = js.replace('\n', ' ')
f1 = match1(js, r'\w+\.sig\|\|([$\w]+)\(\w+\.\w+\)')
f1def = match1(js, r'function %s(\(\w+\)\{[^\{]+\})' % re.escape(f1)) or \
match1(js, r'var %s=function(\(\w+\)\{[^\{]+\})' % re.escape(f1))
match1(js, r'\W%s=function(\(\w+\)\{[^\{]+\})' % re.escape(f1))
f1def = re.sub(r'([$\w]+\.)([$\w]+\(\w+,\d+\))', r'\2', f1def)
f1def = 'function %s%s' % (re.escape(f1), f1def)
code = tr_js(f1def)