projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2b25cb5
)
[jsinterp] Better error messages
author
Philipp Hagemeister
<phihag@phihag.de>
Sun, 30 Mar 2014 05:15:14 +0000
(07:15 +0200)
committer
Philipp Hagemeister
<phihag@phihag.de>
Sun, 30 Mar 2014 05:15:14 +0000
(07:15 +0200)
youtube_dl/jsinterp.py
patch
|
blob
|
history
diff --git
a/youtube_dl/jsinterp.py
b/youtube_dl/jsinterp.py
index 129a4027bd044b4dddec281f9386a4639c1ca39f..449482d3cf8dd147c62717ebc3332bbcbf6eb869 100644
(file)
--- a/
youtube_dl/jsinterp.py
+++ b/
youtube_dl/jsinterp.py
@@
-99,9
+99,12
@@
class JSInterpreter(object):
def extract_function(self, funcname):
func_m = re.search(
- r'function ' + re.escape(funcname) +
+ (r'(?:function %s|%s\s*=\s*function)' % (
+ re.escape(funcname), re.escape(funcname))) +
r'\((?P<args>[a-z,]+)\){(?P<code>[^}]+)}',
self.code)
+ if func_m is None:
+ raise ExtractorError('Could not find JS function %r' % funcname)
argnames = func_m.group('args').split(',')
def resf(args):