convention fix, simplified login request

This commit is contained in:
Chris Putnam 2021-01-22 14:33:26 -06:00
parent 271426aa58
commit 35f987487b

View File

@ -1,21 +1,21 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
clean_html, clean_html,
determine_ext, determine_ext,
ExtractorError,
int_or_none, int_or_none,
KNOWN_EXTENSIONS, KNOWN_EXTENSIONS,
mimetype2ext, mimetype2ext,
parse_iso8601, parse_iso8601,
str_or_none, str_or_none,
try_get, try_get,
sanitized_Request,
ExtractorError,
) )
import json
import re
class PatreonIE(InfoExtractor): class PatreonIE(InfoExtractor):
@ -91,11 +91,11 @@ class PatreonIE(InfoExtractor):
} }
} }
request = sanitized_Request( login_page = self._download_webpage(
'https://www.patreon.com/api/login?include=campaign,user_location&json-api-version=1.0', 'https://www.patreon.com/api/login',
json.dumps(login_form).encode('ascii') video_id=None,
) note='Logging in',
login_page = self._download_webpage(request, None, note='Logging in') data=json.dumps(login_form).encode('ascii'))
if re.search(r'onLoginFailed', login_page): if re.search(r'onLoginFailed', login_page):
raise ExtractorError('Unable to login, incorrect username and/or password', expected=True) raise ExtractorError('Unable to login, incorrect username and/or password', expected=True)