PHDMAFIN commited on
Commit
ff910d4
·
verified ·
1 Parent(s): 536573c

Update scraper.py

Browse files
Files changed (1) hide show
  1. scraper.py +4 -3
scraper.py CHANGED
@@ -25,6 +25,7 @@ from playwright.sync_api import TimeoutError as PWTimeout
25
  from playwright.sync_api import sync_playwright
26
 
27
  BASE = "https://www.idealista.pt"
 
28
  DEFAULT_LANG = "es" # "es" o "pt"
29
 
30
  LISTING_COLUMNS = [
@@ -405,14 +406,14 @@ def sanitize_filename(stem: str) -> str:
405
  return re.sub(r"[^a-zA-Z0-9_\-\.]+", "_", stem).strip("_") or "consulta"
406
 
407
 
408
- def normalize_input_to_url(s, lang=LANG):
409
  s = (str(s or "")).strip()
410
  if not s:
411
  return None
412
 
413
  if s.startswith("http://") or s.startswith("https://"):
414
- # No modificar URLs completas, especialmente si tienen query string.
415
- # En URLs con ?shape=, agregar "/" al final altera el parámetro shape.
416
  return s
417
 
418
  s = s.strip("/")
 
25
  from playwright.sync_api import sync_playwright
26
 
27
  BASE = "https://www.idealista.pt"
28
+
29
  DEFAULT_LANG = "es" # "es" o "pt"
30
 
31
  LISTING_COLUMNS = [
 
406
  return re.sub(r"[^a-zA-Z0-9_\-\.]+", "_", stem).strip("_") or "consulta"
407
 
408
 
409
+ def normalize_input_to_url(s, lang="es"):
410
  s = (str(s or "")).strip()
411
  if not s:
412
  return None
413
 
414
  if s.startswith("http://") or s.startswith("https://"):
415
+ # No modificar URLs completas.
416
+ # Importante: si la URL trae ?shape=..., agregar "/" al final rompe el parámetro.
417
  return s
418
 
419
  s = s.strip("/")