14
$\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$
8
  • 1
    $\begingroup$ google images and bing images are both free... $\endgroup$
    – bill s
    Oct 18, 2017 at 21:17
  • $\begingroup$ or you can be the first one to implement and upload here :) $\endgroup$
    – ercegovac
    Oct 18, 2017 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, 2017 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, 2017 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, 2017 at 22:40

1 Answer 1

14
$\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.)

Update:

I no longer can install this:

enter image description here

$\endgroup$
10
  • $\begingroup$ That's not true, see my update $\endgroup$
    – M.R.
    Oct 19, 2017 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, 2017 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, 2017 at 7:56
  • 2
    $\begingroup$ @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 $\endgroup$
    – b3m2a1
    Nov 17, 2021 at 4:11
  • 1
    $\begingroup$ Sorry to hear that! Perhaps you could update it and submit to this new thing: wolframcloud.com/obj/resourcesystem/published/PacletRepository/… $\endgroup$
    – M.R.
    Nov 17, 2021 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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