mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
steamrip scrapes downloadlinks for the provider - steamrip connection
This commit is contained in:
+2
-1
@@ -1,2 +1,3 @@
|
|||||||
# Created by venv; see https://docs.python.org/3/library/venv.html
|
# Created by venv; see https://docs.python.org/3/library/venv.html
|
||||||
*
|
__pycache__/
|
||||||
|
*.exe
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
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.get("https://megadb.net/qp0yi1v1p6nl")
|
||||||
|
|
||||||
|
WebDriverWait(driver, 20).until(
|
||||||
|
EC.frame_to_be_available_and_switch_to_it(
|
||||||
|
(By.XPATH, "//iframe[@title='reCAPTCHA']")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
checkboxui = WebDriverWait(driver, 20).until(
|
||||||
|
EC.presence_of_element_located((By.ID, "recaptcha-anchor"))
|
||||||
|
)
|
||||||
|
|
||||||
|
checkboxelement = driver.find_element(By.ID, "recaptcha-anchor")
|
||||||
|
|
||||||
|
while checkboxelement.get_attribute("aria-checked") == "false":
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
print("captcha is solved")
|
||||||
|
|
||||||
|
driver.quit()
|
||||||
@@ -20,9 +20,9 @@ def scrape_steamrip_links(text = None):
|
|||||||
names = []
|
names = []
|
||||||
for gamehtml in games:
|
for gamehtml in games:
|
||||||
link = gamehtml.find("a", href=lambda x: x and x.startswith("/"))
|
link = gamehtml.find("a", href=lambda x: x and x.startswith("/"))
|
||||||
links += re.findall('(?<=href=")[^"]*', link.__str__())
|
links += re.findall(r'(?<=href=")[^"]*', link.__str__())
|
||||||
name = gamehtml.find("a", href=lambda x: x and x.startswith("/"))
|
name = gamehtml.find("a", href=lambda x: x and x.startswith("/"))
|
||||||
names += re.findall('(?<=\/">)[^<]*', name.__str__())
|
names += re.findall(r'(?<=\/">)[^<]*', name.__str__())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -42,5 +42,38 @@ def offline_scrape_steamrip_links():
|
|||||||
|
|
||||||
return scrape_steamrip_links(text)
|
return scrape_steamrip_links(text)
|
||||||
|
|
||||||
|
def scrape_steamrip_game_downloads(gamelink):
|
||||||
|
url = "https://steamrip.com" + gamelink
|
||||||
|
response = requests.get(url)
|
||||||
|
|
||||||
|
soup = BeautifulSoup(response.text, "html.parser")
|
||||||
|
|
||||||
|
download_link_elements = soup.find_all("a",class_="shortc-button")
|
||||||
|
|
||||||
|
download_links = ["b", "g", "v", "m"]
|
||||||
|
|
||||||
|
for download_link in download_link_elements:
|
||||||
|
pure = download_link.attrs.get("href")
|
||||||
|
if pure[2] == "b":
|
||||||
|
download_links[0] = "https:" + pure
|
||||||
|
if pure[2] == "g":
|
||||||
|
download_links[1] = "https:" + pure
|
||||||
|
if pure[2] == "v":
|
||||||
|
download_links[2] = "https:" + pure
|
||||||
|
if pure[2] == "m":
|
||||||
|
download_links[3] = "https:" + pure
|
||||||
|
|
||||||
|
ret = []
|
||||||
|
|
||||||
|
for link in download_links:
|
||||||
|
if len(link) != 1:
|
||||||
|
ret.append(link)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
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/"))
|
||||||
Reference in New Issue
Block a user