- login_form = self._search_regex(
- r'(?s)(<form[^>]+(?:id|name)="Form-login".+?</form>)', login_webpage, 'login form')
- form_data = self._hidden_inputs(login_form)
+
+ def extract_form_url_and_data(wp, default_form_url, form_spec_re=''):
+ form, form_elem = re.search(
+ r'(?s)((<form[^>]+?%s[^>]*?>).+?</form>)' % form_spec_re, wp).groups()
+ form_data = self._hidden_inputs(form)
+ form_url = extract_attributes(form_elem).get('action') or default_form_url
+ return form_url, form_data
+
+ post_url, form_data = extract_form_url_and_data(
+ login_webpage,
+ 'https://services.radio-canada.ca/auth/oauth/v2/authorize/login',
+ r'(?:id|name)="Form-login"')