diff options
-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): |