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

This commit is contained in:
nosch
2026-02-27 23:27:45 +01:00
parent 29bac99359
commit b9dc6cc18d
5 changed files with 48 additions and 11 deletions
@@ -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"))
+4 -3
View File
@@ -2,18 +2,17 @@ import undetected_chromedriver as uc
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import time import time
options = uc.ChromeOptions() options = uc.ChromeOptions()
options.set_capability("goog:loggingPrefs", {"performance": "ALL"}) 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") driver.get("https://megadb.net/qp0yi1v1p6nl")
WebDriverWait(driver, 20).until( 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']") (By.XPATH, "//iframe[@title='reCAPTCHA']")
) )
) )
@@ -27,6 +26,8 @@ checkboxelement = driver.find_element(By.ID, "recaptcha-anchor")
while checkboxelement.get_attribute("aria-checked") == "false": while checkboxelement.get_attribute("aria-checked") == "false":
time.sleep(1) time.sleep(1)
print("captcha is solved") print("captcha is solved")
driver.quit() driver.quit()
+19 -4
View File
@@ -1,6 +1,8 @@
from typing import Generator
import fuzzyfinder import fuzzyfinder
from PySide6 import QtCore, QtWidgets, QtGui from PySide6 import QtCore, QtWidgets, QtGui
from sys import exit from sys import exit
from copy import deepcopy
class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere 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 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__() super().__init__()
self.opts: list[dict[str, str]] = options self.opts: list[dict[str, str]] = options
self.filtered_opts = deepcopy(self.opts)
self.ignorekeys = ignorekeys self.ignorekeys = ignorekeys
self.returncolumn = columnClicklShouldReturn
self.searchbox = QtWidgets.QLineEdit() self.searchbox = QtWidgets.QLineEdit()
self.searchbox.setPlaceholderText("Search for a game on Steamrip") 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.searchbox.textChanged.connect(self.filter_table)
self.table.cellClicked.connect(self.cellClick)
layout = QtWidgets.QGridLayout(self) layout = QtWidgets.QGridLayout(self)
layout.addWidget(self.searchbox, 0, 0) layout.addWidget(self.searchbox, 0, 0)
@@ -70,9 +74,12 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere
searchquery = self.searchbox.text() 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): for row_index, row_data in enumerate(options):
self.filtered_opts.append(row_data)
for col_index, key in enumerate(row_data.keys()): for col_index, key in enumerate(row_data.keys()):
if key in self.ignorekeys: if key in self.ignorekeys:
continue continue
@@ -83,12 +90,20 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere
QtWidgets.QTableWidgetItem(value) 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__": if __name__ == "__main__":
import core.data.scrapers.steamrip as sr import core.data.scrapers.steamrip as sr
app = QtWidgets.QApplication([]) app = QtWidgets.QApplication([])
widget = FuzzySearchWindow(sr.offline_scrape_steamrip_links(), ["link"]) widget = FuzzySearchWindow(sr.offline_scrape_steamrip_links())
widget.resize(600,400) widget.resize(600,400)
widget.show() widget.show()