- if '>Reset your password<' in response:
- self.report_warning('Twitch asks you to reset your password, go to https://secure.twitch.tv/reset/submit')
+ try:
+ response = self._download_json(
+ post_url, None, 'Logging in as %s' % username,
+ data=urlencode_postdata(login_form),
+ headers=headers)
+ except ExtractorError as e:
+ if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
+ response = self._parse_json(
+ e.cause.read().decode('utf-8'), None)
+ fail(response['message'])
+ raise
+
+ if response.get('redirect'):
+ self._download_webpage(
+ response['redirect'], None, 'Downloading login redirect page',
+ headers=headers)