From: Sergey M․ Date: Sun, 7 Feb 2016 13:47:09 +0000 (+0600) Subject: [utils] Allow dot in strip_jsonp X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=8411229bd5e147ef1ac3420000c7c28ba660df2d;p=youtube-dl [utils] Allow dot in strip_jsonp --- 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):