Fix: улучшена фильтрация не-отелей, поддержка PDF-политики, исправлены ошибки DNS
This commit is contained in:
1 parent
928637ad25
commit
7fb417dad5
10 files changed
+240
-42
No files matched your search
@@ -40,6 +40,29 @@ async def scan_single(url: str, checks: list[str] | None = None) -> SiteScan:
|
||||
return result
|
||||
|
||||
|
||||
def is_likely_hotel(url: str) -> bool:
|
||||
"""Проверяет, похож ли URL на сайт отеля (фильтр не-отелей)."""
|
||||
domain = url.replace("https://", "").replace("http://", "").split("/")[0].lower()
|
||||
|
||||
# Известные не-отели — пропускаем их
|
||||
not_hotel_patterns = [
|
||||
"wikipedia", "google", "example", "demo", "test", "toscrape",
|
||||
"herokuapp", "phpstore", "myshopify", "wordpress", "joomla",
|
||||
"drupal", "typo3", "prestashop", "magento", "opencart",
|
||||
"wix", "squarespace", "webflow", "shopify", "woocommerce",
|
||||
"tilda", "constructor", "builder", "playwright", "node",
|
||||
"localhost", "127.0.0.1", "ip-api", "ipify", "my-ip",
|
||||
"reg.ru", "nic.ru", "beget", "timeweb", "selectel",
|
||||
]
|
||||
|
||||
for pattern in not_hotel_patterns:
|
||||
if pattern in domain:
|
||||
return False
|
||||
|
||||
# Разрешаем всё остальное — пользователь курирует список
|
||||
return True
|
||||
|
||||
|
||||
def scan_csv(filepath: str):
|
||||
"""Парксить CSV-файл с URL и запустить сканирование."""
|
||||
csv_path = Path(filepath)
|
||||
@@ -48,13 +71,25 @@ def scan_csv(filepath: str):
|
||||
sys.exit(1)
|
||||
|
||||
urls = []
|
||||
skipped = []
|
||||
with open(csv_path, "r", encoding="utf-8") as f:
|
||||
reader = csv.reader(f)
|
||||
for row in reader:
|
||||
if row:
|
||||
url = row[0].strip()
|
||||
if url and url.startswith(("http://", "https://")):
|
||||
urls.append(url)
|
||||
if is_likely_hotel(url):
|
||||
urls.append(url)
|
||||
else:
|
||||
skipped.append(url)
|
||||
|
||||
if skipped:
|
||||
print(f"⚠️ Пропущено {len(skipped)} URL (не похожи на отели):")
|
||||
for u in skipped[:5]:
|
||||
print(f" {u}")
|
||||
if len(skipped) > 5:
|
||||
print(f" ...и ещё {len(skipped) - 5}")
|
||||
print()
|
||||
|
||||
if not urls:
|
||||
print("❌ В CSV не найдено валидных URL")
|
||||
|
||||
Reference in new issue
Block a user