Package: nagooglesearch
Not Another Google SearchNot another Google searching library. Just kidding, it is.Tested on Kali Linux v2023.4 (64-bit).Made for educational purposes. I hope it will help!How to Installpip3installnagooglesearch

pip3install--upgradenagooglesearchHow to Build and Install ManuallyRun the following commands:gitclonehttps://github.com/ivan-sincek/nagooglesearch&&cdnagooglesearch

python3-mpipinstall--upgradebuild

python3-mbuild

python3-mpipinstalldist/nagooglesearch-6.9-py3-none-any.whlUsageDefault values:nagooglesearch.SearchClient(tld="com",parameters={},homepage_parameters={"btnK":"Google+Search","source":"hp"},max_results=100,user_agent="",proxy="",min_sleep=8,max_sleep=18,verbose=False)Only domains withoutgooglekeyword are accepted as valid results. Final output is a unique and sorted list of URLs.fromnagooglesearchimportnagooglesearch# non-string, empty, and duplicate query string parameters will be ignored# case-sensitive# search the internet for more query string parametersparameters={"q":"site:*.example.com intext:password",# search query, required"tbs":"li:1",# specify 'li:1' for verbatim search, i.e. do not search alternate spellings, etc."hl":"en","lr":"lang_en","cr":"countryUS","filter":"0",# specify '0' to display hidden results"safe":"images",# specify 'images' to turn off safe search, or specify 'active' to turn on safe search"num":"80"# number of results per page}# this query string parameters will be set only if 'start' query string parameter is not set or is zero# mimic homepage search as the first requesthomepage_parameters={"btnK":"Google+Search","source":"hp"}client=nagooglesearch.SearchClient(tld="com",# top level domain, e.g. www.google.com or www.google.hrparameters=parameters,homepage_parameters=homepage_parameters,max_results=200,# maximum unique urls to returnuser_agent="curl/3.30.1",# assign random if not set or is emptyproxy="socks5://127.0.0.1:9050",# ignore if URL scheme is not 'http[s], 'socks4[h]', or 'socks5[h]'min_sleep=15,# minimum sleep between page requestsmax_sleep=30,# maximum sleep between page requestsverbose=False# debug output)urls=client.search()rate_limit=client.get_rate_limit()ifrate_limitinurls:urls.pop(urls.index(rate_limit))print("[ HTTP 429 Too Many Requests ]")# do somethingexception=client.get_exception()ifexceptioninurls:urls.pop(urls.index(exception))print("[ Requests Exception ]")# do somethingforurlinurls:print(url)# do somethingIfmax_resultsis set to e.g.200andnumis set to e.g.80, then, maximum unique urls to return could actually reach240.Check the user agents listhere. For more user agents, checkscrapeops.io.Proxy URL scheme must be eitherhttp[s],socks4[h], orsocks5[h]; otherwise, proxy will be ignored.Shortest possible:fromnagooglesearchimportnagooglesearchurls=nagooglesearch.SearchClient(parameters={"q":"site:*.example.com intext:password"}).search()# do somethingTime sensitive search (e.g. do not show results older than 6 months):fromnagooglesearchimportnagooglesearchimportdateutil.relativedeltaasrelativedeltadefget_tbs(months):today=datetime.datetime.today()returnnagooglesearch.get_tbs(today,today-relativedelta.relativedelta(months=months))parameters={"tbs":get_tbs(6)}# do somethingGet a random user agent:fromnagooglesearchimportnagooglesearchuser_agent=nagooglesearch.get_random_user_agent()print(user_agent)# do somethingGet the user agents list:fromnagooglesearchimportnagooglesearchuser_agents=nagooglesearch.get_all_user_agents()print(user_agents)# do something