mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
Actually fix no search result
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
search = input("Enter the name of the program you want to search for: ")
|
search = input("Enter the name of the program you want to search for: ")
|
||||||
url = "https://uztracker.net/tracker.php?nm=" # placeholder url for now
|
url = "https://uztracker.net/tracker.php?nm=" # placeholder url for now
|
||||||
response = requests.get(url) # get da content from da url
|
response = requests.get(url) # get da content from da url
|
||||||
@@ -9,6 +10,7 @@ soup = BeautifulSoup(response.content, 'html.parser') # create bs object
|
|||||||
def scrape_uztracker():
|
def scrape_uztracker():
|
||||||
search_url = url + search
|
search_url = url + search
|
||||||
print(search_url)
|
print(search_url)
|
||||||
|
result = False
|
||||||
try:
|
try:
|
||||||
response = requests.get(search_url)
|
response = requests.get(search_url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
@@ -18,8 +20,9 @@ def scrape_uztracker():
|
|||||||
if link.b:
|
if link.b:
|
||||||
print("Result found:", link.b.text, "|", link['href'])
|
print("Result found:", link.b.text, "|", link['href'])
|
||||||
result = True
|
result = True
|
||||||
|
|
||||||
if not result:
|
if not result:
|
||||||
print(f"No Results found for {search}")
|
print(f'No Results found for "{search}"')
|
||||||
|
|
||||||
return soup
|
return soup
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user