1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-10 21:22:51 +01:00

[safari] Use raise_login_required

This commit is contained in:
Sergey M․ 2015-08-26 21:26:24 +06:00
parent e7ddaef5bd
commit e269d3ae7d

View File

@ -20,7 +20,6 @@
class SafariBaseIE(InfoExtractor): class SafariBaseIE(InfoExtractor):
_LOGIN_URL = 'https://www.safaribooksonline.com/accounts/login/' _LOGIN_URL = 'https://www.safaribooksonline.com/accounts/login/'
_SUCCESSFUL_LOGIN_REGEX = r'<a href="/accounts/logout/"[^>]*>Sign Out</a>' _SUCCESSFUL_LOGIN_REGEX = r'<a href="/accounts/logout/"[^>]*>Sign Out</a>'
_ACCOUNT_CREDENTIALS_HINT = 'Use --username and --password options to supply credentials for safaribooksonline.com'
_NETRC_MACHINE = 'safari' _NETRC_MACHINE = 'safari'
_API_BASE = 'https://www.safaribooksonline.com/api/v1/book' _API_BASE = 'https://www.safaribooksonline.com/api/v1/book'
@ -37,9 +36,7 @@ def _real_initialize(self):
def _login(self): def _login(self):
(username, password) = self._get_login_info() (username, password) = self._get_login_info()
if username is None: if username is None:
raise ExtractorError( self.raise_login_required('safaribooksonline.com account is required')
self._ACCOUNT_CREDENTIALS_HINT,
expected=True)
headers = std_headers headers = std_headers
if 'Referer' not in headers: if 'Referer' not in headers: