mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
Refactor: steamrip scraper & update menu labels
Simplify SteamripScraper link/name extraction by using BeautifulSoup results directly (append absolute URLs and use link.get_text()) and avoid fragile regex; adjust scrape_steamrip_game_downloads to accept a full URL argument. Update context menu text: replace "Copy Magnet URI" with "Copy Download Link" in two places and rename "Download Item" to "Download" for clearer UI wording.
This commit is contained in:
@@ -37,13 +37,12 @@ class SteamripScraper:
|
||||
|
||||
links = []
|
||||
names = []
|
||||
|
||||
for gamehtml in games:
|
||||
link = gamehtml.find("a", href=lambda x: x and x.startswith("/"))
|
||||
links += re.findall(r'(?<=href=")[^"]*', link.__str__())
|
||||
name = gamehtml.find("a", href=lambda x: x and x.startswith("/"))
|
||||
names += re.findall(r'(?<=\/">)[^<]*', name.__str__())
|
||||
|
||||
# construct the list[dict[str,str]]
|
||||
if link:
|
||||
links.append("https://steamrip.com" + link["href"])
|
||||
names.append(link.get_text())
|
||||
|
||||
ret = []
|
||||
|
||||
@@ -52,8 +51,7 @@ class SteamripScraper:
|
||||
|
||||
return ret
|
||||
|
||||
def scrape_steamrip_game_downloads(self, gamelink):
|
||||
url = "https://steamrip.com" + gamelink
|
||||
def scrape_steamrip_game_downloads(self, url):
|
||||
response = requests.get(url)
|
||||
soup = BeautifulSoup(response.text, "html.parser")
|
||||
download_link_elements = soup.find_all("a",class_="shortc-button")
|
||||
|
||||
Reference in New Issue
Block a user