@alwaysneedhelp

Не могу найти где ошибка??

Не могу найти где ошибка в данном коде:
from bs4 import BeautifulSoup as BS
import requests
import lxml
from selenium import webdriver

def get_data(url):
	headers = {
	"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36"
	}

	req = requests.get(url, headers)
	if req == 'https://dashboard.blooket.com/login':
		from robobrowser import RoboBrowser

		browser = RoboBrowser(
		   user_agent='Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
		   parser='lxml'
		)
		browser.open('https://dashboard.blooket.com/login')

		signup_form = browser.get_form()
		signup_form['login'].value = 'raziza7757.14@gmail.com'
		signup_form['password'].value = '7757Tit67'

		# Submit the form
		browser.submit_form(signup_form)


	soup = BS(req.text, "lxml")



	button = soup.find('div', class_='styles__blookArrayContainer___HZVQe-camelCase')
	button = button.find_all('div', class_= None)
	print(button)

	status_of_blooks = []
	names_of_blooks = []
	rarety_of_blooks = []
	image_urls = []
	for button in button:
		buttons = button.click()
		print(buttons.text)
		name = buttons.find('div', class_='styles__nameText___1rn87-camelCase').text
		print(name)
		names_of_blooks.append(name)

		status_of_blook = buttons.find('div', class_='styles__quantityText___108Dj-camelCase').text
		status_of_blooks.apped(status_of_blook)

		rarety_of_blook = buttons.find('div', class_='styles__rarityText___2SGQD-camelCase').text
		rarety_of_blooks.append(rarety_of_blook)

		image_url = buttons.find('div', class_='styles__blookContainer___36LK2-camelCase styles__headerBlookImage___2DD0v-camelCase').find('img').get('src').text
		image_urls.append(image_url)


	print(image_urls)
	print(status_of_blooks)
	print(names_of_blooks)
	return rarety_of_blooks


print(get_data('https://dashboard.blooket.com/blooks'))
  • Вопрос задан
  • 343 просмотра
Решения вопроса 1
seven5674
@seven5674
Старый я уже что бы что-то в себе менять
А че вот это за ...
req = requests.get(url, headers)
  if req == 'https://dashboard.blooket.com/login':
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы