mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-22 16:44:32 +01:00
[utils] Allow JSONP with empty func name (closes #17028)
This commit is contained in:
parent
fd62b36680
commit
e9c671d5e8
@ -717,6 +717,10 @@ class TestUtil(unittest.TestCase):
|
|||||||
d = json.loads(stripped)
|
d = json.loads(stripped)
|
||||||
self.assertEqual(d, {'status': 'success'})
|
self.assertEqual(d, {'status': 'success'})
|
||||||
|
|
||||||
|
stripped = strip_jsonp('({"status": "success"});')
|
||||||
|
d = json.loads(stripped)
|
||||||
|
self.assertEqual(d, {'status': 'success'})
|
||||||
|
|
||||||
def test_uppercase_escape(self):
|
def test_uppercase_escape(self):
|
||||||
self.assertEqual(uppercase_escape('aä'), 'aä')
|
self.assertEqual(uppercase_escape('aä'), 'aä')
|
||||||
self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐')
|
self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐')
|
||||||
|
@ -2282,7 +2282,7 @@ def parse_age_limit(s):
|
|||||||
def strip_jsonp(code):
|
def strip_jsonp(code):
|
||||||
return re.sub(
|
return re.sub(
|
||||||
r'''(?sx)^
|
r'''(?sx)^
|
||||||
(?:window\.)?(?P<func_name>[a-zA-Z0-9_.$]+)
|
(?:window\.)?(?P<func_name>[a-zA-Z0-9_.$]*)
|
||||||
(?:\s*&&\s*(?P=func_name))?
|
(?:\s*&&\s*(?P=func_name))?
|
||||||
\s*\(\s*(?P<callback_data>.*)\);?
|
\s*\(\s*(?P<callback_data>.*)\);?
|
||||||
\s*?(?://[^\n]*)*$''',
|
\s*?(?://[^\n]*)*$''',
|
||||||
|
Loading…
Reference in New Issue
Block a user