Search code examples
javascriptwebgoogle-search

Is there a way to find google search results for a certain keyword with javascript?


I am looking for a way to find search results from google with javascript.


Solution

  • Yes, you can use Google's api to fetch search result from Google.

    But for that you have to get a API key from Google and then you can use google's api to fetch result.

    Please check this official link to know example and more.

    Here is an example http get request

    https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures
    

    you can simply request these http get request from your javascript using ajax. In the above example you can replace the word lectures with the key word that you want to search.

    You can find complete reference of using Javascript to request google's api here.