Why twitter stream api sends unnecessary data? - twitter

As per twitter documentation
A comma-separated list of user IDs, indicating the users whose Tweets should be delivered on the stream. Following protected users is not supported. For each user specified, the stream will contain:
Tweets created by the user.
Tweets which are retweeted by the user.
Replies to any Tweet created by the user.
Retweets of any Tweet created by the user.
Manual replies, created without pressing a reply button (e.g. “#twitterapi I agree”).
Imagine I am following person X, he/she has millions of follower and whenever he/she tweets something a lot of followers retweet that, as per documentation streaming api will stream all that noise if I am following that id via twitter api. So my question is, is it just bad design or any specific for reason for that.

It's a design choice.
You're looking at a specific method of filtering Tweets (using the follow parameter). If what you want is just the Tweets posted by that user, you could use a different pattern like the from: operator.

Related

Getting the overall retweet_count of an account using Twitter API

Can we get the total Retweet_Count per an account OR per Screenname like followers count at user level as followers count is a property associated with user information, Where as Retweet_Count is a field associated with each individual Tweet.
I'm thinking I need to get all the tweets of a user then add the filed Retweet_Count in each & every tweet a user received. Here the problem is the total number of tweets getting using twitter rest api are limited to last 200 tweets (only 2 weeks old tweets in these 200).
We cannot find historical tweets with Streaming API, If we store all the real time tweets using streaming api in our local database then with the use of id of each tweet record in our local data base we need to call twitter rest api call(GET statuses/show/:id) in a loop, then add all the Retweet_Count value in this loop. But due to this the number of restapi calls are increasing to get the total Retweet_Count.
Please suggest me for the better approach.
No, that's not at all possible .
Since the retweet_count associates with each tweet, you need to get all the tweets first.
The reason why i said it's impossible is because if a user has more than 3200 tweets, then you can't get the exact retweet_count as twitter offers only 3200 most recent tweets of a user through GET statuses/user_timeline.
GET statuses/user_timeline method can only return up to 3,200 of a
user’s most recent Tweets. Native retweets of other statuses by the
user is included in this total, regardless of whether include_rts is
set to false when requesting this resource.
One more thing. Some Tweets retweent_count may vary time to time. I mean some may undo retweet & some may retweet old tweet or past week tweet. So, you need to retrieve all the tweets again and again to update-to-date with exact retweet_count. By doing this, there are more chances that you will fall in Twitter's Rate Limit.

Twitter API - Get id's of all users that interact with a tweet

Is there a way in the Twitter API v1.1 to get the id's of all the users that replied, favorited and retweeted to a particular tweet using its id?
I've searched in older posts but I didn't find an simple way to do it.
Thanks
According to Twitter Staff Episod,
It's not possible with the API after the fact for a tweet that has more than 100 retweets. You would need to collect them in real time as they happen to collect them all. The Streaming API is the best bet for tracking such things.
So, you can only get 100 Retweets ID of a tweet through REST API. Move to Streaming API to get all the Retweets ID but you can't get the past data. You can only get data in Streaming API from present - to - future.

Knowing if an account had tweeted

Background info:
My website has an account system and we wanted to give the accounts "reward points" everytime they tweeted / facebook share.
For facebook share, we are able to track which account had shared by using the redirect_uri and redirect them back to our site (with the specified url) and noting it. https://developers.facebook.com/docs/reference/dialogs/feed/
Is there such thing on twitter as well? I had been trying to find real hard but i can't find a way for me to inform my system that a certain account had tweeted.
Thanks!
One of the basic objects in the Twitter API is the User object, which gives you a decent amount of information about the user in question. Once of the properties of the User object is called "status", which is a Tweet object, which is the user's most recent tweet.
So, in your application, you could store the unique identifier and date/time of the user's last tweet. Then at an interval of your choosing, you could get the information about the user and see if the ID of their most recent tweet matches what you have in your database. If it does not match, then the user has posted a new tweet.
Twitter API documentation of the User object
Twitter API documenation of the Tweet object

Twitter API - Getting friends and follower ids for a set of users?

I am able to extract tweets, and the submitter's user details using the streaming API, but I also need the list of followers and friends of users posting these tweets.
I am aware that Twitter search API has the friends/ids and followers/ids functions through which one can get the public followers and friends list one user at a time.
But, my data collection requires getting this information for all the users whose tweets I have collected, around 20,000+ users. This is quite exhaustive given the high number of users, and the limitation of one user per call. Moreover, I need to refresh this list for each of these 20,000+ users preferably once a day to observe changes in their friends and followers (if any).
IS there any I can achieve this using the Twitter Streaming API or any other method. Or I have to apply for the Twitter commercial data license?
Thanks!!!
20,000 is way beyond the limits of any normal Twitter API method. I think your going to have to apply for a commercial license to go that high. The streaming API, I believe, tracks 400 keywords and 5000 users max. Your right in that the REST twitter API method only allows you to track one user or a list of ID's. You can take a look at the Twitter Counter API which mines additional info including information about followers, etc. But again, 20,000 I'm sure would be above the limits. Communicate with Twitter, Gnip and, and the Twitter Counter service to see what they can do for you.
Twitter Counter API:
http://twittercounter.com/pages/api?ref=footer

get Twitter friends/followers' ids and nicknames

I am integrating Twitter into my mobile app. I am trying to get the friends or follower's ids and nicknames. One solution that I can find out is, using "friends/ids" to get the friends/followers ids, then "user/show" to get the user info.
However, "user/show" returns extended information of the user, if a user has a lot of friends/follower (say 1000), it will be very slow to get nick name of the user.
I wonder if there is any API that only returns ids and nicknames of friends or followers. Or there is other lightweight approach to resolve this issue.
There is no Twitter API call that just returns the screen names. You can use /friends/ids to get the user ids of 5,000 friends with each API call, and then use users/lookup to get the account info on 100 of these at a time. But you are limited to only 350 API calls per hour.
If you are building an app that is based on knowing all of the friends or followers of your users, you need to plan the way you present that. You cannot do what Twitter does, and expect to let someone login and then instantly display all their friends and followers. One way to deal with this is to ask for 24 hours to assemble their complete social network. The other technique is store every user's full profile into a database, so you don't have to look them up again.

Resources