Webscraping, Beautifulsoupr4 help is required - Trying to fetch the data from indiamart website

The below mentioned code does not generating any output.
import requests
from bs4 import BeautifulSoup

url = “https://seller.indiamart.com/bltxn/?pref=recent

Send a GET request to the website

response = requests.get(url)

Create a BeautifulSoup object to parse the HTML content

soup = BeautifulSoup(response.content, “html.parser”)

Find all elements with ID=buyer_name_wa

buyer_name_elements = soup.find_all(id=“buyer_name_wa”)

Extract the values from the elements

buyer_names = [element.text for element in buyer_name_elements]

Print the extracted values

for buyer_name in buyer_names:

Please use the preformatted text to share your code.

Like this

I suspect that the website uses JavaScript to generate the page you are trying to scrap.
As such what you are doing will not work as you have not run that JavaScript.
Consider using selenium to run a web browser and extract the information you need from the DOC accessible by the selenium API.

1 Like