mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
refactor: remove duplicate stripping
This commit is contained in:
@@ -10,15 +10,12 @@ 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('tr', class_="tCenter hl-tr", id=lambda x: x and x.startswith('tor_'))
|
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:
|
||||||
|
|
||||||
theme_link = link.find('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic'))
|
theme_link = link.find('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic'))
|
||||||
url = urljoin(base_url, theme_link['href'])
|
url = urljoin(base_url, theme_link['href'])
|
||||||
title = theme_link.b.text
|
title = theme_link.b.text
|
||||||
|
|||||||
Reference in New Issue
Block a user