Как авторизоваться на сайте через вк, гугл или стим?
Я сделал бота который делает автоматическую покупку на сайте, но для того чтобы он покупал уже нужно авторизоваться. Авторизоваться можно через стим, вк или гугл. Я ничего не нашел в интернете на эту тему. Все мои попытки были бесполезны.
import requests
from bs4 import BeautifulSoup as BS
import re
import webbrowser
import time
from tqdm import tqdm
URL = 'https://skinkeen.ru/'
clean = re.compile(r'<a\s+(?:[^>]*?\s+)?href=([""])(.*?)\1')
cycle = True
s = requests.session()
def progress_bar():
print('[INFO] Parsing')
mylist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
for i in tqdm(mylist):
time.sleep(0.08)
print('[INFO] Parsing successfully')
def BUY_request_post(url):
return 'http '+ url[4:]
def BUY(url):
r = get_html(url)
r = BS(r, 'html.parser')
csrf = r.select('input[name=_csrf-frontend]')[0]['value']
inv = r.select('input[name=inventory]')[0]['value']
fprice = r.select('input[name=fprice]')[0]['value']
data = {
'_csrf-frontend': csrf,
'inventory': inv,
'fprice': fprice
}
buy = s.post(BUY_request_post(url), data=data)
print(buy)
webbrowser.open(url)
def ignore(url):
ignore_list = ('/drobovik-cs-go/sawed-off/', '/pistolet-cs-go/cz75-auto/', '/pistolet-pulemyot-cs-go/pp-19-bizon/',
'/pulemyot-cs-go/m249/')
if url[2][19:][:len(url[2][45:])] in ignore_list:
return True
elif url[2] in ignore_list:
return True
elif url[2][19:][:len(url[2][56:])] in ignore_list:
return True
elif url[2][19:][:len(url[2][40])] in ignore_list:
return True
elif url[2][19:][:len(url[2][:46])] in ignore_list:
return True
else:
return False
def get_html(url, params=None):
progress_bar()
return requests.get(url, params=params)
def get_content(html):
bs = BS(html, 'html.parser')
items = bs.find_all('div', class_='item_view')
guns = []
for item in items:
guns.append({
'title': item.find('p', class_='item_view__title').text,
'price': float(item.find('span', class_='g-link-color').text[8:][:4].replace(',', '.')),
'discount': float(item.find('span', class_='fixprice').text[8:][:-1].replace(',', '.')),
'link': URL + clean.split(str(item.find_all('a', href=True)[0]))[2]
})
return guns
def parse():
global cycle
html = get_html(URL)
check_number = 0
if html.status_code == 200:
while cycle:
check_number = check_number + 1
print(f'Checking number {check_number}')
for item in get_content(html.text):
if item['price'] >= 20.00 and item['discount'] >= 50.0:
if ignore(item['link']):
print('[INFO] This item is ignored')
continue
print(f"\n[INFO] Found the perfect weapon! Discount {item['discount']}%, Price {item['price']}\nName: {item['title']}\n{item['link']}")
BUY(item['link'])
cycle = False
else:
print(f"[INFO] Doesn't fit! Price {item['price']} Discount {item['discount']}")
else:
print('[Danger] Parsing error')
parse()