Yh, google-search-api has been deprecated, hence the pygoogle which was a wrapper for the Google search api. At the top of the search api page, there's a warning, along with:
We encourage you to investigate the Custom Search API, which may
provide an alternative solution.
But using this custom search api to search the whole web isn't pretty straightforward. Here I found 2 detailed guides (SO answers):
- Programmatically searching google in Python using custom search
- 1st step: get Google API key.
- 2nd step: setup Custom Search Engine so that you can search the entire web.
- 3rd step: install Google API client for Python.
- 4th step (bonus): do the search.
So, after setting this up, you can follow the code samples from few
places:
- What are the alternatives now that the Google web search API has been deprecated?
Yes, Google Custom Search has now replaced the old Search API, but you
can still use Google Custom Search to search the entire web, although
the steps are not obvious from the Custom Search setup.
To create a Google Custom Search engine that searches the entire web:
- From the Google Custom Search homepage ( http://www.google.com/cse/
), click Create a Custom Search Engine.
- Type a name and description for your search engine.
- Under Define your search engine, in the Sites to Search box, enter at least one valid URL (For now, just put www.anyurl.com to get past
this screen. More on this later ).
- Select the CSE edition you want and accept the Terms of Service, then click Next. Select the layout option you want, and then click
Next.
- Click any of the links under the Next steps section to navigate to your Control panel.
- In the left-hand menu, under Control Panel, click Basics.
- In the Search Preferences section, select Search the entire web but emphasize included sites.
- Click Save Changes.
- In the left-hand menu, under Control Panel, click Sites.
- Delete the site you entered during the initial setup process.
Google Custom Search is not free all the way i.e. Pricing:
- Custom Search Engine (free) For CSE users, the API provides 100 search queries per day for free. If you need more, you may sign up for
billing in the API Console. Additional requests cost $5 per 1000
queries, up to 10k queries per day.
- Google Site Search (paid). For detailed information on GSS usage limits and quotas, please check GSS pricing options.