]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
replace split with strip_jsonp
authorsprhawk <465558+sprhawk@users.noreply.github.com>
Fri, 29 Dec 2017 17:11:30 +0000 (01:11 +0800)
committersprhawk <465558+sprhawk@users.noreply.github.com>
Fri, 29 Dec 2017 17:11:30 +0000 (01:11 +0800)
youtube_dl/extractor/weibo.py

index 0b28952c9d62bd8c5c04cd26bf86113c73d8871f..71e7123e4354f45b12b4cace1954c49f2d7ffeac 100644 (file)
@@ -12,6 +12,7 @@ from ..compat import (
 )
 from ..utils import (
     js_to_json,
+    strip_jsonp,
     urlencode_postdata,
 )
 
@@ -52,7 +53,7 @@ class WeiboIE(InfoExtractor):
         genvisitor_url = 'https://passport.weibo.com/visitor/genvisitor'
         webpage, _ = self._download_webpage_handle(genvisitor_url, video_id, data=data, headers=headers, note="gen visitor")
 
-        p = webpage.split("&&")[1]  # split "gen_callback && gen_callback(...)"
+        p = strip_jsonp(webpage)
         i1 = p.find('{')
         i2 = p.rfind('}')
         j = p[i1:i2 + 1]  # get JSON object