Google Custom Search JSON API -
i'm playing google custom search api custom search engine (cse) via json api. obtained search result, i'm clueless how obtain nextpagetoken
.
https://www.googleapis.com/customsearch/v1?key=my_api_key&cx=my_search_engine_id&q=testing
the json response follow:
{ "kind": "customsearch#search", "url": { "type": "application/json", "template": "https://www.googleapis.com/customsearch/v1?q={searchterms}&num={count?}&start={startindex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googlehost?}&c2coff={disablecntwtranslation?}&hq={hq?}&hl={hl?}&sitesearch={sitesearch?}&sitesearchfilter={sitesearchfilter?}&exactterms={exactterms?}&excludeterms={excludeterms?}&linksite={linksite?}&orterms={orterms?}&relatedsite={relatedsite?}&daterestrict={daterestrict?}&lowrange={lowrange?}&highrange={highrange?}&searchtype={searchtype}&filetype={filetype?}&rights={rights?}&imgsize={imgsize?}&imgtype={imgtype?}&imgcolortype={imgcolortype?}&imgdominantcolor={imgdominantcolor?}&alt=json" }, "queries": { "nextpage": [ { "title": "google custom search - testing", "totalresults": "2900", "searchterms": "testing", "count": 10, "startindex": 11, "inputencoding": "utf8", "outputencoding": "utf8", "safe": "off", "cx": "my_search_engine_id" } ], "request": [ { "title": "google custom search - testing", "totalresults": "2900", "searchterms": "testing", "count": 10, "startindex": 1, "inputencoding": "utf8", "outputencoding": "utf8", "safe": "off", "cx": "my_search_engine_id" } ] }, "context": { "title": "test search engine" }, "searchinformation": { "searchtime": 0.299265, "formattedsearchtime": "0.30", "totalresults": "2900", "formattedtotalresults": "2,900" }, "items": [ // ... search result here ] }
but how obtain result of next page via nextpagetoken
?
instead of using nextpagetoken
, there 2 parameters can add query string change page of results:
start
: start index of result, valid values integers > 0.num
: number of results per page, valid values 1 ~ 10 (max 10 records can obtained in 1 page)
therefore change page 2, have issue:
start=11&num=10
in query string (given record per page 10).
hope helps.
Comments
Post a Comment