debug: print sample sitemap URLs and notification HTML snippet
All checks were successful
ZIPAIR Singapore Sale Monitor / check (push) Successful in 23s
All checks were successful
ZIPAIR Singapore Sale Monitor / check (push) Successful in 23s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,7 +102,11 @@ def get_notification_ids_from_sitemap() -> list[int]:
|
|||||||
ids = sorted(set(ids))
|
ids = sorted(set(ids))
|
||||||
print(f" Found {len(ids)} notification IDs (max={ids[-1]})")
|
print(f" Found {len(ids)} notification IDs (max={ids[-1]})")
|
||||||
return ids
|
return ids
|
||||||
print(f" No notification IDs found in sitemap(s).")
|
# Debug: show sample URLs from sitemap so we can see the real pattern
|
||||||
|
sample_urls = re.findall(r"<loc>(https?://[^<]{10,})</loc>", xml)[:5]
|
||||||
|
print(f" No notification IDs found. Sample URLs from sitemap:")
|
||||||
|
for u in sample_urls:
|
||||||
|
print(f" {u}")
|
||||||
|
|
||||||
# Fallback: EN notification listing page (IDs may be in HTML even if JS-rendered)
|
# Fallback: EN notification listing page (IDs may be in HTML even if JS-rendered)
|
||||||
print("Trying EN notification listing page …")
|
print("Trying EN notification listing page …")
|
||||||
@@ -110,12 +114,16 @@ def get_notification_ids_from_sitemap() -> list[int]:
|
|||||||
print(f" → {len(html)} bytes")
|
print(f" → {len(html)} bytes")
|
||||||
ids = [int(m) for m in re.findall(r"/(?:en|ja|ko|th|zh-tw|zh-cn)/notification/(\d+)", html)]
|
ids = [int(m) for m in re.findall(r"/(?:en|ja|ko|th|zh-tw|zh-cn)/notification/(\d+)", html)]
|
||||||
if not ids:
|
if not ids:
|
||||||
# also try bare /notification/NNN pattern
|
|
||||||
ids = [int(m) for m in re.findall(r"/notification/(\d+)", html)]
|
ids = [int(m) for m in re.findall(r"/notification/(\d+)", html)]
|
||||||
if ids:
|
if ids:
|
||||||
ids = sorted(set(ids))
|
ids = sorted(set(ids))
|
||||||
print(f" Found {len(ids)} notification IDs from listing page (max={ids[-1]})")
|
print(f" Found {len(ids)} notification IDs from listing page (max={ids[-1]})")
|
||||||
return ids
|
return ids
|
||||||
|
# Debug: show a snippet around "notification" in the HTML
|
||||||
|
lower = html.lower()
|
||||||
|
pos = lower.find("notification")
|
||||||
|
if pos != -1:
|
||||||
|
print(f" Sample HTML around 'notification': {repr(html[pos:pos+300])}")
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user