R
R
RusKFA2021-12-03 14:24:35
Python
RusKFA, 2021-12-03 14:24:35

How to correctly parse the number of deliveries?

In general, I'm trying to get this

61a9f53679f80271088354.png

using this code

req = requests.get(url,  headers=headers)
            soup = BeautifulSoup(req.content,'lxml')




            
            try:
                    filtr = soup.find('div',{'data-testid':'delivery-badge'}, class_ = 'css-uvtelg')
            except:
                    filtr = ''

            print(filtr)

you need to get the number of deliveries

The result is like this
61a9f57d0d127762303246.png

And how?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Daniil Shevkunov, 2021-12-03
@danila763

That part of the site where successful deliveries are indicated is not parsed through requests. apparently generated using JS
This is what requests.get receives
61aa2444ec130715199021.png

K
Kirill Gorelov, 2021-12-03
@Kirill-Gorelov

Are you sure that you need to write this way
BeautifulSoup(req.content,'lxml')
and not
BeautifulSoup(req.content,'html.parser')

S
soremix, 2021-12-03
@SoreMix

https://qna.habr.com/q/1038438#answer_2008702

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question