Spaces:
Sleeping
Sleeping
Update main.py
Browse files
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 |
-
#
|
| 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
|
| 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({
|