fix: Update sudrf routing to /appeals/ and exclude general navigation URLs from details crawler
This commit is contained in:
parent
378ec2ebca
commit
c1ad8b3d4c
1 changed files with 10 additions and 6 deletions
|
|
@ -82,7 +82,7 @@ async def run_mission():
|
||||||
logger.info("Login detected. Navigating to appeals history...")
|
logger.info("Login detected. Navigating to appeals history...")
|
||||||
send_tg("✅ **Авторизация успешна!** Начинаю сбор обращений...")
|
send_tg("✅ **Авторизация успешна!** Начинаю сбор обращений...")
|
||||||
|
|
||||||
await page.goto("https://ej.sudrf.ru/#/appeals")
|
await page.goto("https://ej.sudrf.ru/appeals/")
|
||||||
await asyncio.sleep(10) # wait for page to render appeals list
|
await asyncio.sleep(10) # wait for page to render appeals list
|
||||||
|
|
||||||
# Take list page screenshot
|
# Take list page screenshot
|
||||||
|
|
@ -103,6 +103,8 @@ async def run_mission():
|
||||||
href = await link.get_attribute("href")
|
href = await link.get_attribute("href")
|
||||||
text = await link.inner_text()
|
text = await link.inner_text()
|
||||||
if href and ("appeal" in href or "card" in href or "request" in href):
|
if href and ("appeal" in href or "card" in href or "request" in href):
|
||||||
|
# Исключаем общие страницы
|
||||||
|
if href.strip() not in ("/appeal/", "/appeals/", "/appeal", "/appeals", "#/appeal/", "#/appeals/"):
|
||||||
links.append({"href": href, "text": text.strip()})
|
links.append({"href": href, "text": text.strip()})
|
||||||
|
|
||||||
logger.info(f"Found {len(links)} matching links on page: {links}")
|
logger.info(f"Found {len(links)} matching links on page: {links}")
|
||||||
|
|
@ -150,6 +152,7 @@ async def run_mission():
|
||||||
for appeal in parsed_appeals:
|
for appeal in parsed_appeals:
|
||||||
href = appeal.get("href")
|
href = appeal.get("href")
|
||||||
if href and href not in processed_hrefs:
|
if href and href not in processed_hrefs:
|
||||||
|
if href.strip() not in ("/appeal/", "/appeals/", "/appeal", "/appeals", "#/appeal/", "#/appeals/"):
|
||||||
detail_hrefs.append(href)
|
detail_hrefs.append(href)
|
||||||
processed_hrefs.add(href)
|
processed_hrefs.add(href)
|
||||||
|
|
||||||
|
|
@ -157,6 +160,7 @@ async def run_mission():
|
||||||
for link in links:
|
for link in links:
|
||||||
href = link["href"]
|
href = link["href"]
|
||||||
if href and href not in processed_hrefs:
|
if href and href not in processed_hrefs:
|
||||||
|
if href.strip() not in ("/appeal/", "/appeals/", "/appeal", "/appeals", "#/appeal/", "#/appeals/"):
|
||||||
detail_hrefs.append(href)
|
detail_hrefs.append(href)
|
||||||
processed_hrefs.add(href)
|
processed_hrefs.add(href)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue