Scrape Google Search Results using Python BeautifulSoup Last Updated : 23 Jul, 2025 Suggest changes Share 9 Likes Like Report In this article, we are going to see how to Scrape Google Search Results using Python BeautifulSoup. Module Needed:bs4: Beautiful Soup(bs4) is a Python library for pulling data out of HTML and XML files. This module does not come built-in with Python. To install this type the below command in the terminal.pip install bs4 requests: Requests allows you to send HTTP/1.1 requests extremely easily. This module also does not come built-in with Python. To install this type the below command in the terminal.pip install requests Approach:Import the beautifulsoup and request libraries.Make two strings with the default Google search URL, 'https://www.google.com/search?q=' and our customized search keyword.Concatenate these two strings to get our search URL.Fetch the URL data using requests.get(url), store it in a variable, request_result.Create a string and store the result of our fetched request, using request_result.text.Now we use BeautifulSoup to analyze the extracted page. We can simply create an object to perform those operations but beautifulsoup comes with a lot of in-built features to scrape the web. We have created a soup object first using beautifulsoup from the request-response We can do soup.find.all(h3) to grab all major headings of our search result, Iterate through the object and print it as a string. Example 1: Below is the implementation of the above approach. Python3 # Import the beautifulsoup # and request libraries of python. import requests import bs4 # Make two strings with default google search URL # 'https://www.google.com/search?q=' and # our customized search keyword. # Concatenate them text= "geeksforgeeks" url = 'https://www.google.com/search?q=' + text # Fetch the URL data using requests.get(url), # store it in a variable, request_result. request_result=requests.get( url ) # Creating soup from the fetched request soup = bs4.BeautifulSoup(request_result.text, "html.parser") print(soup) Output: Let's We can do soup.find.all(h3) to grab all major headings of our search result, Iterate through the object and print it as a string. Python3 # soup.find.all( h3 ) to grab # all major headings of our search result, heading_object=soup.find_all( 'h3' ) # Iterate through the object # and print it as a string. for info in heading_object: print(info.getText()) print("------") Output: Example 2: Below is the implementation. In the form of extracting the city temperature using Google search: Python # import module import requests import bs4 # Taking thecity name as an input from the user city = "Imphal" # Generating the url url = "https://www.google.com/search?q=weather+in+" + city # Sending HTTP request request_result = requests.get( url ) # Pulling HTTP data from internet soup = bs4.BeautifulSoup( request_result.text , "html.parser" ) # Finding temperature in Celsius. # The temperature is stored inside the class "BNeawe". temp = soup.find( "div" , class_='BNeawe' ).text print( temp ) Output: A akashkumarsen4 Follow 9 Article Tags : Technical Scripter Python Technical Scripter 2020 Web-scraping Python BeautifulSoup Python web-scraping-exercises +2 More Explore Python FundamentalsPython Introduction 2 min read Input and Output in Python 4 min read Python Variables 5 min read Python Operators 4 min read Python Keywords 2 min read Python Data Types 8 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 5 min read Python Functions 5 min read Recursion in Python 4 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 4 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 2 min read Python MySQL 9 min read Python Packages 10 min read Python Modules 7 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 4 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 15+ min read StatsModel Library- Tutorial 4 min read Learning Model Building in Scikit-learn 8 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 6 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 7 min read Python | Build a REST API using Flask 3 min read How to Create a basic API using Django Rest Framework ? 4 min read Python PracticePython Quiz 1 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like