mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
a semiworking version, line 343 in gui.py is commented cuz it needs work, the table is also a bit screwed
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
import time
|
||||
from core.utils.data.state import state
|
||||
|
||||
Metadata = {
|
||||
"headers" : ["Post Title", "Author"],
|
||||
"name" : "m0nkrus",
|
||||
}
|
||||
|
||||
def get_Metadata():
|
||||
return Metadata
|
||||
@@ -77,5 +74,14 @@ def scrape_m0nkrus(query):
|
||||
|
||||
return filtered_posts
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(scrape_m0nkrus("adobe"))
|
||||
|
||||
Metadata = {
|
||||
"name" : "m0nkrus",
|
||||
"headers" : ["Post Title", "Author"],
|
||||
"searchkey" : None,
|
||||
"scrapeFunc" : scrape_m0nkrus,
|
||||
"scrapeSearches" : True,
|
||||
}
|
||||
|
||||
if __name__ != "__main__":
|
||||
state.trackers.update({Metadata["name"] : Metadata})
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
import requests
|
||||
from core.utils.data.state import state
|
||||
from core.utils.logging.logs import consoleLog
|
||||
from core.utils.network.jsonhandler import split_data
|
||||
|
||||
Metadata = {
|
||||
"headers" : ["Post Title", "Author", "Seeders", "Leechers"],
|
||||
"name" : "rutracker",
|
||||
}
|
||||
|
||||
def get_Metadata():
|
||||
return Metadata
|
||||
|
||||
def scrape_rutracker(query):
|
||||
search = requests.get(f"{state.api_url}/search?q={query}")
|
||||
consoleLog("Sent request to server")
|
||||
consoleLog("[core.data.scrapers.rutracker] Sent request to server")
|
||||
if search:
|
||||
try:
|
||||
return search.text
|
||||
except Exception:
|
||||
consoleLog(f"No results found / No response from server, exception: {Exception}")
|
||||
return None
|
||||
_, data, _, _, _ = split_data(search.text)
|
||||
|
||||
return data
|
||||
else:
|
||||
return None
|
||||
consoleLog("[core.data.scrapers.rutracker] No search Text, returning nothing")
|
||||
return []
|
||||
|
||||
Metadata = {
|
||||
"name" : "rutracker",
|
||||
"headers" : ["Post Title", "Author", "Seeders", "Leechers"],
|
||||
"searchkey" : None,
|
||||
"scrapeFunc" : scrape_rutracker,
|
||||
"scrapeSearches" : True,
|
||||
}
|
||||
|
||||
|
||||
# This function utilizes the SoftwareManager server - source code can be found under the SoftwareManager-Server repository.
|
||||
|
||||
if __name__ != "__main__":
|
||||
state.trackers.update({Metadata["name"] : Metadata})
|
||||
|
||||
@@ -1,21 +1,33 @@
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from fuzzyfinder.main import fuzzyfinder
|
||||
import requests
|
||||
import re
|
||||
import time
|
||||
from typing import Generator
|
||||
from core.utils.data.state import state
|
||||
|
||||
Metadata = {
|
||||
"headers" : ["Game", "Availible Downloads"],
|
||||
"name" : "steamrip",
|
||||
|
||||
cache = {
|
||||
"data": [],
|
||||
"last_fetched": 0
|
||||
}
|
||||
|
||||
cache_expiry = 300
|
||||
|
||||
def get_Metadata():
|
||||
return Metadata
|
||||
|
||||
def scrape_steamrip_links(text = None):
|
||||
if text is None:
|
||||
url = f"https://steamrip.com/games-list-page/"
|
||||
response = requests.get(url)
|
||||
text = response.text
|
||||
def scrape_steamrip_links():
|
||||
|
||||
current_time = time.time()
|
||||
|
||||
if cache["data"] != [] and (current_time - cache["last_fetched"] < cache_expiry):
|
||||
return cache["data"]
|
||||
|
||||
url = f"https://steamrip.com/games-list-page/"
|
||||
response = requests.get(url)
|
||||
text = response.text
|
||||
|
||||
soup = BeautifulSoup(text, "html.parser")
|
||||
games = soup.find_all("li", class_="az-list-item")
|
||||
@@ -50,7 +62,8 @@ def scrape_steamrip_game_downloads(gamelink):
|
||||
|
||||
download_link_elements = soup.find_all("a",class_="shortc-button")
|
||||
|
||||
download_links = ["b", "g", "v", "m"]
|
||||
|
||||
download_links = ["buzzheavier", "gofile", "vikingfile", "megadb"]
|
||||
|
||||
for download_link in download_link_elements:
|
||||
pure = download_link.attrs.get("href")
|
||||
@@ -69,11 +82,28 @@ def scrape_steamrip_game_downloads(gamelink):
|
||||
if len(link) != 1:
|
||||
ret.append(link)
|
||||
|
||||
|
||||
cache["data"] = ret
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def filter_steamrip(query: str):
|
||||
|
||||
options: Generator = fuzzyfinder(query, scrape_steamrip_links(), accessor=lambda x: x["name"])
|
||||
|
||||
return list(options)
|
||||
|
||||
|
||||
|
||||
|
||||
Metadata = {
|
||||
"name" : "steamrip",
|
||||
"headers" : ["Game", "Available Downloads"],
|
||||
"scrapeFunc" : filter_steamrip,
|
||||
}
|
||||
|
||||
if __name__ != "__main__":
|
||||
state.trackers.update({Metadata["name"] : Metadata})
|
||||
|
||||
if __name__ == "__main__":
|
||||
#print(offline_scrape_steamrip_links())
|
||||
print(scrape_steamrip_game_downloads("/r-e-p-o-free-download/"))
|
||||
|
||||
@@ -2,11 +2,8 @@ import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from urllib.parse import urljoin
|
||||
from core.utils.logging.logs import consoleLog
|
||||
from core.utils.data.state import state
|
||||
|
||||
Metadata = {
|
||||
"headers" : ["Post Title", "Author"],
|
||||
"name" : "uztracker",
|
||||
}
|
||||
|
||||
def get_Metadata():
|
||||
return Metadata
|
||||
@@ -41,3 +38,14 @@ def scrape_uztracker(query):
|
||||
except requests.RequestException as e:
|
||||
consoleLog(f"Failed to fetch {search_url}: {e}")
|
||||
return None
|
||||
|
||||
Metadata = {
|
||||
"name" : "uztracker",
|
||||
"headers" : ["Post Title", "Author"],
|
||||
"searchkey" : None,
|
||||
"scrapeFunc" : scrape_uztracker,
|
||||
"scrapeSearches" : True,
|
||||
}
|
||||
|
||||
if __name__ != "__main__":
|
||||
state.trackers.update({Metadata["name"] : Metadata})
|
||||
|
||||
Reference in New Issue
Block a user