Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##############################
- # KICKZ MONITOR BY LULABA#7436
- ##############################
- from bs4 import BeautifulSoup
- from datetime import datetime
- import requests
- import time
- import json
- from proxymanager import ProxyManager
- from dhooks import Webhook, Embed
- from tinydb import TinyDB, Query
- from colorama import init
- init()
- ##################
- db = TinyDB('db.json')
- hook = Webhook('https://discordapp.com/api/webhooks/633385841011458079/buCdFclVoe02gVgTODUYqX-E221px3_mBULsic7k45iW6c6A0zzqdrZMdcHSt_7iJxY5', username = 'https://www.kickz.com', avatar_url = 'https://pbs.twimg.com/profile_images/592962053737951232/GOK0vBH5_400x400.jpg')
- mainUrl = 'https://www.kickz.com/it/jordan-basket-retro-air-jordan-1-retro-high-og-black_gym_red_white_sail-107840042'
- proxylist = ProxyManager('proxies.txt')
- headers = {'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Mobile Safari/537.36',
- 'upgrade-insecure-requests':'1',
- 'cache-control':'max-age=0',
- 'accept-language':'it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6',
- 'accept-encoding':'gzip, deflate, br',
- 'sec-fetch-mode':'navigate',
- 'sec-fetch-site':'same-origin',
- 'sec-fetch-user':'?1',
- 'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
- 'authority':'www.kickz.com'
- }
- ########################
- print('\033[34m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Kickz Monitor')
- print('\033[34m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Made by Lulaba#7436')
- def monitor(headers, mainUrl):
- max_retries=10
- for i in range(max_retries):
- try:
- proxy = proxylist.random_proxy()
- proxies = proxy.get_dict()
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Starting...')
- html = requests.get(mainUrl, headers= headers, proxies= proxies, timeout= 5).text
- if html.status_code != 200:
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + "ERROR, status code: " + str(html.status_code))
- continue
- else:
- pass
- if html.status_code == 200:
- print('\033[31m' +' [ '+ time.strftime('%H:%M:%S') + ' ] ' + "Signature: " + str(html.status_code))
- else:
- pass
- except (TimeoutError, requests.exceptions.Timeout):
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Timeout expired, thread restarted!')
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Proxy used:' + proxies['http'])
- continue
- except (requests.exceptions.ProxyError,requests.exceptions.ConnectionError):
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Proxy error:' + proxies['http'])
- proxyNotify()
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Switching proxies')
- continue
- except Exception as e:
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + "Unknown error, restarting: " + str(e))
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + "Proxy used:" + proxies['http'])
- print('\033[31m' + ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + "Status code:" + str(html.status_code))
- continue
- else:
- exit()
- soup = BeautifulSoup(html, 'lxml')
- eskere = open('soup.txt', 'w', encoding='utf-8')
- eskere.write(str(soup))
- eskere.close
- print(' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'SOUP PRINTED !!')
- availablesizes = []
- prodTitle = soup.find('h1', {'id':'prodNameId'}).get_text()
- prodImage = soup.find('img', {'alt':f'{prodTitle}'})['src']
- prodColor = soup.find('span', {'id':'variantColorId'}).get_text()
- prodSku = soup.find('span', {'id':'supplierArtNumSpan'}).get_text()
- sizeList = soup.find('div', {'id':'1SizeContainer'})
- for size in sizeList.findAll('a'):
- availablesizes.append(size['data-size'])
- entry = {
- 'prodTitle': prodTitle,
- 'availablesizes': availablesizes
- }
- if entry in db.all():
- print('The entry was a duplicate.' + '\n' + '--------------')
- #If not a duplicate
- else:
- Model = Query()
- db.remove(Model['prodTitle'] == prodTitle)
- db.insert(entry)
- newNotify(hook, prodTitle, mainUrl, availablesizes, prodSku, prodColor, prodImage)
- #Log
- print('\n'.join(map(str, availablesizes)))
- def newNotify(hook, prodTitle, mainUrl, availablesizes, prodSku, prodColor, prodImage):
- embed = Embed(
- color = 0x08e2ff,
- description = ''
- )
- embed.set_title(title= f'{prodTitle}', url= f'{mainUrl}')
- embed.add_field(name= '**Color**', value = f'{prodColor}', inline = True)
- embed.add_field(name= '**Sku**', value = f'{prodSku}', inline = True)
- embed.add_field(name= '**Sizes**', value = '\n'.join(availablesizes), inline = False)
- embed.add_field(name= '**Quick Links**', value = '[**LOGIN**](https://www.kickz.com/it/user/login-show) | [**CART**](https://www.kickz.com/it/cart)', inline= False)
- embed.set_footer(text= ' [ '+ time.strftime('%H:%M:%S') + ' ] ' + '- Kickz by Lulaba#7436')
- embed.set_thumbnail(str(prodImage))
- hook.send(embed = embed)
- print(' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'Webhook sent to discord!')
- def proxyNotify():
- hook = Webhook('https://discordapp.com/api/webhooks/632896659256377385/TmxfcCDCECyjQF270MD3qZGB2l1x-WA4AcKTGdJ0lVoVoS_csVVVFzsvTlQjBBgiPrDJ', username = 'https://www.kickz.com', avatar_url = 'https://pbs.twimg.com/profile_images/592962053737951232/GOK0vBH5_400x400.jpg')
- hook.send(' [ '+ time.strftime('%H:%M:%S') + ' ] ' + 'PROXY ERROR OCCURED MAYBE NEED TO RESTART')
- while True:
- monitor(headers, mainUrl)
- time.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement