Skip to content

Commit

Permalink
[njpwworld] Fix authentication (closes #17427)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and lkho committed Dec 24, 2018
1 parent fd04adc commit 118a4b9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions youtube_dl/extractor/njpwworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class NJPWWorldIE(InfoExtractor):
'skip': 'Requires login',
}

_LOGIN_URL = 'https://front.njpwworld.com/auth/login'

def _real_initialize(self):
self._login()

Expand All @@ -40,13 +42,17 @@ def _login(self):
if not username:
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(
'https://njpwworld.com/auth/login', None,
self._LOGIN_URL, None,
note='Logging in', errnote='Unable to login',
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
if urlh.geturl() == 'https://njpwworld.com/auth/login':
if urlh.geturl() == self._LOGIN_URL:
self.report_warning('unable to login')
return False

Expand Down

0 comments on commit 118a4b9

Please sign in to comment.