mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
updated steamrip scraper to get links
This commit is contained in:
+3
-2
@@ -2,6 +2,7 @@ import aria2p
|
||||
import subprocess
|
||||
import keyboard
|
||||
import os
|
||||
from scraper import uri
|
||||
|
||||
aria2 = aria2p.API(
|
||||
aria2p.Client(
|
||||
@@ -35,8 +36,8 @@ def startDownload(_):
|
||||
def terminate():
|
||||
return
|
||||
|
||||
print("Enter Download URL: ")
|
||||
uri = input()
|
||||
# print("Enter Download URL: ")
|
||||
# uri = input()
|
||||
|
||||
#Magnet Download
|
||||
# downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
|
||||
|
||||
+61
-6
@@ -10,19 +10,22 @@ if response.status_code == 200:
|
||||
soup = BeautifulSoup(response.text, "html.parser")
|
||||
|
||||
links = soup.find_all("a")
|
||||
|
||||
games_dict = {}
|
||||
|
||||
for link in links:
|
||||
href = link.get("href", "").lower()
|
||||
text = link.text.strip()
|
||||
|
||||
if re.search(r"/Discord/", href):
|
||||
if re.search(r"/discord/", href):
|
||||
continue
|
||||
|
||||
if text:
|
||||
games_dict[text] = href
|
||||
|
||||
games = soup.find_all("li")
|
||||
game_titles = [game.text.strip() for game in games]
|
||||
game_titles = list(games_dict.keys())
|
||||
|
||||
if game_titles:
|
||||
print("Games Found:")
|
||||
for title in game_titles:
|
||||
pass
|
||||
else:
|
||||
@@ -39,11 +42,63 @@ search_results = search_games(search_query, game_titles)
|
||||
|
||||
if search_results:
|
||||
print("Search Results:")
|
||||
for result in search_results:
|
||||
print(result)
|
||||
for idx, result in enumerate(search_results, start=1):
|
||||
print(f"{idx}. {result}")
|
||||
|
||||
try:
|
||||
selection = int(input("Select a game by entering the corresponding number: "))
|
||||
if 1 <= selection <= len(search_results):
|
||||
selected_game = search_results[selection - 1]
|
||||
selected_link = games_dict[selected_game] # Retrieve the link from the dictionary
|
||||
print(f"You selected: {selected_game}")
|
||||
print(f"Link: https://steamrip.com{selected_link}")
|
||||
else:
|
||||
print("Invalid selection.")
|
||||
except ValueError:
|
||||
print("Invalid input. Please enter a number.")
|
||||
else:
|
||||
print("No matching game titles found.")
|
||||
|
||||
#scrape download links
|
||||
game_url = f"https://steamrip.com{selected_link}"
|
||||
|
||||
keywords = ["megadb.com", "buzzheavier.com", "gofile.io"]
|
||||
|
||||
def scrape_buzzheavier(url):
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
soup = BeautifulSoup(response.text, 'html.parser')
|
||||
links = soup.find_all('a', href=True)
|
||||
for link in links:
|
||||
href = link['href']
|
||||
full_dl_url = f"https:{href}" if href.startswith("//") else href
|
||||
if full_dl_url.startswith("https://buzzheavier.com/dl/"):
|
||||
print(f"Found direct download link: {full_dl_url}")
|
||||
return
|
||||
print(f"No direct download link found on {url}")
|
||||
except requests.RequestException as e:
|
||||
print(f"Failed to fetch {url}: {e}")
|
||||
|
||||
|
||||
def scrape_links(url):
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
soup = BeautifulSoup(response.text, 'html.parser')
|
||||
links = soup.find_all('a', href=True)
|
||||
for link in links:
|
||||
href = link['href']
|
||||
full_url = f"https:{href}" if href.startswith("//") else href
|
||||
if any(keyword in full_url for keyword in keywords):
|
||||
print(f"Found link: {full_url} on site: {url}")
|
||||
if "buzzheavier.com" in full_url:
|
||||
scrape_buzzheavier(full_url)
|
||||
except requests.RequestException as e:
|
||||
print(f"Failed to fetch {url}: {e}")
|
||||
|
||||
scrape_links(game_url)
|
||||
|
||||
# url = "https://cs.rin.ru/"
|
||||
# url = "https://gamesdrive.net/"
|
||||
# url = "https://gog-games.to/"
|
||||
|
||||
Reference in New Issue
Block a user