Perform Google search with python script

Suppose you are working on a python project and you need to access some data from the web inside your python project. But you have no idea how to scrap that particular website data. In that case, you need to perform the google search.

As Python is famous for its capability to automate the stuff and solve bigger problems. Here we will also use some python libraries and perform the google search to get the required data. Find below step by step tutorial on how to perform the google search using Python Script-


Prerequisite - 

1- You must have Python installed on your system.

2- Install googlesearch library (pip install google-search)and webbrowser library (pip install webbrowser) on your system.

If you already have all the prerequisite then you are almost done as you only need to write few lines of code and you can run the python code to perform google search.

Follow these simple steps-

1 - Copy the code given below and save as .py file in your system.       let's say (google-search.py).

from googlesearch import*
import webbrowser
# to search
query = input()

chrome_path = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"

for url in search(query, tld="co.in", num=1, stop=1, pause=2):
    webbrowser.get(chrome_path).open(url)

2 - To run this code in windows open file Python IDLE and run the program from there.



3 - when you will click on the run module it will open the command window where you need to enter the keyword you need to perform google search for - (here we have entered gmail)


4 - As soon as you will type your keyword and press enter you eill see that three tabs will open on your web browser which will be first three search result of your google search.

It will only open 3 as we have taken pause value 2. We can change this value to the number of results we want to show.

NOTE-

 Linux user can directly jump to the directory of that file and open terminal and run this command python google-search.py and input the text you want to search and you will see that 3 tabs will open on your web browser.

These three websites will be the first three google search result of our search query.



Comments

  1. You blog post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.
    python Training institute in Chennai
    python Training institute in Bangalore

    ReplyDelete
  2. Looking for the Genuine Experience Certificate with 100% Complete Verification So Contact Experienced Letter Solutions Consulting Firms Which Provide Experienced Letter with100 % Guaranteed. Contact Now- 9599119376. Or Visit Website- https://experincedletter.blogspot.com/


    ReplyDelete
  3. Looking for the Genuine Experience Certificate with 100% Complete Verification So Contact Experienced Letter Solutions Consulting Firms Which Provide Experienced Letter with100 % Guaranteed. Contact Now- 9599119376. Or Visit Website- https://experincedletter.blogspot.com/

    ReplyDelete
  4. you should upgrade your range of abilities in huge information in a propelled manner. ExcelR Data Science Courses

    ReplyDelete
  5. I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information? Buy Pinterest Followers

    ReplyDelete
  6. It’s really great information for becoming a better Blogger. Keep sharing, Thanks...

    Learn Hadoop Training from the Industry Experts we bridge the gap between the need of the industry. Softgen Infotech provide the Best Hadoop Training in Bangalore with 100% Placement Assistance. Book a Free Demo Today.
    Big Data Analytics Training in Bangalore
    Tableau Training in Bangalore
    Data Science Training in Bangalore
    Workday Training in Bangalore

    ReplyDelete
  7. The article looks magnificent, but it would be beneficial if you can share more about the suchlike subjects in the future. Keep posting. 상품권 매입

    ReplyDelete
  8. Libraries are able to support many operations like Data Scraping, NLP and other applications of machine learning. Due to such advantages and uses, students are preferring python programming tutorial rather than other languages. Also, there are many online video training courses available, user or any interested candidate can buy them from any place. unindent does not match any outer indentation level

    ReplyDelete
  9. he luxury of effective interaction and selection of tools and other accessories were vested with the clients. This type of assignments strained the budget of most of the web enterprises but still they had perforce to go in for such web development orders since they desperately wanted websites at their disposal. Jake Hackett

    ReplyDelete
  10. Wonderful article, very useful and well explanation. Your post is extremely incredible. I will refer this to my candidates...data science courses

    ReplyDelete
  11. The study of Home Science offers openings for Careers related to: data science course in india

    ReplyDelete
  12. I feel really happy to have seen your web page and look forward to so many more entertaining times reading here. Thanks once more for all the details.

    best data science courses in chennai

    ReplyDelete
  13. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective.

    Python Training Institute in Delhi

    ReplyDelete
  14. The best example is a lovely response from Lego, who could just reply with a "standard message" but it was so personalized and unexpected that went viral to all channels. his comment is here

    ReplyDelete
  15. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    data scientist training in hyderabad

    ReplyDelete
  16. Big thank you for for sharing this post it's the content i looking for if anyone looking AutoCAD training institute in delhi Contact Here-+91-9311002620 Or Visit Website- https://www.htsindia.com/AutoCAD-training-courses

    ReplyDelete
  17. Anyone looking for Best Consulting Firm for Fake Experience Certificate Providers in bangalore, India with Complete Documents So Dreamsoft Consultancy is the Best Place.Further Details Here- 9599119376 or VisitWebsite-https://experiencecertificates.com/experience-certificate-provider-in-bangalore.html

    ReplyDelete
  18. During this post, you have shared fantastic content about Coding Institute in Delhi. This article provided me with some useful knowledge. Thank you for sharing that. Keep up the good work.

    ReplyDelete
  19. I really liked while reading your article, the information you have mentioned in this post is really good. I am waiting for your upcoming post your ,post is really good . Otherwise if anyone want to Learn javaCourse So Contact Us-9311002620 Or check my website- https://www.htsindia.com/Courses/tally/tally-training-course

    ReplyDelete
  20. Thank you so much for sharing this information. Appreciated your post! Else anyone interested in Python Couse, Contact Us On 9311002620 or You can Visit our Website : https://www.htsindia.com/Courses/python/python-training-institute-in-south-delhi

    ReplyDelete
  21. Thank you for sharing this content in your post thank you apart form that if anyone look for Python training institute in Delhi Contact Here-+91-9311002620 Or Visit Website- https://www.htsindia.com/Courses/python/python-training-institute-in-delhi

    ReplyDelete
  22. This blog is very knowledgeable. Thank you for writing this blog. Dreamsoft Consultancy is one of the Leading Company in India who Provide Genuine Experience Certificate in Pune. So Contact here and Get all Details. Contact Us with Get all Details- 9599119376 or check Our Website- https://experiencecertificates.com/experience-certificate-provider-in-mumbai.html

    ReplyDelete

  23. Gone through your blog it is very knowledgeable and have very interesting fact. Dreamsoft is the 20 years old consultancy providing fake experience certificate in Noida To get fake experience certificate in Noida you can call at 9599119376 or can the visit https://experiencecertificates.com/experience-certificate-provider-in-Noida.html

    ReplyDelete

  24. Your way of writing the blog is very nice your writing skill are very nice. I always read your every blog. Dreamsoft is 20years old consultancy providing experience certificate in Bangalore. Experience certificate plays an important role your interview. To get your experience certificate in Bangalore 9599119376 or can visit the website athttps://experiencecertificates.com/experience-certificate-provider-in-bangalore.html

    ReplyDelete
  25. Jubilant to read your blog. One of the best I have gone through. If anyone want to get experience certificate in Pune. Here the Dreamsoft is providing the genuine experience certificate in Pune. Dreamsoft is the 20 years old consultancy providing experience certificate in Pune. You can contact at the 9599119376 or can go to our website at https://experiencecertificates.com/experience-certificate-provider-in-pune.html

    ReplyDelete

  26. Good to hear you views about I totally agree to your views. For filling the gap in the courier Dreamsoft will provide the Genuine experience certificate in Delhi, so here is your turn to grab the opportunity and to take your experience certificate in Delhi. The one who is interested for the experience certificate in Delhi may contact at 9599119376 or can visit our website at https://experiencecertificates.com/experience-certificate-provider-in-delhi.html

    ReplyDelete
  27. It's very nice of you to share your knowledge through posts. I love to read stories about your experiences. They're very useful and interesting. I am excited to read the next posts. I'm so grateful for all that you've done. Keep plugging. Many viewers like me fancy your writing. Thank you for sharing precious information with us. Best python list methods service provider.

    ReplyDelete
  28. Hire Python Freelancer for Implementation Consulting & Outsourcing of Projects. Python Consulting Company

    ReplyDelete
  29. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. python course london

    ReplyDelete
  30. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. python course london

    ReplyDelete
  31. Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post .
    data analytics courses in hyderabad with placements

    ReplyDelete
  32. It's late finding this act. At least, it's a thing to be familiar with that such events exist. I agree with your Blog and I will be back to inspect it more in the future so please keep up your act.
    data analytics course in hyderabad

    ReplyDelete
  33. It is truly well-researched content and has excellent wording. I got so engaged in this material that I couldn’t wait to read it. I am impressed with your work and skill visit also Professional Cloud Business Management Service

    ReplyDelete
  34. Performing a Google search using a Python script can automate the retrieval of information efficiently. Utilizing libraries like googlesearch-python simplifies the process of fetching URLs related to a specific query.

    Data Science Courses in Kolkata

    ReplyDelete
  35. Using a Python script to perform a Google search automates the retrieval of relevant information quickly and efficiently. Libraries like `googlesearch-python` simplify the process, allowing users to access search results programmatically.

    Data Science Courses in Kolkata

    ReplyDelete
  36. This tutorial provides a straightforward way to perform Google searches programmatically using Python. By utilizing the googlesearch library along with the webbrowser module, you can easily automate the process of searching for data online. The step-by-step instructions make it accessible even for beginners, and the example code demonstrates how to retrieve and display search results in your web browser. It's a great starting point for anyone looking to integrate web data into their Python projects without getting into the complexities of web scraping! Data science courses in Gurgaon

    ReplyDelete
  37. precise accurate and beautifully written, thanks for sharing
    Data science courses in Hyderabad </a

    ReplyDelete
  38. "Your blog is a go-to resource for any Spring developer."

    ReplyDelete
  39. This is a great tutorial for anyone looking to automate Google searches with Python! It's amazing how simple it is to integrate web scraping or data retrieval directly into your project with just a few lines of code. Data science courses in Visakhapatnam

    ReplyDelete
  40. Using Python to perform a Google search is a great way to automate data collection from the web. By utilizing libraries like `googlesearch-python`, you can quickly retrieve search results and use them for various data analysis or scraping tasks.

    Data science courses in Pune

    ReplyDelete
  41. This Python script is a great way to automate Google searches and quickly open the top search results in your browser. It’s simple and efficient for anyone looking to integrate web data into their projects without dealing with complex web scraping techniques. Just a few lines of code and you're all set to perform searches programmatically!
    Data science courses in Gujarat

    ReplyDelete
  42. Learn how to perform Google searches programmatically using Python with the googlesearch-python package, enabling users to automate search tasks. Read more
    Data science courses in the Netherlands

    ReplyDelete
  43. This guide on using Python for Google search is awesome! It’s a great way to automate searches and work with the Google API. Thanks for breaking it down in such a clear and easy-to-follow way!
    Data science Courses in Canada

    ReplyDelete
  44. Great writing and fantastic insights. This blog is a real treasure trove of valuable information.
    Data science Courses in London

    ReplyDelete
  45. Really cool tutorial on using Python to automate Google search! It’s great to see how easy it can be to integrate Google search results with Python. This method will definitely help many developers looking to enhance their projects with search functionalities. Your step-by-step explanation makes it easy for beginners to follow. Great work!
    Data science courses in Glasgow

    ReplyDelete
  46. Learn how to use Python for automating Google searches effectively with this tutorial.

    Data science courses in France

    ReplyDelete
  47. Performing a Google search with a Python script is efficient for automating information retrieval. Using libraries you can fetch and parse search results. Alternatively, tools offer straightforward methods for querying Google. Always respect ethical guidelines and Google's terms of service to avoid misuse or exceeding rate limits while conducting automated searches.
    Data science Courses in Berlin


    ReplyDelete
  48. Great post! The Python script you shared for automating Google searches is very helpful. It's amazing how Python can be used to streamline such tasks. I’ll definitely give this a try for my own projects. Keep up the good work!
    Top 10 Digital marketing course in pune

    ReplyDelete
  49. Your tutorial on using Python for Google search automation is very practical. Thanks for sharing such useful tips.
    digital marketing course in chennai fees

    ReplyDelete

Post a Comment