Challenge at freeCodeCamp
https://www.freecodecamp.org/challenges/image-search-abstraction-layer
https://aback-clave.glitch.me/
- I can get the image URLs, alt text and page urls for a set of images relating to a given search string.
- I can paginate through the responses by adding a ?offset=2 parameter to the URL
- I can get a list of the most recently submitted search strings.
Reference here https://github.com/google/google-api-nodejs-client
- Go to https://console.cloud.google.com/
- Create new project
- Create new Credential Key and get API Key
- Copy API Key to file
.env
, such as:
GG_API_KEY=[api key here]
- Go to https://cse.google.com/cse/all
- Create new Search Engine (sites to search, maybe if you need)
- After create, go to edit the engine
- Image Search, check ON (to get thumbnail)
- Sites to Search (check out Search the entire web but emphasize included sites)
- Update
- Test with your custom search in the website
- Get code cx
- Copy to file
.env
GG_CX=[cx here]
Follow document/example at https://github.com/google/google-api-nodejs-client/tree/master/samples/customsearch