twitter hashtag search - twitter

I am trying to search all tweets with a given hashtag (Using titanium appcelerator).
I have a working code to search all tweets from a given user (for example #prayforjapan).
Now I'm trying to get all the tweets from #prayforjapan. This isn't working..
I tried the following method (since i found it on here
Now to search for the names i use this url:
var xhr = Ti.Network.createHTTPClient();
xhr.timeout = 1000000;
xhr.open("GET","http://api.twitter.com/1/statuses/user_timeline.json?screen_name="+screen_name);
For the Hashsearch i tried the following code (doesn't work tho)
var xhr = Ti.Network.createHTTPClient();
xhr.timeout = 1000000;
xhr.open("GET","http://search.twitter.com/search.json?q=prayforjapan");
Does anyone know what's wrong with this search? or which link it should be?
Thanks!

Well, I played with it for a little bit and came up with this link format.
http://search.twitter.com/search?q=%23prayforjapan
How does that work?

%23prayforjapan is same as #prayforjapan

Sorry, Twitter does not supply this, neither with Rest or Streaming APIs. They only provide partial results unless you pay for the "garden hose" or "firehose," both of which are very costly. Garden hose starts at about $6,000/month, currently.

Related

How to get result from youtube api search morethan 5?

I tried to get youtube search from this link
https://www.googleapis.com/youtube/v3/search?part=snippet&key={my_api_key}&q=plane
it's work good. But i want to know how can i get result morethan 5 ?
ref : https://developers.google.com/youtube/v3/docs/search/list
Just in case anyone needs a solution for this.
You just need to add &maxResults=50 (to get a maximum of 50 results of course) at the end of the link / API call.
The person who asked the question was using &max-results... and not &maxResults... which is why it did not work.
The only thing you need to set here is maxResults. Now, if you're still getting 5, the problem maybe that there's really no other videos to list or your search filter is wrong.
The nextPageToken solution do not apply if you have maxResult set to 50 but are only getting 5. The problem could be your filter or the number of videos available.

Google youtube API, how do i search for specific keyword?

I want to search for keyword related youtube videos, I'm using youtube getdata API.
Reading documentation I came up with this:
http://gdata.youtube.com/feeds/api/videos/-/". urlencode($kwd) ."?orderby=viewCount&max-results=". $max ."&alt=json
But this is not a real search, it gives urls taged with keyword... Youtubes internal search works quite differently I imagine, because comparing results don't match at all.
Any ideas?
The URL you offer does a search for any videos in a category where the category includes your keyword. What you want to do instead is to send a query string:
"https://gdata.youtube.com/feeds/api/videos?q=". urlencode($kwd) ."&orderby=viewCount&max-results=". $max ."&alt=json"
This way the feed will match right on the videos rather than the categories.
In the newer v3 of the API, your call would look like:
"https://www.googleapis.com/youtube/v3/search?part=snippet&q=".urlencode($kwd)."&maxResults=".$max."&order=viewCount&key={YOUR_API_KEY}"
Use Data API v3, search->list method.
GET https://www.googleapis.com/youtube/v3/search?part=snippet&q=term&key={YOUR_API_KEY}
In my opinion, I would use the "q" parameter, for example to search for "dog"
var request = gapi.client.youtube.search.list({
part: 'snippet',
q: "dog"
});
But I'm just a noob the others guys answers are probably better.

Youtube API feedapplying filter

I am using following rss feed to get videos from youtube. works fine.
http://gdata.youtube.com/feeds/api/users/zeetv/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile;
now i like to apply certain filter... for example: listing videos which has "Episode" in title.
http://gdata.youtube.com/feeds/api/users/zeetv/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile&q=Episode;
But it doesnot filter out the videos,which matches "episode", instead it list all.
i had checked this link https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters
and applied query string.
anyhelp is much appreciated. Thanks
It seems like you can't query a users videos, like that.
You have to build your query like this: http://gdata.youtube.com/feeds/api/users/zeetv/uploads?q=Episode&fields=entry(title)
you can read more about the fields syntax here: https://developers.google.com/youtube/2.0/developers_guide_protocol_partial#Fields_Formatting_Rules
The link provided in the question now has the answer. You should perform a search for the term you want and filter by author:
https://gdata.youtube.com/feeds/api/videos?q=episode&author=zeetv

Twitter: Number of tweets OR get more tweets

I would like to know how can I get all tweets from a certain hash tag?
I am currently using the following code:
xhr.open("GET","http://search.twitter.com/search.json?q=%23PrayForJapan");
This only returns me 15 tweets. Does anyone know how to make it return more?
Also, I have got a code to get me the tweets of a certain screen name, this only returns 20 tweets, how can i ask the following 20 tweets?
The code i used for that is:
xhr.open("GET","http://api.twitter.com/1/statuses/user_timeline.json?screen_name=Eminem");
I'm using titanium to create this, but I don't think that is an issue?
Thanks!
You can usually add count=x as parameter to the query string to get up to x tweets (for the search api it seems to be rpp). Query string parameters are added to the base url via ? and each individual parameter is then separated by & as in http://api?user=1&count=4
Most of the time, it is better though to remember the last tweets and then add ?since_id=x as this way you only get tweets you did not see before.
Have a look at the api documentation.

Twitter API - Display all tweets with a certain hashtag?

How would I go about displaying tweets that contain a certain hashtag using the Twitter API? Thanks
I'd also like to know if there is a way to get all tweets from a certain hashtag in a separate file, also the ones that don't show up in your feed anymore. I suppose that's what the earlier question was about, too.
This answer was written in 2010. The API it uses has since been retired. It is kept for historical interest only.
Search for it.
Make sure include_entities is set to true to get hashtag results. See Tweet Entities
Returns 5 mixed results with Twitter.com user IDs plus entities for the term "blue angels":
GET http://search.twitter.com/search.json?q=blue%20angels&rpp=5&include_entities=true&with_twitter_user_id=true&result_type=mixed
UPDATE for v1.1:
Rather than giving q="search_string" give it q="hashtag" in URL encoded form to return results with HASHTAG ONLY. So your query would become:
GET https://api.twitter.com/1.1/search/tweets.json?q=%23freebandnames
%23 is URL encoded form of #. Try the link out in your browser and it should work.
You can optimize the query by adding since_id and max_id parameters detailed here. Hope this helps !
Note: Search API is now a OAUTH authenticated call, so please include your access_tokens to the above call
Updated
Twitter Search doc link:
https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html
The answer here worked better for me as it isolates the search on the hashtag, not just returning results that contain the search string. In the answer above you would still need to parse the JSON response to see if the entities.hashtags array is not empty.

Resources