Решил написать парсер, код ниже, и при парсинге картинки выдаёт ошибку, как исправить, пишу по гайду, у человека в гайде все получилось, помогите пожалуйста
Ошибка: "AttributeError: 'NoneType' object has no attribute 'get'"
import requests
import csv
HOST = 'https://magiclesson-shop.ru'
URL = 'https://magiclesson-shop.ru/collection/karty-bicycle'
HEADERS = {'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36'}
def get_html(url, params = ''):
r = requests.get(url, headers = HEADERS, params=params)
return r
def get_content(html):
soup = BeautifulSoup(html, 'html.parser')
items = soup.find_all('div', class_ = 'product_preview')
cards = []
for item in items:
cards.append(
{
'tittle': item.find('div', class_='product_preview-title').get_text(),
'link_product': item.find('div', class_='product_preview-title').find('a').get('href'),
'price': item.find('div', class_='prices-current').get_text(),
'img_product': item.find('div', class_='product_preview-title').find('img').get('src')
}
)
return cards
html = get_html(URL)
print(get_content(html.text))