Search code examples
google-searchgoogle-search-api

Refine Google search engine result


I want to create an app that promotes a query to google search by specific filters and restrictions i put in place and then show the results to the user (specific keywords in results for the past x days). How can this be done?

Can this be accomplished by using the Google site search https://www.google.com/work/search/products/gss.html together with this API: https://developers.google.com/custom-search/json-api/v1/introduction#background-data-model

Has anyone tried something similar?


Solution

  • Yes. it's possible with restrictions. You can use only GoogleCustomSearch (your links above)

    1. [key param] go to Developer console and turn on "Custom Search API" - https://console.developers.google.com and create API_KEY ("Server" type)
    2. [cx param] go to CustomSearch console https://cse.google.com/cse and create Custom search engine ("cx" param)

    Using Get template create an request (https://developers.google.com/custom-search/json-api/v1/using_rest)

    GET https://www.googleapis.com/customsearch/v1?key= YOUR_KEY&cx=YOUR_CX&q=site:lenta.ru&siteSearch=lenta.ru