Refactor scrape_uztracker call in GUI to handle no results more gracefully and improve debug output

This commit is contained in:
Vxrtrauter
2025-09-06 01:10:48 +02:00
parent 01303234d6
commit 72a892d707
2 changed files with 12 additions and 7 deletions
+1 -3
View File
@@ -52,10 +52,8 @@ def scrape_uztracker(search, debug):
return resulttitles, results
if not result:
if debug:
print(f'No Results found for "{search}"')
# add popup in gui for no result
return
return None
except requests.RequestException as e:
if result:
+11 -4
View File
@@ -122,12 +122,19 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def return_pressed(self):
search_text = self.searchbar.text()
self.postnames, self.postlinks = scrape_uztracker(search_text, debug)
self.softwareList.clear()
if self.postnames:
self.softwareList.addItems(self.postnames)
if debug:
print("User searched for:", search_text)
response = scrape_uztracker(search_text, debug)
if response:
self.postnames, self.postlinks = response
self.softwareList.clear()
if self.postnames:
self.softwareList.addItems(self.postnames)
elif debug:
print(f"No Results found for \"{search_text}\"")