mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
worked on downloads, magnets are next
This commit is contained in:
@@ -2,10 +2,9 @@ from bs4 import BeautifulSoup
|
||||
import requests
|
||||
import time
|
||||
from core.utils.data.state import state
|
||||
|
||||
|
||||
def get_Metadata():
|
||||
return Metadata
|
||||
from core.utils.network.jsonhandler import format_data
|
||||
from core.utils.data.tracker import get_magnet_link
|
||||
from typing import Dict
|
||||
|
||||
cache = {
|
||||
"data": [],
|
||||
@@ -74,13 +73,15 @@ def scrape_m0nkrus(query):
|
||||
|
||||
return filtered_posts
|
||||
|
||||
def get_magnet(post: Dict):
|
||||
_, post_links, _, _, _ = format_data([post])
|
||||
return post_links[0]
|
||||
|
||||
Metadata = {
|
||||
"name" : "m0nkrus",
|
||||
"headers" : ["Post Title", "Author"],
|
||||
"searchkey" : None,
|
||||
"scrapeFunc" : scrape_m0nkrus,
|
||||
"scrapeSearches" : True,
|
||||
""
|
||||
}
|
||||
|
||||
def init_m0nkrus():
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import requests
|
||||
from core.utils.data.state import state
|
||||
from core.utils.logging.logs import consoleLog
|
||||
from core.utils.network.jsonhandler import split_data
|
||||
|
||||
from core.utils.network.jsonhandler import split_data, format_data
|
||||
from typing import Dict
|
||||
|
||||
def scrape_rutracker(query):
|
||||
search = requests.get(f"{state.api_url}/search?q={query}")
|
||||
@@ -28,13 +28,18 @@ def scrape_rutracker(query):
|
||||
else:
|
||||
consoleLog("[core.data.scrapers.rutracker] No search Text, returning nothing")
|
||||
return []
|
||||
|
||||
|
||||
|
||||
def get_magnet_link(post: Dict):
|
||||
_, post_links, _, _, _ = format_data([post])
|
||||
return post_links[0]
|
||||
|
||||
Metadata = {
|
||||
"name" : "rutracker",
|
||||
"headers" : ["Post Title", "Author", "Seeders", "Leechers"],
|
||||
"searchkey" : None,
|
||||
"scrapeFunc" : scrape_rutracker,
|
||||
"scrapeSearches" : True,
|
||||
"linkFunc" : get_magnet_link,
|
||||
"isMagnet" : True,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
|
||||
import os
|
||||
from bs4 import BeautifulSoup
|
||||
from fuzzyfinder.main import fuzzyfinder
|
||||
import requests
|
||||
import re
|
||||
import time
|
||||
import webbrowser
|
||||
from typing import Generator
|
||||
from core.utils.data.state import state
|
||||
from core.utils.logging.logs import consoleLog
|
||||
|
||||
|
||||
cache = {
|
||||
@@ -86,6 +89,21 @@ def scrape_steamrip_game_downloads(gamelink):
|
||||
|
||||
return ret
|
||||
|
||||
def get_download_link(post: Dict):
|
||||
url = post["link"]
|
||||
links = scrape_steamrip_game_downloads(url)
|
||||
best = ""
|
||||
for link in links:
|
||||
if link[0] != "h":
|
||||
best = link
|
||||
break
|
||||
|
||||
if links.index(best) < 2:
|
||||
return best
|
||||
else:
|
||||
consoleLog("cant scrape this cuz of captcha... opening in the browser")
|
||||
webbrowser.open(best)
|
||||
return None
|
||||
|
||||
def filter_steamrip(query: str):
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@ from bs4 import BeautifulSoup
|
||||
from urllib.parse import urljoin
|
||||
from core.utils.logging.logs import consoleLog
|
||||
from core.utils.data.state import state
|
||||
from typing import Dict
|
||||
|
||||
|
||||
def get_Metadata():
|
||||
return Metadata
|
||||
|
||||
def scrape_uztracker(query):
|
||||
base_url="https://uztracker.net/"
|
||||
search_url = f"{base_url.rstrip('/')}/tracker.php?nm={query}"
|
||||
@@ -48,6 +46,9 @@ Metadata = {
|
||||
"scrapeFunc" : scrape_uztracker,
|
||||
"scrapeSearches" : True,
|
||||
}
|
||||
def get_magnet_link(post: Dict):
|
||||
item = "https://uztracker.net/" + post["url"].lstrip("./")
|
||||
return item
|
||||
|
||||
def init_uztracker():
|
||||
state.trackers.update({Metadata["name"] : Metadata})
|
||||
|
||||
Reference in New Issue
Block a user