Я парсил сайт цитрус, а именно
https://www.ctrs.com.ua/smartfony/brand-apple/seri...
вот код
import requests
from bs4 import BeautifulSoup
url = 'https://www.ctrs.com.ua/smartfony/brand-apple/seriya_iphone-13_iphone-13-mini_iphone-13-pro_iphone-13-pro-max/'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'lxml')
priecelist=[]
phones = soup.findAll('div',class_ ='br10 p8 border-box pr productCardCategory-0-2-281')
#print(phones)
for phone in phones:
print("-------------------------------------------------------------------------------------------------------------")
name = phone.find('a', class_='link line-clamp-2 break-word link-0-2-284').text
price = phone.find('div', class_='medium fz16 price-0-2-313').text
link = phone.find('a', class_='link line-clamp-2 break-word link-0-2-284').get('href')
print("https://www.ctrs.com.ua" + str(link))
print(name)
print(price)
priecelist.append(price)
print("-------------------------------------------------------------------------------------------------------------")
print(priecelist)
в итоге появилась ошибка
Traceback (most recent call last):
File "C:\Users\...", line 22, in
price = phone.find('div', class_='medium fz16 price-0-2-313').text
AttributeError: 'NoneType' object has no attribute 'text'
что делать?