mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
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:
@@ -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"))
|
||||||
|
|
||||||
|
|
||||||
@@ -27,4 +27,4 @@ def scrape_gofile(url):
|
|||||||
|
|
||||||
|
|
||||||
out = scrape_gofile("https://gofile.io/d/tvvzAD")
|
out = scrape_gofile("https://gofile.io/d/tvvzAD")
|
||||||
print(out)
|
print(out)
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -76,4 +76,4 @@ def scrape_steamrip_game_downloads(gamelink):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#print(offline_scrape_steamrip_links())
|
#print(offline_scrape_steamrip_links())
|
||||||
print(scrape_steamrip_game_downloads("/r-e-p-o-free-download/"))
|
print(scrape_steamrip_game_downloads("/r-e-p-o-free-download/"))
|
||||||
|
|||||||
@@ -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,14 +90,22 @@ 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()
|
||||||
|
|
||||||
|
|
||||||
exit(app.exec())
|
exit(app.exec())
|
||||||
|
|||||||
Reference in New Issue
Block a user