aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-05-18 22:57:38 +0700
committerSergey M․ <dstftw@gmail.com>2017-05-18 22:57:38 +0700
commit0e2d626ddd2c0c4a8e369026812c7092f5d17de2 (patch)
tree349f802d8bdfc8ff12f39776f36410b30a6c398d /youtube_dl
parent9221d5d7a84fd778d54806b3d72b58392481f2bc (diff)
downloadyoutube-dl-0e2d626ddd2c0c4a8e369026812c7092f5d17de2.zip
youtube-dl-0e2d626ddd2c0c4a8e369026812c7092f5d17de2.tar.gz
youtube-dl-0e2d626ddd2c0c4a8e369026812c7092f5d17de2.tar.bz2
[jsinterp] Fix typo and cleanup regexes (closes #13134)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/jsinterp.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py
index 0389100..7bda596 100644
--- a/youtube_dl/jsinterp.py
+++ b/youtube_dl/jsinterp.py
@@ -214,15 +214,18 @@ class JSInterpreter(object):
_FUNC_NAME_RE = r'''(?:[a-zA-Z$0-9]+|"[a-zA-Z$0-9]+"|'[a-zA-Z$0-9]+')'''
obj = {}
obj_m = re.search(
- (r'(?<!this\.)%s\s*=\s*\{' % re.escape(objname)) +
- r'\s*(?P<fields>(%s\s*:\s*function\(.*?\)\s*\{.*?\}(?:,\s*)?)*)' +
- r'\}\s*;' % _FUNC_NAME_RE,
+ r'''(?x)
+ (?<!this\.)%s\s*=\s*{\s*
+ (?P<fields>(%s\s*:\s*function\s*\(.*?\)\s*{.*?}(?:,\s*)?)*)
+ }\s*;
+ ''' % (re.escape(objname), _FUNC_NAME_RE),
self.code)
fields = obj_m.group('fields')
# Currently, it only supports function definitions
fields_m = re.finditer(
- r'(?P<key>%s)\s*:\s*function'
- r'\((?P<args>[a-z,]+)\){(?P<code>[^}]+)}' % _FUNC_NAME_RE,
+ r'''(?x)
+ (?P<key>%s)\s*:\s*function\s*\((?P<args>[a-z,]+)\){(?P<code>[^}]+)}
+ ''' % _FUNC_NAME_RE,
fields)
for f in fields_m:
argnames = f.group('args').split(',')