Group Abstract Group Abstract

Message Boards Message Boards

Google Searches

Posted 11 years ago

In case anyone has had the chance to work with this before:

How to restrict my query to a specific data range?

e.g.

Import["https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=NASA", "JSON"]
POSTED BY: Sandu Ursu
15 Replies

I'm having trouble with this, despite getting an API browser type key from the Google Development platform, and a custom search ID. ServiceConnect["GoogleCustomSearch"] works as far as I can tell, returning a ServiceObject that is connected. But then when I do the following:

customsearch = ServiceConnect["GoogleCustomSearch"]

customsearch["Search", {"Query" -> "transactive memory", 
  "Site" -> "http://scholar.google.com", "MaxItems" -> 10}]

the second evaluation returns

ServiceObject[
 "GoogleCustomSearch", 
  "ID" -> "connection-03fd5d9f173245ebd05b0f1d96dde014"]["Search", \
{"Query" -> "transactive memory", 
  "Site" -> "http://scholar.google.com", "MaxItems" -> 10}]

No results are returned; my Mathematica 10.2 behaves as if I'm supplying the wrong arguments. The "ID" you see there is not the Custom Search ID I created through Google's Custom Search Engine page. I tried to put the ID in manually as an argument, and I get the same result (well, lack of result).

Any help would be appreciated.

POSTED BY: Abigail Nussey

Yeah, I've also noticed that. My guess is that it's because, when you Google something directly from your browser, Google is using your personal preferences (specially if you are logged into your Google account) and user metadata. However, if you do it via the API, the custom search engine you created is what's controlling the search.

If you don't want those Google+ results to appear when using GoogleCustomSearch from the Wolfram Language, you can do:

gcs = ServiceConnect["GoogleCustomSearch"]
gcs["Search",{"Query"-> "Your name","Site"-> Except["plus.google.com"]}]

Feel free to ask anything if you still have issues with this or other services. Note that for web search, BingSeach is also available

BTW - have you seen THIS?

results = ServiceExecute["GoogleCustomSearch", "Search", 
{"Query" -> "Orion spacecraft", "FileType" -> Except["png"], "MaxItems" -> 5, "SearchType" -> "Image"}]; 
results[All, {1, 2, 6, 7}]

enter image description here

POSTED BY: Sam Carrettie

Weird...It's working fine for me.

screenshot

Can you please share the output of:

SystemInformation["Small"]
PacletInformation["ServiceConnection_GoogleCustomSearch"]

Also, when using your Google credentials, do you get that box saying GoogleCustomSearch Connected? (Like the one in my screenshot after ServiceConnect)

. The "ID" you see there is not the Custom Search ID I created through Google's Custom Search Engine page. I tried to put the ID in manually as an argument, and I get the same result (well, lack of result).

The ID you see there is not the Google ID but the internal connection ID.

POSTED BY: Damanjit Singh
Posted 11 years ago

Thank you, Christian!

To my knowledge, dateRestrict allows one to request results from a specified number of past days/weeks/months.. I would be more interested in results within a date rage (of course you can run 2 requests and then take the complement, but life is too short to do this).

Another point, if I make a query with my name, I get a dozen of results from plus.google.com, which don't appear if I search that in Google.

POSTED BY: Sandu Ursu

GoogleCustomSearch was released with Mathematica 10.2 so you should be good to use it.

Posted 11 years ago
POSTED BY: Syd Geraghty
Posted 11 years ago

Thanks, but the manual doesn't really say how to get the credentials.

enter image description here

POSTED BY: Sandu Ursu
POSTED BY: Sander Huisman
Posted 11 years ago

10.3.0 for Microsoft Windows (64-bit) (October 9, 2015)

POSTED BY: Sandu Ursu

You need at least version 10 to have ServiceExecute, I can't find when they introduced the GoogleCustomSearch, it might be 10.0 it might be 10.3. Which version of Mathematica are you using?

POSTED BY: Sander Huisman
Posted 11 years ago

It looks nice, but I cannot replicate the result.

POSTED BY: Sandu Ursu
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard