mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-10 00:58:17 +02:00
Changes suggested by @phihag
This commit is contained in:
parent
cc6943e86a
commit
5c1d63b737
@ -36,21 +36,21 @@ def _real_initialize(self):
|
|||||||
request.add_header(
|
request.add_header(
|
||||||
'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8')
|
'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8')
|
||||||
compat_urllib_request.urlopen(request).info()
|
compat_urllib_request.urlopen(request).info()
|
||||||
|
request = compat_urllib_request.Request(self._LOGIN_URL)
|
||||||
|
webpage = compat_urllib_request.urlopen(request).read()
|
||||||
|
|
||||||
|
if webpage != 'OK':
|
||||||
|
self._downloader.report_error(
|
||||||
|
u'Unable to log in: bad username/password')
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
video_id = re.match(self._VALID_URL, url).group(1)
|
||||||
|
|
||||||
request = compat_urllib_request.Request(url)
|
request = compat_urllib_request.Request(url)
|
||||||
webpage = unicode(
|
webpage = self._download_webpage(url, video_id)
|
||||||
compat_urllib_request.urlopen(request).read(), 'utf-8')
|
|
||||||
|
|
||||||
video_id = re.match(self._VALID_URL, url).group(1)
|
|
||||||
|
|
||||||
url_info = re.search(r'streamer="(.*?)" src="(.*?)"', webpage)
|
url_info = re.search(r'streamer="(.*?)" src="(.*?)"', webpage)
|
||||||
|
|
||||||
if url_info is None:
|
|
||||||
self._downloader.report_warning(
|
|
||||||
u'Unable to log in: bad username/password')
|
|
||||||
return
|
|
||||||
return {'id': video_id,
|
return {'id': video_id,
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
|
Loading…
Reference in New Issue
Block a user