mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 18:51:03 +01:00
fix compat_urllib_request for python2.7
This commit is contained in:
parent
951043724f
commit
2593651224
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_urllib_parse_urlencode as urlencode,
|
compat_urllib_parse_urlencode as urlencode,
|
||||||
compat_urllib_request as Request,
|
compat_urllib_request as request,
|
||||||
compat_urlparse as parse,
|
compat_urlparse as parse,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
@ -52,11 +52,10 @@ def _real_extract(self, url):
|
|||||||
'Referer': visitor_url,
|
'Referer': visitor_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
r_genvisitor = Request(
|
r_genvisitor = request.Request(
|
||||||
'https://passport.weibo.com/visitor/genvisitor',
|
'https://passport.weibo.com/visitor/genvisitor',
|
||||||
data=data,
|
data=data,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
method='POST'
|
|
||||||
)
|
)
|
||||||
webpage, urlh = self._download_webpage_handle(r_genvisitor, video_id, note="gen visitor")
|
webpage, urlh = self._download_webpage_handle(r_genvisitor, video_id, note="gen visitor")
|
||||||
|
|
||||||
@ -85,7 +84,7 @@ def _real_extract(self, url):
|
|||||||
# TODO more code goes here, for example ...
|
# TODO more code goes here, for example ...
|
||||||
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
|
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
|
||||||
|
|
||||||
video_sources_text = self._search_regex("video-sources=\\\\\"(.+?)\"", webpage, 'video_sources')
|
video_sources_text = self._search_regex(r'video-sources=\\\"(.+?)\"', webpage, 'video_sources')
|
||||||
|
|
||||||
video_formats = parse.parse_qs(video_sources_text)
|
video_formats = parse.parse_qs(video_sources_text)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user