mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-14 15:22:35 +00:00
[extractor/dropout] Support cookies and login only as needed (#4075)
Closes #4035 Authored by: pingiun, pukkandan
This commit is contained in:
parent
9809740ba5
commit
34baaced11
1 changed files with 7 additions and 7 deletions
|
@ -119,16 +119,16 @@ class DropoutIE(InfoExtractor):
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
login_err, webpage = False, ''
|
|
||||||
try:
|
webpage = None
|
||||||
|
if self._get_cookies('https://www.dropout.tv').get('_session'):
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
if not webpage or '<div id="watch-unauthorized"' in webpage:
|
||||||
login_err = self._login(display_id)
|
login_err = self._login(display_id)
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
finally:
|
if login_err and '<div id="watch-unauthorized"' in webpage:
|
||||||
if not login_err:
|
|
||||||
self._download_webpage('https://www.dropout.tv/logout', display_id, note='Logging out', fatal=False)
|
|
||||||
elif '<div id="watch-unauthorized"' in webpage:
|
|
||||||
if login_err is True:
|
if login_err is True:
|
||||||
self.raise_login_required(method='password')
|
self.raise_login_required(method='any')
|
||||||
raise ExtractorError(login_err, expected=True)
|
raise ExtractorError(login_err, expected=True)
|
||||||
|
|
||||||
embed_url = self._search_regex(r'embed_url:\s*["\'](.+?)["\']', webpage, 'embed url')
|
embed_url = self._search_regex(r'embed_url:\s*["\'](.+?)["\']', webpage, 'embed url')
|
||||||
|
|
Loading…
Reference in a new issue