diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-02-07 19:47:09 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-02-07 19:47:09 +0600 |
commit | 8411229bd5e147ef1ac3420000c7c28ba660df2d (patch) | |
tree | e0401068ff23d53326a18dab586b5a1fea157164 | |
parent | 72b9ebc65da3f1cb2f85d85b002674c8e5ae36ce (diff) |
[utils] Allow dot in strip_jsonp
-rw-r--r-- | test/test_utils.py | 4 | ||||
-rw-r--r-- | youtube_dl/utils.py | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 909d0e51d..a1e416dd5 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -494,6 +494,10 @@ class TestUtil(unittest.TestCase): d = json.loads(stripped) self.assertEqual(d, {'STATUS': 'OK'}) + stripped = strip_jsonp('ps.embedHandler({"status": "success"});') + d = json.loads(stripped) + self.assertEqual(d, {'status': 'success'}) + def test_uppercase_escape(self): self.assertEqual(uppercase_escape('aä'), 'aä') self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐') diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index f3b0180ab..dce67de8a 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1749,7 +1749,7 @@ def parse_age_limit(s): def strip_jsonp(code): return re.sub( - r'(?s)^[a-zA-Z0-9_]+\s*\(\s*(.*)\);?\s*?(?://[^\n]*)*$', r'\1', code) + r'(?s)^[a-zA-Z0-9_.]+\s*\(\s*(.*)\);?\s*?(?://[^\n]*)*$', r'\1', code) def js_to_json(code): |