mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
add magnet link retriever for uztracker
This commit is contained in:
@@ -9,12 +9,24 @@ def get_post_title():
|
|||||||
maintitle = soup.find(class_='tt-text')
|
maintitle = soup.find(class_='tt-text')
|
||||||
if maintitle:
|
if maintitle:
|
||||||
print("Program found:", maintitle.text)
|
print("Program found:", maintitle.text)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Program not found")
|
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:
|
if response.status_code == 200:
|
||||||
get_post_title()
|
get_post_title()
|
||||||
|
get_magnet_link()
|
||||||
|
|
||||||
Reference in New Issue
Block a user