ghstedpixel commited on
Commit
a87aabc
·
verified ·
1 Parent(s): 1cd48db

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -303,14 +303,14 @@ async def handle_search(
303
  elif "link" not in d and "url" in d:
304
  d["link"] = d["url"]
305
 
306
- # Final Multi-Pass Parameter unwrapping validation round
307
  current_url = d.get("url", "")
308
  if current_url and "google.com" in current_url:
309
  try:
310
  for _ in range(3):
311
  parsed_query = parse_qs(urlparse(current_url).query)
312
  found_nested = False
313
- for param_key in ["q", "url", "adurl", "u", "link"]:
314
  if parsed_query.get(param_key):
315
  candidate = parsed_query[param_key][0]
316
  if "http" in candidate:
@@ -331,7 +331,7 @@ async def handle_search(
331
  except:
332
  d["source_domain"] = "retailer.link"
333
 
334
- # Absolute Safety Check: Strict filter layer drop to completely guard template UI from rendering comparison pages
335
  deals = [d for d in deals if "google.com" not in d.get("url", "")]
336
 
337
  base_ui_context.update({
 
303
  elif "link" not in d and "url" in d:
304
  d["link"] = d["url"]
305
 
306
+ # Recursive unwrapping check to catch any residual proxy tracking strings
307
  current_url = d.get("url", "")
308
  if current_url and "google.com" in current_url:
309
  try:
310
  for _ in range(3):
311
  parsed_query = parse_qs(urlparse(current_url).query)
312
  found_nested = False
313
+ for param_key in ["q", "url", "adurl", "u", "link", "destination"]:
314
  if parsed_query.get(param_key):
315
  candidate = parsed_query[param_key][0]
316
  if "http" in candidate:
 
331
  except:
332
  d["source_domain"] = "retailer.link"
333
 
334
+ # Absolute Safety Gate: Purge unresolvable tracking tokens from the rendering layer completely
335
  deals = [d for d in deals if "google.com" not in d.get("url", "")]
336
 
337
  base_ui_context.update({