Every call to WebImageSearch costs money (wolfram service credits), thus, I would like to page through results without having to redownload them.
Given the following search how would one retrieve items 6-10 (without repurchasing the first 5)?
WebImageSearch["desert plains", "Thumbnails", MaxItems -> 5]
Update
Response to @kuba's question in the comments:
Update 2
@b3m2a1's solution doesn't run for me:
vgBlock[fn_, HoldPattern[SetDelayed][lhs_, rhs_], expr_] := Module[
{$recurse},
Internal`InheritedBlock[{fn},
Unprotect[fn];
(lhs /; ! TrueQ[$recurse] := Block[{$recurse = True}, rhs]);
DownValues[fn] = SortBy[DownValues[fn], FreeQ[$recurse]];
expr
]
];
vgBlock~SetAttributes~HoldAllComplete;
Options[googleImageSearch2]=Join[Options[WebImageSearch], {"StartingFrom" -> 1}];
googleImageSearch2[params:Except[_?OptionQ].., ops:OptionsPattern[]] :=
vgBlock[GCSFormatRequestParameters, GCSFormatRequestParameters[e___] := GCSFormatRequestParameters[e] /. ("start" -> "1") -> ("start" -> ToString[OptionValue["StartingFrom"]]),
WebImageSearch[params, Sequence @@ FilterRules[{Method -> "Google", ops}, Options @ WebImageSearch]
]
]
When I run googleImageSearch2["sweet dee", "MaxItems" -> 4], the progress bar starts working but then fails and the symbols turn red:
Ah ok, WebImageSearch stopped working because I ran out of service credits:
Probably should have warned me!






$CloudCreditsAvailablechanging? I can't reproduce it. And can you confirm that those results are not cached, e.g. when you call MaxItems->10 next time, does it take doubled amount or? – Kuba May 11 '18 at 13:31$ServiceCreditsAvailablePut[WebImageSearch["desert plains", "Thumbnails", MaxItems -> 5], LocalObject["myimages"]]$ServiceCreditsAvailableThenGet[LocalObject["myimages"]]$ServiceCreditsAvailablecredits remain the same as previous call. – Hans May 15 '18 at 02:46Except[q]. But the documentation is of no help there the only metadata I could see of use isByteCount. SoMap[ByteCount[#] &, a]whereais the result fromGet[...]But I found no good examples. – Hans May 15 '18 at 03:27WebSearch`Private`GCSPaginationCallsand it looks like it's terribly designed. The result count is hard coded. The start point can't be set via parameter. Etc. – b3m2a1 May 18 '18 at 07:06