Google google-custom-search how to search more:social - google-custom-search

I'm using google-custom-search and trying to run more:social kind of search.
it is possible from the javascript, for example: &q="bill clinton" more:socail& .
Is there something similar in the api?
Thanks

more: tokens should work in the 'q' parameter of the API the same way they work as from the Search Element

Related

How to use exactTerms and excludeTerms with Google Custom Search JSON API

I've been working with Google Custom Search API and faced some inconveniences I hope you can help me with.
Google Custom Search API offers as a parameter in its call the possibility to search by an exact text as well as exclude it from results: exactTerms and excludeTerms. However, the q parameter is mandatory and cannot be ignored, so if I want to search only by an specific text I just can't.
So how can I do a query using JSON API that contains specifically the text I want? Does the q parameter work as the search form in Google?
If I want results including 'foo', should I do this:
service.cse().list(cx=const.SEARCH_ENGINE_KEY, q='"foo"').execute()
or this?:
service.cse().list(cx=const.SEARCH_ENGINE_KEY, q=None, exactTerms='foo').execute()
Thank you in advance for your time.
Due to the success on the answers (hehe) I'm posting my own conclusions. Please, if you've any facts regarding the original question, please post it.
I've been testing with some calls to Google CSE API and looks like you can pass to q parameter the same query you'd do in Google's main page textfield. So (at least for my needs), you don't need exactTerms and excludeTerms to get what I was trying to achieve.
Anyway, as I said before, if you know how to work with these parameters I'm sure everybody will thank you.

How to access Google Search "I'm Feeling Lucky" functionality using API?

I'm creating a sample app that will take a query from user and will return the URL result returned from Google's "I'm Feeling Lucky" search. Does Google expose this functionality through their API? How to access this?
It seems that Google change their I'm feeling lucky url.
A workaround is to use https://duckduckgo.com/?q=!ducky+github+foo+bar+foobar
https://duckduckgo.com/?q=!ducky+YOUR_URL_ENCODED_QUERY
There is nothing magic about Google's "I'm Feeling Lucky" functionality. It simply picks the first result of the search. So, however you're using the api, you can just select the first result as well.
Furthermore, you can use this format for a URL in order to hit the "I'm Feeling Lucky" result of Google:
http://www.google.com/search?q=my+keywords+for+search&btnI
Deprecated You could use the Google API which is probably the best way to do it but will require more work
api docs here https://developers.google.com/web-search/docs/
No longer working or you can go to this url with your seach query:
http://www.google.com/webhp#q=your+search+query+here&btnI
be sure you add &btnI to the end otherwise it wont redirect
Update 2014
The above URL stopped working and yes the search API is depreciated, however there are always workaround. If you really have to you can still use a simple get request on the following URL:
https://www.google.com/search?q=your+search+query+here&btnI=
with of course your+search+query+here replaced with a URL encoded string.

Google Custom Search Query Parameters and Category Parameters

So I'm trying to set the query parameters and category parameters for google custom search. Here is an example search results page url:
http://www.whiterootmedia.com/search_results/index.html?q=my%20search%20phrase
So it looks like the default query parameter is q so I put q in the box when setting up the analytics portion for my google custom search engine. Is this ok? I read it wasn't ok to use q but to instead use query? And why does it matter?
Also should I set a category parameter that looks to be optional.
Thanks,
Dusty
The Google Search API just uses q. AFAIK the API doesn't have a query parameter. Check out the custom search API documentation.
Not sure what you mean by the 'category' parameter. Haven't come across that one before.
HTML:
<gcse:search gname='google1'></gcse:search>
Javascript:
window.google.search.cse.element.getElement("google1").execute("hello world");
But you need to wait for the Google script to load before launching the javascript.
If you use searchresults-only instead of search, you also need to enable the correct layout in the CSE Control Pannel: https://www.google.com/cse/
You can hit the following: https://cse.google.com/cse?as_q=your_query_string%20must_be_urlencoded&client=google-csbe&cx=full_cse_id_goes_here:including_the_bit_after_the_colon
So a direct answer to your question - the query parameter key is 'as_q'.

Twitter Queries

I'm trying to write a URL for Twitter's Search API.
The page says you can search for love or hate:
https://dev.twitter.com/docs/using-search
love OR hate containing either "love" or "hate" (or both)
But I'm not seeing a way to do this.
It should be fairly simple:
http://search.twitter.com/search.json?q=%40twitterapi
is an example of a URL that searches for twitterapi. But how would I search for two terms? What's the operand for OR in this context?
Nevermind, it appears that %20OR%20 works in this context.

Customize Google Custom Search

Does anyone know how to span the search result set over all of the links provided in google custom search . For Example, if I have provided sites like site 1,site 2....site n to search from ,then I want say top five results from all of these individual websites as JSON. Is there a way to achieve this.
I know this may be a little late but might be able to help someone out .
This will return 2 results via the REST API for GCSE.
https://www.googleapis.com/customsearch/v1?key=YOUR-KEY_HERE&cx=CX_HERE&fields=kind,items&filter=1&num=2&prettyPrint=true&q=querystring
its the num=2 part your looking for...