Search specific websites (set dynamically) using Google CSE API

167 views Asked by At

Aside from the CSE control panel, is there anyway to specify a website to search as an API request parameter?

I've tried setting the parameter siteSearch=..., and including site:... inside the actual search query, but with these the search returned 0 results.

Otherwise, is there any way to edit the list of websites to search inside the CSE settings, programatically?

1

There are 1 answers

0
Pankaj Verma On

Yeah, you can use Google CSE Api (Customsearch.Cse.List) methods: setSiteSearch("siteToSearch") and setSiteSearchFilter("i").
Possible values for setSiteSearchFilter are "i"(include) and "e"(exclude).