J
J
jelly94012021-09-23 18:42:31
Python
jelly9401, 2021-09-23 18:42:31

How to parse a link to a Kufar seller?

There is a site kufar.by, from any product from there I try to parse the link to the seller with the following code:

import requests
from bs4 import BeautifulSoup

src = requests.get("https://www.kufar.by/item/137097961").text

soup = BeautifulSoup(src, "lxml")
item = soup.find("a", class_="kf-Fqrg-c7f38")
print(item)

Outputs None, what could be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2021-09-23
@jelly9401

It looks like this

curl -s https://www.kufar.by/item/137097961 | grep 'kf-Fqrg-c7f38' && echo 'Есть kf-Fqrg-c7f38' ||  echo 'Нету kf-Fqrg-c7f38'
Нету kf-Fqrg-c7f38

You can’t parse through BS for the same reason why curl didn’t return a result - it requires the download to take place in the browser and work js.
To solve the problem, you need to use, for example, selenium

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question