Availability note: The Custom Search JSON API is closed to new customers. These API steps apply only to existing customers, who must transition to an alternative by January 1, 2027. See Google’s current API availability and migration guidance before following this guide.
Install Google API Client Library for Python
For more info and documentation:
https://developers.google.com/api-client-library/python/apis/
Installation:
pip install -U google-api-python-client
Create your Google Account
https://accounts.google.com/SignUp?hl=en
Login Google APIs
https://console.developers.google.com/
Create new project
--> Credentials --> Create new project
Create Credentials, Choose API Key Example:
API key = 'YOUR_API_KEY'
Go to Library, choose Custom Search API, click "ENABLE"
Create Programmable Search Engine
https://cse.google.com/cse/create/new
Create New Search Engine, enter sites you want to search Example:
*.huffingtonpost.com
Get Search engine ID
--> Edit search engine --> Select --> Search engine ID