aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-03-30 07:15:14 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-03-30 07:15:14 +0200
commit77ffa957010fb7fe19433633223317d1147dd080 (patch)
tree7ca2f794dffb67cb3a11975217de09974129cfca /youtube_dl
parent2b25cb5d7693b62736d4cdfa656289cc429c4c81 (diff)
[jsinterp] Better error messages
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/jsinterp.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py
index 129a4027b..449482d3c 100644
--- 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):