From c8bfa8922cfac8af28438b63029bd4f74d611719 Mon Sep 17 00:00:00 2001 From: Vxrtrauter Date: Mon, 23 Jun 2025 22:10:51 +0200 Subject: [PATCH] add magnet link retriever for uztracker --- core/{scrapertest.py => uztracker_scraper.py} | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) rename core/{scrapertest.py => uztracker_scraper.py} (50%) diff --git a/core/scrapertest.py b/core/uztracker_scraper.py similarity index 50% rename from core/scrapertest.py rename to core/uztracker_scraper.py index 923ec5c..8cd04ed 100644 --- a/core/scrapertest.py +++ b/core/uztracker_scraper.py @@ -9,12 +9,24 @@ def get_post_title(): maintitle = soup.find(class_='tt-text') if maintitle: print("Program found:", maintitle.text) - else: print("Program not found") +def get_magnet_link(): + magnet_link = soup.find('a', href=lambda x: x and x.startswith('magnet:')) # credits to claude for helping me with lambda. + if magnet_link: + print("Magnet Link found:", magnet_link['href']) + else: + print("Magnet Link not Found!") + + # What x and x.startswith('magnet:') Does + + # x - check if x exists (not None/empty) + # and - if x exists, THEN check the next part + # x.startswith('magnet:') - does x start with "magnet:"? if response.status_code == 200: get_post_title() + get_magnet_link() \ No newline at end of file