All rights are reserved by Niteesh Kumar.. Theme images by Storman. Powered by Blogger.

Followers

Total Pageviews

Blog Archive

Follow by Email

Translate

Tuesday, 3 July 2018

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.



32 on: "Perform Google search with python script"
  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. 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
  5. 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
  6. you should upgrade your range of abilities in huge information in a propelled manner. ExcelR Data Science Courses

    ReplyDelete
  7. 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
  8. Wow its a very good post. The information provided by you is really very good and helpful for me. Keep sharing good information.

    Best Training Institute in Bangalore BTM. My Class Training Bangalore training center for certified course, learning on Software Training Course by expert faculties, also provides job placement for fresher, experience job seekers.
    Software Training Institute in Bangalore

    ReplyDelete
  9. 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
  10. The article looks magnificent, but it would be beneficial if you can share more about the suchlike subjects in the future. Keep posting. 상품권 매입

    ReplyDelete
  11. I am looking for and I love to post a comment that "The content of your post is awesome" Great work!

    data science course

    ReplyDelete
  12. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
    Data Science Course

    ReplyDelete
  13. I have gain a lot of information's from your Articles and Looking For more Posts...Thanks for this Information's about Python
    python training in chennai | python training in annanagar | python training in omr | python training in porur | python training in tambaram | python training in velachery

    ReplyDelete
  14. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple linear regression

    ReplyDelete
  15. I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article.

    Simple Linear Regression

    Correlation vs Covariance

    ReplyDelete
  16. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple linear regression
    data science interview questions

    ReplyDelete
  17. 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
  18. 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
  19. Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple Linear Regression
    data science interview questions
    KNN Algorithm
    Logistic Regression explained

    ReplyDelete
  20. Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data sciecne course in hyderabad

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

    ReplyDelete