D
D
DUDE2021-07-20 11:57:03
Python
DUDE, 2021-07-20 11:57:03

Why doesn't bs4 parse images?

There is html

<div data-name="Carousel">
    <img>
    <img>
    <img>
    <img>
    ...
</div>


If I look in the browser console, then the number of images in the div is an order of magnitude greater than ten. But if I pull all the images through bs4, I get exactly 10 images.
images = soup.find(name="div", attrs={"data-name": "Carousel"}).find_all(name="img")


Moreover, there is no error at the bs4 level, if I print a carousel, then there will be exactly 10 img tags.
What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EgorSvinarev, 2021-07-20
@EgorSvinarev

Perhaps the image on the client is loaded via ajax. In this case, it is better to get the page code through Selenium

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question