From b9dc6cc18daf589e20db0db1f7746ba29bf40a23 Mon Sep 17 00:00:00 2001 From: nosch Date: Fri, 27 Feb 2026 23:27:45 +0100 Subject: [PATCH] im not dealing with megadb and fichier, as there are always better alternatives. if not ill add a way to select a downloaded .rar, though the links will be given to the user --- src/core/data/scrapers/provider/fichier.py | 21 ++++++++++++++++++ src/core/data/scrapers/provider/gofile.py | 2 +- src/core/data/scrapers/provider/megadb.py | 9 ++++---- src/core/data/scrapers/steamrip.py | 2 +- src/core/interface/utils/fzhelper.py | 25 +++++++++++++++++----- 5 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 src/core/data/scrapers/provider/fichier.py diff --git a/src/core/data/scrapers/provider/fichier.py b/src/core/data/scrapers/provider/fichier.py new file mode 100644 index 0000000..7a54af5 --- /dev/null +++ b/src/core/data/scrapers/provider/fichier.py @@ -0,0 +1,21 @@ +import requests +from bs4 import BeautifulSoup + +def scrape_fichier(url: str): + response = requests.get(url) + + soup = BeautifulSoup(response.text, "html.parser") + + btn = soup.find_all("a", class_="ok") + + print(response.text) + + link = btn[0].get("href") + + return link + + +if __name__ == "__main__": + print(scrape_fichier("https://1fichier.com/?ai6vzcfi1r79q9rebc3a")) + + diff --git a/src/core/data/scrapers/provider/gofile.py b/src/core/data/scrapers/provider/gofile.py index 0ea6527..7ee9ddf 100644 --- a/src/core/data/scrapers/provider/gofile.py +++ b/src/core/data/scrapers/provider/gofile.py @@ -27,4 +27,4 @@ def scrape_gofile(url): out = scrape_gofile("https://gofile.io/d/tvvzAD") -print(out) \ No newline at end of file +print(out) diff --git a/src/core/data/scrapers/provider/megadb.py b/src/core/data/scrapers/provider/megadb.py index decaa4e..4e9c6de 100644 --- a/src/core/data/scrapers/provider/megadb.py +++ b/src/core/data/scrapers/provider/megadb.py @@ -2,18 +2,17 @@ import undetected_chromedriver as uc from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import TimeoutException import time options = uc.ChromeOptions() options.set_capability("goog:loggingPrefs", {"performance": "ALL"}) -driver = uc.Chrome(options=options) +driver = uc.Chrome(options=options, version_main=145) driver.get("https://megadb.net/qp0yi1v1p6nl") WebDriverWait(driver, 20).until( - EC.frame_to_be_available_and_switch_to_it( + EC.frame_to_be_available_and_switch_to_it( (By.XPATH, "//iframe[@title='reCAPTCHA']") ) ) @@ -27,6 +26,8 @@ checkboxelement = driver.find_element(By.ID, "recaptcha-anchor") while checkboxelement.get_attribute("aria-checked") == "false": time.sleep(1) + + print("captcha is solved") -driver.quit() \ No newline at end of file +driver.quit() diff --git a/src/core/data/scrapers/steamrip.py b/src/core/data/scrapers/steamrip.py index 089b95b..1eef2ad 100644 --- a/src/core/data/scrapers/steamrip.py +++ b/src/core/data/scrapers/steamrip.py @@ -76,4 +76,4 @@ def scrape_steamrip_game_downloads(gamelink): if __name__ == "__main__": #print(offline_scrape_steamrip_links()) - print(scrape_steamrip_game_downloads("/r-e-p-o-free-download/")) \ No newline at end of file + print(scrape_steamrip_game_downloads("/r-e-p-o-free-download/")) diff --git a/src/core/interface/utils/fzhelper.py b/src/core/interface/utils/fzhelper.py index bfe975d..3fd6f0b 100644 --- a/src/core/interface/utils/fzhelper.py +++ b/src/core/interface/utils/fzhelper.py @@ -1,6 +1,8 @@ +from typing import Generator import fuzzyfinder from PySide6 import QtCore, QtWidgets, QtGui from sys import exit +from copy import deepcopy class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere """ @@ -18,11 +20,13 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere keys in ignorekeys will be ignored and not displayed, e.g. if oyu have links in the database which arent relevant """ - def __init__(self, options: list[dict[str, str]], ignorekeys: list[str] = []): + def __init__(self, options: list[dict[str, str]], ignorekeys: list[str] = [], columnClicklShouldReturn = 1): super().__init__() self.opts: list[dict[str, str]] = options + self.filtered_opts = deepcopy(self.opts) self.ignorekeys = ignorekeys + self.returncolumn = columnClicklShouldReturn self.searchbox = QtWidgets.QLineEdit() self.searchbox.setPlaceholderText("Search for a game on Steamrip") @@ -57,7 +61,7 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere self.searchbox.textChanged.connect(self.filter_table) - + self.table.cellClicked.connect(self.cellClick) layout = QtWidgets.QGridLayout(self) layout.addWidget(self.searchbox, 0, 0) @@ -70,9 +74,12 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere searchquery = self.searchbox.text() - options = fuzzyfinder.main.fuzzyfinder(searchquery, self.opts, accessor=lambda x: x["name"]) + options: Generator = fuzzyfinder.main.fuzzyfinder(searchquery, self.opts, accessor=lambda x: x["name"]) + + self.filtered_opts = [] for row_index, row_data in enumerate(options): + self.filtered_opts.append(row_data) for col_index, key in enumerate(row_data.keys()): if key in self.ignorekeys: continue @@ -83,14 +90,22 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere QtWidgets.QTableWidgetItem(value) ) + def cellClick(self, row: int, column: int): + item = self.table.item(row, self.returncolumn) + + if item is not None: + value = item.text() + print(value) + + if __name__ == "__main__": import core.data.scrapers.steamrip as sr app = QtWidgets.QApplication([]) - widget = FuzzySearchWindow(sr.offline_scrape_steamrip_links(), ["link"]) + widget = FuzzySearchWindow(sr.offline_scrape_steamrip_links()) widget.resize(600,400) widget.show() - exit(app.exec()) \ No newline at end of file + exit(app.exec())