aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/jsinterp.py
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2016-11-05 06:11:51 +0100
committerKacper Michajłow <kasper93@gmail.com>2016-11-11 15:36:57 +0100
commit189935f15960300d316e8b07108b076ac6c2186a (patch)
treee6a41b6feebe5a29ea18e30308d0202b460d71a7 /youtube_dl/jsinterp.py
parentbc40b3a5ba44006c23daf7fe0ed872af5e33bdc5 (diff)
[jsinterp] Fix function calls without arguments.
Diffstat (limited to 'youtube_dl/jsinterp.py')
-rw-r--r--youtube_dl/jsinterp.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py
index 9737f7002..a8df4aef0 100644
--- a/youtube_dl/jsinterp.py
+++ b/youtube_dl/jsinterp.py
@@ -198,12 +198,12 @@ class JSInterpreter(object):
return opfunc(x, y)
m = re.match(
- r'^(?P<func>%s)\((?P<args>[a-zA-Z0-9_$,]+)\)$' % _NAME_RE, expr)
+ r'^(?P<func>%s)\((?P<args>[a-zA-Z0-9_$,]*)\)$' % _NAME_RE, expr)
if m:
fname = m.group('func')
argvals = tuple([
int(v) if v.isdigit() else local_vars[v]
- for v in m.group('args').split(',')])
+ for v in m.group('args').split(',')]) if len(m.group('args')) > 0 else tuple()
if fname not in self._functions:
self._functions[fname] = self.extract_function(fname)
return self._functions[fname](argvals)