diff --git a/main.py b/main.py index 94f2449..43cf331 100644 --- a/main.py +++ b/main.py @@ -39,10 +39,10 @@ def checksites(sitepath=None): with open(sitefile, 'r') as f: data = json.load(f) - asite = site.Site(sitename, data['url']) + asite = site.Site(sitename, data) print(f"> {Fore.MAGENTA}{asite.name:10s}{Style.RESET_ALL} |" - f" {tools.keyword('URL')}({asite.url})") + f" {tools.keyword('URL')}({asite.base})") sitedic[asite.name] = asite @@ -91,6 +91,8 @@ def createproxys(proxypath=None): proxydic[my.name] = my print(f"> {Fore.MAGENTA}{my.name:10s}{Style.RESET_ALL} |" f" {tools.keyword('PROXYIP')}({my.ip}) {tools.keyword('WORKING')}({my.isworking})") + + my.testurl(dicSites['adidas']) ################################### print(tools.spacer) diff --git a/sites/adidas.json b/sites/adidas.json new file mode 100644 index 0000000..3a2c444 --- /dev/null +++ b/sites/adidas.json @@ -0,0 +1,19 @@ +{ + "base": "https://www.adidas.de", + "monitor": "https://www.adidas.de/release-termine", + "register": "https://www.adidas.de/account-register", + "headers": { + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36", + "referer": "https://www.adidas.de/account-login", + "accept-encoding": "gzip, deflate, br", + "accept-language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7", + "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", + "cache-control": "max-age=0", + "sec-fetch-dest": "document", + "sec-fetch-mode": "navigate", + "sec-fetch-site": "same-origin", + "sec-fetch-user": "?1", + "upgrade-insecure-requests": "1", + "dnt": "1" + } +} \ No newline at end of file diff --git a/sites/nike.json b/sites/nike.json index ea64640..a9d45b4 100644 --- a/sites/nike.json +++ b/sites/nike.json @@ -1,3 +1,4 @@ { - "url": "https://www.nike.com/de/launch?s=upcoming" + "base": "https://www.nike.com/de/", + "monitor": "https://www.nike.com/de/launch?s=upcoming" } diff --git a/src/proxy.py b/src/proxy.py index 8b2f4db..4e0eb9e 100644 --- a/src/proxy.py +++ b/src/proxy.py @@ -44,8 +44,8 @@ class Proxy: print(f"[DEBUG] {proxies}") headers = { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)' - ' Chrome/86.0.4240.111 Safari/537.36' + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' + 'Chrome/86.0.4240.183 Safari/537.36' } try: @@ -73,8 +73,16 @@ class Proxy: print(f"[DEBUG] Connection Error | (check proxy settings)\n[DEBUG] {e}") self.isworking = False - def testurl(self, url): + def testurl(self, siteobj): + + self.session.headers = siteobj.headers + url = siteobj.register + + print(f"Starting URL Test {url}") + print(self.isworking) + print(self.session) if self.isworking: - r = self.session.get(url) + r = self.session.get(url, timeout=10) + print(r) data = r.text print(data) diff --git a/src/site.py b/src/site.py index f2da908..5a9630a 100644 --- a/src/site.py +++ b/src/site.py @@ -1,11 +1,26 @@ class Site: - def __init__(self, name, url): + def __init__(self, name, data): # Necessary self.name = name - self.url = url + self.data = data # Created - self.data = None self.ext = None + self.base = None + self.monitor = None + self.register = None + self.headers = None + + self.resolve() + + def resolve(self): + if "base" in self.data: + self.base = self.data['base'] + if "monitor" in self.data: + self.monitor = self.data['monitor'] + if "register" in self.data: + self.register = self.data['register'] + if "headers" in self.data: + self.headers = self.data['headers']