Twitter Queries - api

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.

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 API curl trouble

I'm a newbie at stackoverflow so please be patient with me :)
I'm trying to get access with the Google Custom Search API.
But I get return that I can't understand.
My query is like this:
https://www.googleapis.com/customsearch/v1?&key=********&q=red%2Bsox&cx=**********&start=0&num=10&cr=countryCA&lr=lang_fr&client=google-csbe&output=xml_no_dtd
And the result I get is this?
string '{"error": {"errors": [{"domain": "global","reason": "invalid","message": "Invalid Value"}],"code": 400,"message": "Invalid Value"}}' (length=172)
What am I doing wrong?
I want the result from Google to appear.
Thanks in advance :)
You don't have a cx.
Take a look at this answer
What happens is because this api is used mostly for adding a search option
for your site you have to specify you custom search engine (e.g. search only your site).
When you want this to search the web by code you need to do the above. Add a fake
site (where you would add your search textbox), configure it (search the web, or your site, or whatever else) and then delete the fake site
Update
Oh god, i just saw that. Sorry. Well the problem is that you start with 0. Valid is 1. Change start=0 with start=1 and i think you would be good to go. Take a look at this for valid values for the start parameter official page

how to correct spelling mistakes in Google custom API

I am using Google's custom search API, I make an HTTP request to a URL that looks like this:
https://www.googleapis.com/customsearch/v1?key=<my-key>&cref=&num=10&q=how+can+i+do+htis
if you search for "how can i do htis" on Google you are told "Showing results for how can i do this", and give you some results (call them result set A)
but if you use the API to search for the misspelled string, you get different results than those of A... Searching with a correctly spelled string gives you result A, which matches the ordinary search service on Google
Is there a way to search directly using the suggested string? I want to use the API I can't afford implementing a spell checker myself that can also correct people names and everything
I think what you want to do is possible using the spelling suggestions of Google. This is part of the xml-results returned by your query.
See API here.

Apple Appstore name search via the API?

Is it possible to do a search for apps by title via the API? For example, the equivalent of "Return a list of apps (if any) with the word 'dog' in the title".
I've seen two access points that come close, but don't seem to offer this:
The RSS feed; it lists apps, but apparently only groupings like, "top 100..."
The query interface; but it doesn't seem to query over the app media type. (?)
I found the answer. Although not explicitly documented, it's possible to search by app name.
http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
You're right, it wasn't very clear on that iTunes page at all. The parameter entity=software is the key. For example, here's a search for my app, TypeLink:
http://itunes.apple.com/search?entity=software&term=typelink&callback=myCallbackFunction
If you're wondering what the callback is for, here's some more info on the JSONP format it uses:
http://en.wikipedia.org/wiki/JSONP
For any future person who wants to link to the App Store keyword search result page directly from a web link - this format works as of April 2013:
http://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?media=software&submit=media&term=KEYWORD%20GOES%20HERE
Was a PITA to figure out but finally got the syntax right... Needed this because a client has apps made by multiple developers so I couldn't just use the suggested Appstore.com/DeveloperName link to return all their apps.
Thanks all for sharing wisdom. Hope this helps someone.