From: Philipp Hagemeister Date: Sun, 30 Mar 2014 05:15:14 +0000 (+0200) Subject: [jsinterp] Better error messages X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=77ffa957010fb7fe19433633223317d1147dd080;p=youtube-dl [jsinterp] Better error messages --- 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[a-z,]+)\){(?P[^}]+)}', 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):