22 lines
633 B
Python
22 lines
633 B
Python
import json
|
|
import re
|
|
|
|
|
|
def fetch_nonce(html_content):
|
|
match = re.search(r'"nonce"\s*:\s*"([^"]+)"', html_content)
|
|
if not match:
|
|
raise ValueError("Nonce не найден на странице.")
|
|
return match.group(1)
|
|
|
|
|
|
def fetch_args(html_content):
|
|
match = re.search(
|
|
r"ObjectManagerList\.add\((\{.*?\})\)\.initLazyLoad", html_content, re.S
|
|
)
|
|
if not match:
|
|
raise ValueError("Данные страниц не найдены на странице.")
|
|
|
|
pages = json.loads(match.group(1))
|
|
args = pages.get("args", [])
|
|
return json.loads(args) if isinstance(args, str) else args
|