Skip to content
Advertisement

How to use BeautifulSoup to parse google search results in Python

I am trying to parse the first page of google search results. Specifically, the Title and the small Summary that is provided. Here is what I have so far:

JavaScript

The part I am stuck on now is going down the HTML path to parse the specific data that I want. Everything I have tried so far has just thrown an error saying that it has no attribute or it just gives back “[]”.

I am new to Python and BeautifulSoup so I am not sure the syntax of how to get to where I want. I have found that these are the individual search results in the page:

https://ibb.co/jfRakR

Any help on what to add to parse the Title and Summary of each search result would be MASSIVELY appreciated.

Thank you!

Advertisement

Answer

Your url doesn’t work for me. But with https://google.com/search?q= I get results.

JavaScript

Read Beautiful Soup Documentation

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