14

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

b3m2a1
  • 46,870
  • 3
  • 92
  • 239
M.R.
  • 31,425
  • 8
  • 90
  • 281

1 Answers1

14

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

Update:

I no longer can install this:

enter image description here

M.R.
  • 31,425
  • 8
  • 90
  • 281
b3m2a1
  • 46,870
  • 3
  • 92
  • 239
  • That's not true, see my update – M.R. Oct 19 '17 at 05:48
  • @M.R. oh fascinating my IntegratedServices`ServiceCreditsAvailable is non-zero. Odd. I'll elaborate on the second, then. – b3m2a1 Oct 19 '17 at 05:54
  • Have you ever looked at implementing searching by image? For example, find where a certain image appears on the web? – Szabolcs Oct 19 '17 at 07:56
  • @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. – b3m2a1 Oct 19 '17 at 14:57
  • 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). – Alexey Popkov Oct 19 '17 at 17:05
  • @AlexeyPopkov ah yeah I'm sure something in my framework is checking for your $WolframID at some point. I forget that not everyone has cloud accounts... (I currently have like 4 free ones; each for a different purpose). I'll fix it when I have time. – b3m2a1 Oct 19 '17 at 17:31
  • Can someone just update the code for this answer so it works? – M.R. Nov 17 '21 at 04:09
  • 2
    @M.R. I think WRI obliterated my packet server. The underlying packet mechanisms changed and I don’t really do Mathematica dev anymore. Maybe once the proper repo is out I’ll revisit my package framework and update my tools so they work again but as is I just don’t have the incentives – b3m2a1 Nov 17 '21 at 04:11
  • 1
    Sorry to hear that! Perhaps you could update it and submit to this new thing: https://www.wolframcloud.com/obj/resourcesystem/published/PacletRepository/index – M.R. Nov 17 '21 at 06:57
  • @M.R. I asked Bob S. for access but have yet to get it. When I get access I’ll see what I can do – b3m2a1 Nov 17 '21 at 07:20