Compare commits

..

3 Commits

Author SHA1 Message Date
Vxrtrauter a7c71b37f5 refactor: remove duplicate stripping 2026-03-04 21:00:37 +01:00
Vxrtrauter 8fb1bb9e8d Merge branch 'main' of https://github.com/KeksPirates/SoftwareManager 2026-03-04 20:58:58 +01:00
Vxrtrauter 89fd8b4ebb fix: fix scraping for uztracker posts to support displaying authors properly 2026-03-04 20:58:56 +01:00
3 changed files with 14 additions and 18 deletions
+12 -16
View File
@@ -10,27 +10,23 @@ def scrape_uztracker(query):
posts = [] posts = []
try: try:
response = requests.get( response = requests.get(search_url)
f"{search_url.rstrip('/')}/tracker.php",
params={'nm': query},
)
response.raise_for_status() response.raise_for_status()
soup = BeautifulSoup(response.text, 'html.parser') soup = BeautifulSoup(response.text, 'html.parser')
links = soup.find_all('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic')) links = soup.find_all('tr', class_="tCenter hl-tr", id=lambda x: x and x.startswith('tor_'))
for link in links: for link in links:
if link.b:
title = link.b.text
url = urljoin(base_url, link['href'])
author_link = link.find_parent('td').find('a', class_="med ts-text") theme_link = link.find('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic'))
author = author_link.text.strip() if author_link else "Unknown" url = urljoin(base_url, theme_link['href'])
title = theme_link.b.text
author_link = link.find('a', class_="med")
author = author_link.text.strip() if author_link else "Unknown"
posts.append(dict( posts.append(dict(
title=title, title=title,
url=url, url=url,
author=author author=author
)) ))
return posts return posts
+1 -1
View File
@@ -157,7 +157,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
header = table.horizontalHeader() header = table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch) header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch)
header.setSectionResizeMode(1, QHeaderView.ResizeMode.Fixed) header.setSectionResizeMode(1, QHeaderView.ResizeMode.Fixed)
header.resizeSection(1, 200) header.resizeSection(1, 500)
header.setStretchLastSection(False) header.setStretchLastSection(False)
return table return table
+1 -1
View File
@@ -25,7 +25,7 @@ def format_data_minimal(data):
post_titles = [post["title"] for post in data] post_titles = [post["title"] for post in data]
post_links = [post["url"] for post in data] post_links = [post["url"] for post in data]
return post_author, post_titles, post_links return post_author, post_titles, post_links