I really don't like functions that I have to pay for, if they can be implemented for free.
Is there a way to get around this pay-wall for WebImageSearch? Perhaps using some other free api or service?
Update:
One idea I had was to use the french search engine Qwant which has an api which is free and unlimited for now: https://api.qwant.com/api/search/images?count=10&offset=1&q=cars (but has less accuracy than Google or Bing).
Answer
So after being wrong about Bing being free, we'll pursue my other suggestion, which was to use the ServiceConnect framework. I demonstrate how to use it in general here.
For the purposes of this, though, here's what all you need to do. Get the paclet by running this:
(*
If you've already installed, replace this with PacletUpdate
to get the newest version
*)
PacletInstall[
"ServiceConnection_Qwant",
"Site" ->
"https://www.wolframcloud.com/objects/b3m2a1.paclets/PacletServer"
]
Service connect like so:
$so = ServiceConnect["Qwant"]
And run it like so:
$so["ImageSearch", "q" -> "car", "count" -> "3"]
I also provide access to the basic web search endpoint:
$so["WebSearch", "q" -> "pizza"]
Inspecting the ServiceObject
In all my service connections I include a way to access what parameters I've fed in. The request that implements this is called "RequestParameters"
, named similarly to the "Requests"
request that all ServiceObject
s have by default. You use it like so:
$so["RequestParameters", "Request" -> "WebSearch"]
<|"Parameters" -> {"q", "count", "offset", "page"}, "Required" -> {}|>
(Note before v1.0.2 of this paclet this will return an empty list, as "WebSearch"
really delegates to the standard "Search"
method. Use PacletUpdate
to get the newest version if you don't have it.)
Comments
Post a Comment