mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-04 04:52:55 +08:00
[roosterteeth] Use hidden inputs dict for login, clean up login request, and fix regex subdomain capture
This commit is contained in:
parent
65855424d3
commit
dcd0c02cd8
@ -9,7 +9,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class RoosterTeethIE(InfoExtractor):
|
class RoosterTeethIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:(www|achievementhunter|funhaus|screwattack|theknow)\.)?roosterteeth\.com/episode/(?P<id>[^/?#&]+)'
|
_VALID_URL = r'https?://(?:.+?\.)?roosterteeth\.com/episode/(?P<id>[^/?#&]+)'
|
||||||
_LOGIN_URL = 'https://roosterteeth.com/login'
|
_LOGIN_URL = 'https://roosterteeth.com/login'
|
||||||
_NETRC_MACHINE = 'roosterteeth'
|
_NETRC_MACHINE = 'roosterteeth'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
@ -49,23 +49,24 @@ class RoosterTeethIE(InfoExtractor):
|
|||||||
|
|
||||||
# token is required to authenticate request
|
# token is required to authenticate request
|
||||||
login_page = self._download_webpage(self._LOGIN_URL, None, 'Getting login token', 'Unable to get login token')
|
login_page = self._download_webpage(self._LOGIN_URL, None, 'Getting login token', 'Unable to get login token')
|
||||||
hidden_inputs = self._hidden_inputs(login_page)
|
|
||||||
token = hidden_inputs['_token']
|
|
||||||
|
|
||||||
login_data = {
|
login_form = self._hidden_inputs(login_page)
|
||||||
'_token': token,
|
login_form.update({
|
||||||
'username': username,
|
'username': username,
|
||||||
'password': password,
|
'password': password,
|
||||||
}
|
})
|
||||||
|
login_payload = urlencode_postdata(login_form)
|
||||||
login_payload = urlencode_postdata(login_data)
|
|
||||||
|
|
||||||
# required for proper responses
|
# required for proper responses
|
||||||
login_headers = {
|
login_headers = {
|
||||||
'Referer': 'https://roosterteeth.com/login',
|
'Referer': self._LOGIN_URL,
|
||||||
}
|
}
|
||||||
|
|
||||||
login_request = self._download_webpage(self._LOGIN_URL, None, note='Logging in as %s' % username, data=login_payload, headers=login_headers)
|
login_request = self._download_webpage(
|
||||||
|
self._LOGIN_URL, None,
|
||||||
|
note='Logging in as %s' % username,
|
||||||
|
data=login_payload,
|
||||||
|
headers=login_headers)
|
||||||
|
|
||||||
if 'Authentication failed' in login_request:
|
if 'Authentication failed' in login_request:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
|
Loading…
Reference in New Issue
Block a user