mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 03:10:38 +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
@ -119,16 +119,16 @@ class DropoutIE(InfoExtractor):
|
||||
|
||||
def _real_extract(self, 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)
|
||||
webpage = self._download_webpage(url, display_id)
|
||||
finally:
|
||||
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 and '<div id="watch-unauthorized"' in webpage:
|
||||
if login_err is True:
|
||||
self.raise_login_required(method='password')
|
||||
self.raise_login_required(method='any')
|
||||
raise ExtractorError(login_err, expected=True)
|
||||
|
||||
embed_url = self._search_regex(r'embed_url:\s*["\'](.+?)["\']', webpage, 'embed url')
|
||||
|
Loading…
Reference in New Issue
Block a user