P
P
Python Newbie2021-09-03 07:21:59
Parsing
Python Newbie, 2021-09-03 07:21:59

How to get all links to products when parsing?

I'm writing a code that takes all links to products in the store: let's say this one

. I don't know how many products are on the site. How can I get all product links and put them in a list?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Prokopenko, 2021-09-03
@Goverl

Find out the class of the a tag and extract the link from there. Example:
Site code: python code:
<a class="test" href="ссылка">Я ссылка</a>
link = soup.find('a',class_='test').a.get('href')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question