- def find_value(element_id):
- match = re.search(r'id="%s"\s+value="(.+?)">' % element_id, login_results, re.M | re.U)
- if match is None:
- self._downloader.report_warning('Failed to get %s - did the page structure change?' % id)
- return match.group(1)
-
- challengeId = find_value('challengeId')
- challengeType = find_value('challengeType')
- gxf = find_value('gxf')
-
- tfa_form_strs = {
- 'challengeId': challengeId,
- 'challengeType': challengeType, # This doesn't appear to change
- 'continue': 'https://www.youtube.com/signin?action_handle_signin=true&feature=sign_in_button&hl=en_US&nomobiletemp=1',
- 'service': 'youtube',
- 'hl': 'en_US',
- 'checkedDomains': 'youtube',
- 'pstMsg': '0',
- 'gxf': gxf,
+ tfa_code = remove_start(tfa_code, 'G-')
+
+ tfa_form_strs = self._form_hidden_inputs('challenge', login_results)
+
+ tfa_form_strs.update({