Google Search Using Python

How to Google Search using python


how to install Google package  

step 1 :-  google package को install करने से पहले हमे beautifulsoup4 को install करने की जरूरत पड़ती है।

pip install beautifulsoup4

step 2 :- अब google package को इनस्टॉल करेंगे

pip install google

Required Function and its parameters

search(query, tld='com', lang='en', num=10, start=0, stop=None, pause=2)
  • query :- वह string जो हम search करना चाहते है।
  • tld (top level domain) :- tld का अर्थ है वह domain जिसमे हम अपना result खोजना चाहते है जैसे com , in आदि।
  • lang :- lang का अर्थ है वह language जिसमे हमे result चाहिए।
  • num :- जितने हम रिजल्ट चाहते है।

 


Python codes on how to do google search

from googlesearch import search

query = "google"

for i in search (query, tld="com",num=10, stop=10, pause=2):
    print(i)

# OUTPUT
https: // techcrunch.com / 2020 / 07 / 29 / googles - sundar - pichai - grilled - over - destroying - anonymity - on - the - internet /
https://www.ndtv.com/world-news/why-does-google-steal-content-from-honest-businesses-us-congressman-2271102
https://twitter.com/Google?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor



https://en.wikipedia.org/wiki/Google
https://www.instagram.com/google/?hl=en
https://twitter.com/google?lang=en
https://www.youtube.com/user/Google