diff --git a/main.py b/main.py index b77c7b4..9e0859e 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ from sys import argv from os import environ from dotenv import load_dotenv from cloudscraper import CloudScraper, create_scraper +from re import findall class Scraper: def __init__(self, pseudo, password, app, debug = False): @@ -43,13 +44,38 @@ class Scraper: def search(self, session) -> str: if self.debug: print("Going to search page...", end = " ") reponse = session.get(f"{self.url}/search.php", params = {"keywords": self.requested_app, "sr": "topics", "sf": "titleonly"}) - if self.debug: print(reponse.status_code, reponse.url) - with open("temp.html", "w") as f: # debug - f.writelines(reponse.text) + + if self.debug: print("Results retrieval...", end = " ") + linkList = self.parse(reponse.text) + # if self.debug: print(reponse.status_code, reponse.url) + # with open("temp2.log", "w") as f: # debug + # f.writelines(res) link = "No link for your application was found." return link + def parse(self, htmlPage: str) -> list: + elements = htmlPage.split("