Skip to content
Advertisement

I am trying to webscrape from Zomato, however it returns with an output of “None” and Attribute Error

Whenever i try to extract the data, it returns an output of “None” which I am not sure of is it the code (I followed the rules of using bs4) or is it just the website that’s different to scrape?

My code:

JavaScript

Here is the inspected tag of the website which i try to get the h4 class showing the restaurant’s name:

inspected element

Advertisement

Answer

What happens?

Classes are generated dynamically and may differ from your inspections via developer tools – So you won’t find what you are looking for.

How to fix?

It would be a better approach to select your targets via tag or id if available, cause these are more static than css classes.

JavaScript

Example

Iterating listings and scrape several infromation:

JavaScript

Output

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement