nmsnerd
#1
Hi,
So I have applied and been approved for Twitter’s standard API, but it seems I may need to get historical tweets from user profiles that go back further than the last 3,200 tweets. Is the only way to do this with Twitter’s Premium API? If so, how much would that cost for 6-12 months, and is it possible for me to upgrade my developer account from standard to premium?
My other question is, if I want to specify a time frame from which to collect those tweets, can I do that? (Example, from March 2019 to May 2019)?
Thanks for your help!
Is the only way to do this with Twitter’s Premium API?
Currently yes - unless you own the account and can export a Data Archive and extract them from that.
how much would that cost for 6-12 months, and is it possible for me to upgrade my developer account from standard to premium?
Each Premium request can return a maximum of 500 tweets on a paid plan or 30 days worth of tweets, whichever is first. (Free sandbox is 100 tweets max instead of 500). So it depends on the volume of tweets.
I don’t think you need anything else special to use the Premium API - you’d set up an app with an environment on a specific endpoint on https://developer.twitter.com/en/account/environments
specify a time frame from which to collect those tweets
The Premium API is different in terms of querying and parameters etc, but time ranges are set with the request parameters, not in the query: https://developer.twitter.com/en/docs/twitter-api/premium/search-api/api-reference/premium-search
I recommend using the 30day endpoint to make experiments and test your code because the fullarchive endpoint is the same, just goes further back, but has very limited calls.
Twarc https://github.com/DocNow/twarc#premium-search-api or https://github.com/twitterdev/search-tweets-python are good tools to use. Just remember that 1 call to a function in python does not equal 1 request - those will paginate for you so you’ll end up using your quota quickly if you don’t double check.
nmsnerd
#3
Thank you for your help. I apologize if I’m struggling a bit to understand how to use this, and I just sound really confused. I’m a psychology student who has never done any level of computer coding before, and have no familiarity at all with Twitter’s API, so I’m learning from scratch right now.
Basically, what I need to be able to do is sample from a pre-selected time frame of about 10-20 specific users tweets to collect a sample for my thesis.
I have gone through the link you showed me to set up an environment. What would I do next?
Also–do you know if Twitter has a customer service email for developers? I’ve been searching and searching and cannot find it.
Thank you.
1 Like
You might find this useful: https://scholarslab.github.io/learn-twarc/
If you have 10-20 users, i suggest starting with https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-user_timeline to crawl the last 3200 tweets of the user, in case the time range you’re interested is covered by that, that way you can make fewer expensive calls the Premium APIs. In twarc it’s https://github.com/DocNow/twarc#timeline
Using Premium API, you can’t “sample” tweet results as such, you have to retrieve all of them, but if you have a time range and 10-20 users you can define your query as "from:user1 OR from:user2 OR from:user3 ..." etc and it should work well. https://github.com/DocNow/twarc#premium-search-api
This forum is the “customer service” really. Unless you have a billing issue, in that case it’s the email in the dashboard.