mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
replace split with strip_jsonp
This commit is contained in:
parent
5c97ec5ff5
commit
6a41a12d29
1 changed files with 2 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
js_to_json,
|
js_to_json,
|
||||||
|
strip_jsonp,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ def _real_extract(self, url):
|
||||||
genvisitor_url = 'https://passport.weibo.com/visitor/genvisitor'
|
genvisitor_url = 'https://passport.weibo.com/visitor/genvisitor'
|
||||||
webpage, _ = self._download_webpage_handle(genvisitor_url, video_id, data=data, headers=headers, note="gen visitor")
|
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('{')
|
i1 = p.find('{')
|
||||||
i2 = p.rfind('}')
|
i2 = p.rfind('}')
|
||||||
j = p[i1:i2 + 1] # get JSON object
|
j = p[i1:i2 + 1] # get JSON object
|
||||||
|
|
Loading…
Reference in a new issue