Answer the question
In order to leave comments, you need to log in
Why does it say: 'NoneType' object has no attribute 'get_text'?
Good evening!
Here is the code:
for link in soup.find_all(
'div', class_=['sg-col-4-of-12 sg-col-8-of-16 sg-col-16-of-24'
' sg-col-12-of-20 sg-col-24-of-32 sg-col sg-col-28-of-36 sg-col-20-of-28',
'a-section aok-relative s-image-fixed-height'],
):
pprint.pp(link)
# ссылка на фото
src = link.find('img', class_='s-image').get('src')
# название
alt = link.find('img', class_='s-image').get('alt')
# rating
rank = link.find('div', class_='a-row a-size-small').get_text(strip=True)
rank = link.find('div', class_='a-row a-size-small').get_text(strip=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question