Perform search

Tags: #googlesearch #snippet #operations #url
Author: Jeremy Ravenel
Description: This notebook allows users to perform Google searches quickly and easily.


Import library

from googlesearch import search
!pip install google
from googlesearch import search


query = "telsa"


Parameters :
  • query: This is the text that you want to search for.
  • tld: This refers to the top level domain value like or com which will specify which Google website we want to use.
  • lang: This parameter stands for language.
  • num: This is used to specify the number of results we want.
  • start: This is to specify from where to start the results. We should keep it 0 to begin from the very start.
  • stop: The last result to retrieve. Use None to keep searching forever.
  • pause: This parameter is used to specify the number of seconds to pause between consecutive HTTP requests because if we hit too many requests, Google can block our IP address.
The above function will return a python generator (iterator) which has the search result URLs.
Source :


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