[ie/atptour] add extractor and updated data extraction function

This commit is contained in:
subrat-lima
2024-09-01 17:06:24 +05:30
parent ad9a8115aa
commit 485cbe4990
3 changed files with 115 additions and 2 deletions
+5 -2
View File
@@ -1779,7 +1779,7 @@ class InfoExtractor:
return traverse_obj(ret, traverse) or {}
@staticmethod
def _hidden_inputs(html):
def _hidden_inputs(html, attr_list=('name', 'id')):
html = re.sub(r'<!--(?:(?!<!--).)*-->', '', html)
hidden_inputs = {}
for input_el in re.findall(r'(?i)(<input[^>]+>)', html):
@@ -1788,7 +1788,10 @@ class InfoExtractor:
continue
if attrs.get('type') not in ('hidden', 'submit'):
continue
name = attrs.get('name') or attrs.get('id')
for attr in variadic(attr_list):
name = attrs.get(attr)
if name is not None:
break
value = attrs.get('value')
if name and value is not None:
hidden_inputs[name] = value