mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
updated steamrip scraper to get links
This commit is contained in:
+3
-2
@@ -2,6 +2,7 @@ import aria2p
|
|||||||
import subprocess
|
import subprocess
|
||||||
import keyboard
|
import keyboard
|
||||||
import os
|
import os
|
||||||
|
from scraper import uri
|
||||||
|
|
||||||
aria2 = aria2p.API(
|
aria2 = aria2p.API(
|
||||||
aria2p.Client(
|
aria2p.Client(
|
||||||
@@ -35,8 +36,8 @@ def startDownload(_):
|
|||||||
def terminate():
|
def terminate():
|
||||||
return
|
return
|
||||||
|
|
||||||
print("Enter Download URL: ")
|
# print("Enter Download URL: ")
|
||||||
uri = input()
|
# uri = input()
|
||||||
|
|
||||||
#Magnet Download
|
#Magnet Download
|
||||||
# downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
|
# downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
|
||||||
|
|||||||
+61
-6
@@ -11,18 +11,21 @@ if response.status_code == 200:
|
|||||||
|
|
||||||
links = soup.find_all("a")
|
links = soup.find_all("a")
|
||||||
|
|
||||||
|
games_dict = {}
|
||||||
|
|
||||||
for link in links:
|
for link in links:
|
||||||
href = link.get("href", "").lower()
|
href = link.get("href", "").lower()
|
||||||
text = link.text.strip()
|
text = link.text.strip()
|
||||||
|
|
||||||
if re.search(r"/Discord/", href):
|
if re.search(r"/discord/", href):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
games = soup.find_all("li")
|
if text:
|
||||||
game_titles = [game.text.strip() for game in games]
|
games_dict[text] = href
|
||||||
|
|
||||||
|
game_titles = list(games_dict.keys())
|
||||||
|
|
||||||
if game_titles:
|
if game_titles:
|
||||||
print("Games Found:")
|
|
||||||
for title in game_titles:
|
for title in game_titles:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@@ -39,11 +42,63 @@ search_results = search_games(search_query, game_titles)
|
|||||||
|
|
||||||
if search_results:
|
if search_results:
|
||||||
print("Search Results:")
|
print("Search Results:")
|
||||||
for result in search_results:
|
for idx, result in enumerate(search_results, start=1):
|
||||||
print(result)
|
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:
|
else:
|
||||||
print("No matching game titles found.")
|
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://cs.rin.ru/"
|
||||||
# url = "https://gamesdrive.net/"
|
# url = "https://gamesdrive.net/"
|
||||||
# url = "https://gog-games.to/"
|
# url = "https://gog-games.to/"
|
||||||
|
|||||||
Reference in New Issue
Block a user