I have Aouth working for Twitter, and pulling in a stream of tweets, I am trying to figure out how to then Favorite one of the Tweets coming in from the stream.
I understand twitter's API give me this:
Parameters:
* id. Optional. The ID or screen name of the user for whom to request a list of favorite statuses.
o Example: http://api.twitter.com/1/favorites/bob.json or http://api.twitter.com/1/favorites/bob.rss
* page. Optional. Specifies the page of favorites to retrieve.
o Example: http://api.twitter.com/1/favorites.xml?page=3
But that doesn't really help me in trying to implement, or I just am not sure how to approach it
Any help ?
POST favorites/create on twitter development site
Did you try this?
function Like(ScreenName, TweetID)
{
client.rest.post('favorites/create', { screen_name: ScreenName, id: TweetID});
}
Something like this in JavaScript.
Related
I'm using twitter API tweepy and I want to use api.list_timeline() function.
It says I must provide either a list ID or slug and owner.
How can I get these information?
The id of a twitter list can be found by looking at end end of the URL of the list on twitter web, for example in the url https://twitter.com/i/lists/1269293736644796416, 1269293736644796416 would be the id.
To implement it into your code you would simply write:
api.list_timeline(list_id=1269293736644796416)
I want to do something like this:
https://itunes.apple.com/lookup?collectionid=211192863&entity=song
But it doesn't return the songs
I'm pretty sure they have such parameter since it is a pretty basic one
any tips are appreciated
Edit:
it seems I can pass ID also, but I don't know if I can trust it once I usd id input for artist search as well
You are very close - the proper API request should be:
https://itunes.apple.com/lookup?id=211192863&entity=song
Note, the first result returned is the Collection meta data, each of the following 12 results are the track meta data.
Your url is wrong, for search API url you should see below:
https://itunes.apple.com/search?id=211192863&entity=song&media=music
enjoy!!!
The goal here is to be able to "tweet" a link of the format
www.example.com/page.aspx#1, and get the number of "tweets" for that link... Basically, what the out-of-the-box Twitter button does for any normal link.
Reason for this is because the page displays different content based on the ID after the #, so there is a need to count which specific item was "tweeted" and how many times.
I tried passing that URL to the Twitter service to get the count (http://urls.api.twitter.com/1/urls/count.json?url=), but the JSON object I get back only has
{"count":0,"url":"www.example.com/page.aspx/"}.
The link for the Twitter button looks like this (done in JavaScript)
var twtLink = 'http://twitter.com/intent/tweet?url='+encodeURIComponent(twtUrl)+'&counturl='+encodeURIComponent(twtUrl);
Any suggestions would be appreciated.
Thanks!
Twitter actually re-interrupts all URL's with their own custom t.co wrapper. This is good news for your use case. You can use these unique t.co links with the counter API.
If you include the attribute &include_entities=1 to the end of some Twitter REST API calls you get back expanded info including the URL's in the tweets. You will see the original URL as well as the shortened URL version. Pass the shortened URL version into the counter API.
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.
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.