10
$\begingroup$

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?

enter image description here

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).

enter image description here

$\endgroup$
  • 1
    $\begingroup$ google images and bing images are both free... $\endgroup$ – bill s Oct 18 '17 at 21:17
  • $\begingroup$ or you can be the first one to implement and upload here :) $\endgroup$ – ercegovac Oct 18 '17 at 21:21
  • $\begingroup$ @M.R. I formalized the Qwant API into a service connection. See if it works for you. $\endgroup$ – b3m2a1 Oct 19 '17 at 6:56
  • $\begingroup$ @b3m2a1 Nice work, how can I see what options there are, e.g. is offset supported? $so["ImageLinks", "q" -> "native american", "count" -> "10", "page" -> 2] $\endgroup$ – M.R. Oct 19 '17 at 20:50
  • $\begingroup$ @M.R. I included everything I could quickly see. Doesn’t seem as if they API is documented. I’ll put in a note about how to extract those request parameters. I try to make sure they’re exposed in all of my connections. $\endgroup$ – b3m2a1 Oct 19 '17 at 22:40
12
$\begingroup$

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"]

qwant

And run it like so:

$so["ImageSearch", "q" -> "car", "count" -> "3"]

result example

I also provide access to the basic web search endpoint:

$so["WebSearch", "q" -> "pizza"]

web search results


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 ServiceObjects 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.)

$\endgroup$
  • $\begingroup$ That's not true, see my update $\endgroup$ – M.R. Oct 19 '17 at 5:48
  • $\begingroup$ @M.R. oh fascinating my IntegratedServices`ServiceCreditsAvailable is non-zero. Odd. I'll elaborate on the second, then. $\endgroup$ – b3m2a1 Oct 19 '17 at 5:54
  • $\begingroup$ Have you ever looked at implementing searching by image? For example, find where a certain image appears on the web? $\endgroup$ – Szabolcs Oct 19 '17 at 7:56
  • $\begingroup$ @Szabolcs I could try it, but I’m not sure it would go well. There’re no free APIs to work off of so I’d need to think hard about how to do it without it being unbearably slow. I think even this ImageSearch is too slow. I should really be using some async import for the thumbnails. Something like trying to get a guess for the image with ImageIdentify then using iterated searches for similar images would be brutally slow and prone to error. $\endgroup$ – b3m2a1 Oct 19 '17 at 14:57
  • $\begingroup$ There is a glitch: current version still pops-up the "Sign in with your wolfram ID" dialog (although it works after closing the dialog without signing in). $\endgroup$ – Alexey Popkov Oct 19 '17 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.