This my code. I using twocaptcha, rerequests, bs4, fake_user_agent. The code should be registered on the site using the requests.post method, but something is going wrong. Also, the code does not output errors and the result is 200. But in fact, the code does not fulfill its duties.
import time
from twocaptcha import TwoCaptcha
import requests
from bs4 import BeautifulSoup
from fake_user_agent.main import user_agent
# Капча
config = {
'server': 'rucaptcha.com',
'apiKey': 'API',
'defaultTimeout': 120,
'recaptchaTimeout': 600,
'pollingInterval': 10,
}
solver = TwoCaptcha(**config)
print(solver.balance())
result = solver.recaptcha(sitekey='6LdTYk0UAAAAAGgiIwCu8pB3LveQ1TcLUPXBpjDh',
url='https://funpay.com/account/login',
param1=...)
result = result["code"]
print(result)
# Подменяем UserAgent
site = "https://funpay.com/account/login"
user = user_agent()
header = {
"user-agent": user
}
# Ищем csrf-token
r = requests.get(site)
soup = BeautifulSoup(r.text, "lxml")
csrf = soup.find("body").get("data-app-data").split('"')[3]
print(csrf)
# Ключи
data = {
"login": login,
"password": pasword,
"csrf_token": csrf,
"g-recaptcha-response": result
}
print(data)
link = "https://funpay.com/chat/"
session = requests.Session()
session.headers = header
session.get(site)
responce = session.post(url=link, data=data, headers=header)
print(responce.text)
# Парсинг
link = "https://funpay.com/chat/"
k = session.get(link, headers=header).text