add magnet link retriever for uztracker

This commit is contained in:
Vxrtrauter
2025-06-23 22:10:51 +02:00
parent b4a118597e
commit c8bfa8922c
@@ -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()