aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/weibo.py
diff options
context:
space:
mode:
authorsprhawk <465558+sprhawk@users.noreply.github.com>2017-12-30 01:11:30 +0800
committersprhawk <465558+sprhawk@users.noreply.github.com>2017-12-30 01:11:30 +0800
commit6a41a12d2960efb7b32d3b6ef74cf6237766b569 (patch)
treec479610fada95912cac2f8add59973b56e852286 /youtube_dl/extractor/weibo.py
parent5c97ec5ff5fd77a7975e1e946d53a76ccd5ef0de (diff)
replace split with strip_jsonp
Diffstat (limited to 'youtube_dl/extractor/weibo.py')
-rw-r--r--youtube_dl/extractor/weibo.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/extractor/weibo.py b/youtube_dl/extractor/weibo.py
index 0b28952c9..71e7123e4 100644
--- a/youtube_dl/extractor/weibo.py
+++ b/youtube_dl/extractor/weibo.py
@@ -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