Twitter API-Limit for the user timeline - twitter

The Twitter docs for the user_timeline REST API state, that you can retrieve up to 3200 Tweets (before any filters) from a user timeline, requesting 200 tweets per request.
When I use the tweepy user_timeline method with parameter count=200, i get for users other than the authenticated one less than 200 (in one example 82 tweets).
Using max_id with the biggest id of the returned tweets (which should return the 200 before max_id) just returns an empty list.
Why can't i access any tweets before these 82 tweets?

Related

Figuring out userId from Twitter's Streaming Response Status

Per Twitter documentation A follow is:
https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/basic-stream-parameters
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:
1. Tweets created by the user.
2. Tweets which are retweeted by the user.
3. Replies to any Tweet created by the user.
4. Retweets of any Tweet created by the user.
5. Manual replies, created without pressing a reply button (e.g.
“#twitterapi I agree”).
....
......
1 and 2 are straight forward , to get them from Status JSON just do
status.getUser().getId()
for 3 , status.inReplyToUserId
for 4 , status.getRetweetedStatus().getUser().getId()
but how the heck do you get the last one ? Do those become mentions ?

Get all tweets,all following and all followers from 2015-12-01 to 2016-03-20 using twitter api

i want to get all tweets,all followers and all followings from 2015-12-01 to 2016-03-20 using twitter api.
when i use following code it always give me latest 20 tweet,i am passing the 'until' parameter to get all tweets but i want to pass date such as "from 2015-12-01 to 2016-03-20".
how is this possible to get twitter data from 2015-12-01 to 2016-03-20.
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
$twtrdata = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $twitteruser . "&until:2016-03-01");
There is no until-parameter for the Twitter API user_timeline.
The Twitter API is pretty limited, for example, using user_timeline will only return a maximum of 200 tweets at a time, and you will have to call it multiple times to get all tweets. There is a created_at-attribute connected to the tweets returned that you can use to filter out the tweets you want within a time frame, but you'll still have to run multiple requests to get all of them, probably. In addition to the 200 per request limit, there is also a restriction in place so that you cannot fetch more than the 3200 most recent tweets of a user.
For more info on this API call, and the rest of the Twitter API, have a look at Twitter's documentation.

Twitter API not showing old tweets?

I have a problem with twitter API. I tweeted in the past (around 400) but recently I haven't tweeted anything. When I try to fetch tweets by me using the twitter api, there are no results. How can I retrieve the older tweets?
Twitter doesn't return tweets older than a week through search api. Take a look at the limitations section from the below link:
https://dev.twitter.com/docs/using-search
I have the same problem as you, so after see that Twitter Web Search works I've started to implement my own solution, you can see on my GitHub. It is implemented in Java, but it will make a post on my blog to explain how to do in other languages. I've downloaded tweets without any problems, my last test I parse more than 600k within 2014 from some specific users.
You can use the REST API resource GET statuses/user_timeline to retrieve the most recent 3200 tweets from any public timeline.
This is possible in Twitter web search portal but not through their API. Bummer
https://twitter.com/search-home
This elaborates on #bennett-mcelwee 's answer where getting up to 3200 most recent user tweets can be done in series of API calls. Currently the max # of tweets you can get by a user in 1 request is 200, using the GET statuses/user_timeline API call. To get all tweets a user has posted on their timeline do the following:
STEP 1
Make a GET call to this endpoint passing parameter count=200.
STEP 2
From the returned data in step 1, get the ID of the last tweet
Make the same GET call but this time pass in parameter max_id= followed by the ID of last tweet returned form the first call, or -1. So for example max_id=9987999
STEP 3
Repeat step 2 until you don't get any new(older) data.
For my purpose I was able to do this in Ruby using https://github.com/sferik/twitter
Once a client object is instantiated, it's as simple as:
tweets = client.user_timeline('foobar', count: 200)
max_id = tweets.last.id - 1
tweets << client.user_timeline('foobar', count: 200, max_id: max_id)
From here you get idea and it's fairly trivial to write a loop until you've gotten all the tweets you can grab from the API.

Twitter API and operator

I want to make a simple Twitter API get using JSON. The idea is to get only the posts from a known corporation (say BigCorporation) sent to the main corporation (#BigCorporation). The idea is to just get the main annoncements and filter out anytime the BigCoporation answer a question from a follower (i.e. BigCoporation tweets: #someguy we are anwering your question)
So Tweets from:BigCoporation with the #BigCorporation
I came up with this API get but I seem to get both #BigCorporation or from:BigCorporation tweets. I want only the Tweets that are #BigCorp AND from:BigCorp
http://search.twitter.com/search.json?q=#BigCorporation&q=from:BigCorporation&result_type=mixed
Your search query is malformed.
It should be:
http://search.twitter.com/search.json?q=#edent%20from:edent&result_type=mixed
That will show you all the tweets I have sent which contains the string "#edent"
You can use this URL :
https://api.twitter.com/1/statuses/user_timeline.json?screen_name=BigCorporation&exclude_replies=true
The REST method GET https://api.twitter.com/1/statuses/user_timeline.json returns the most recent tweets (20 by default) of a user whose username (here BigCorporation) is in the parameter screen_name. When set to true (or t or 1), the exclude_replies parameter excludes the tweets that you want to avoid ("#someguy we are anwering your question").
You can visit this page on the Twitter API website for further details.

Getting Twitter home timeline tweets

I am using Twitters REST api for the first time and I am a little confused by their documentation. I want to poll their API every ten minutes (to avoid the rate limits), retrieve the previous ten minutes of tweets and then do some processing on them.
I am using "GET statuses/home_timeline" to do this. The first part of the documentation says it will return the most recent 20 tweets but then says it will return up to 800 and then later on says it will return 200.
Could someone advise me on the correct method to use?
Thanks
EDIT: Documentation link: http://dev.twitter.com/doc/get/statuses/home_timeline
To get the home timeline (assuming you've already authenticated), you will have to GETthe Home Timeline like follows:
For XML:
http://api.twitter.com/1/statuses/home_timeline.xml
For JSON:
http://api.twitter.com/1/statuses/home_timeline.json
For RSS:
http://api.twitter.com/1/statuses/home_timeline.rss
For ATOM:
http://api.twitter.com/1/statuses/home_timeline.atom
It will return the latest 20 timelines (if no count attribute is passed), but it's maximum return statuses is limited to 800, if retweets are included.
The count attribute only allows you to pull more than 20 (default) statuses but you can request up to 200 maximum statuses (since Twitter has to include retweets).
Does that make sense?

Resources