[njpwworld] Fix authentication (closes #17427)

This commit is contained in:
Sergey M․ 2018-11-01 01:35:32 +07:00
parent f16679e843
commit c70ba664f1
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -31,6 +31,8 @@ class NJPWWorldIE(InfoExtractor):
'skip': 'Requires login', 'skip': 'Requires login',
} }
_LOGIN_URL = 'https://front.njpwworld.com/auth/login'
def _real_initialize(self): def _real_initialize(self):
self._login() self._login()
@ -40,13 +42,17 @@ def _login(self):
if not username: if not username:
return True return True
# Setup session (will set necessary cookies)
self._request_webpage(
'https://njpwworld.com/', None, note='Setting up session')
webpage, urlh = self._download_webpage_handle( webpage, urlh = self._download_webpage_handle(
'https://njpwworld.com/auth/login', None, self._LOGIN_URL, None,
note='Logging in', errnote='Unable to login', note='Logging in', errnote='Unable to login',
data=urlencode_postdata({'login_id': username, 'pw': password}), data=urlencode_postdata({'login_id': username, 'pw': password}),
headers={'Referer': 'https://njpwworld.com/auth'}) headers={'Referer': 'https://front.njpwworld.com/auth'})
# /auth/login will return 302 for successful logins # /auth/login will return 302 for successful logins
if urlh.geturl() == 'https://njpwworld.com/auth/login': if urlh.geturl() == self._LOGIN_URL:
self.report_warning('unable to login') self.report_warning('unable to login')
return False return False