[utils] Recognize more patterns in strip_jsonp()

Used in Youku Show pages
This commit is contained in:
Yen Chi Hsuan 2017-05-26 21:58:18 +08:00
parent 59ed87cbd9
commit 5552c9eb0f
No known key found for this signature in database
GPG key ID: 7F902A182457CA23
3 changed files with 15 additions and 1 deletions

View file

@ -678,6 +678,14 @@ class TestUtil(unittest.TestCase):
d = json.loads(stripped)
self.assertEqual(d, {'status': 'success'})
stripped = strip_jsonp('window.cb && window.cb({"status": "success"});')
d = json.loads(stripped)
self.assertEqual(d, {'status': 'success'})
stripped = strip_jsonp('window.cb && cb({"status": "success"});')
d = json.loads(stripped)
self.assertEqual(d, {'status': 'success'})
def test_uppercase_escape(self):
self.assertEqual(uppercase_escape(''), '')
self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐')