To collect data from Twitter, you need to have keys to the Twitter API. API documentation can be overtly technical and confusing to even experienced developers. Twitter's API is comparatively easy to navigate - once you know how.
This guide will walk through the process of accessing the keys required to authenticate your requests for data from Twitter. Ultimately, you want to finish this guide with four keys in hand; a API key, an API secret key, an Access token and an Access token secret. These are the codes that gain you access to collecting Twitter data using whichever method you prefer. To do this, you need to create a Twitter developers account and a Twitter app (it's not as complicated as it sounds).
"An API that isn't comprehensible isn't usable."
- James Gosling
After you have retrieved your keys, you are good to go! We've written this follow-up guide and notebook to help you collect tweets using the Twitter API. If you already have the keys, you should head straight over there.
To access the Twitter API, you need a Twitter account and a Twitter developers account. A developers account gives you a set of tools to start creating and managing projects that request data from Twitter.
In order to get a developers account you need to tell Twitter about yourself and your intentions for the account. Twitter will then review and approve your application. Give thoughtful and concise answers and they will normally get back to you pretty quickly. Sign up for a developers account here.
Once your developer's account has been approved you can create an app giving you access to the keys required to start making requests. Head over to the 'Developer Portal' to start creating an app.
Twitter apps aren't necessarily apps in the way that we understand them. They are the entity that you use to request data from Twitter but they don't have to have a fancy UI or in fact any UI at all. In reality, they are just a way of telling Twitter where your request is coming from. It's important to remember that apps are not the same thing as projects.
You want to create an app, not a project. Make sure your developer account has been approved and then start creating an app.
Now that you have a developers account and have created an app using it, you should have access to all of the keys you need to start retrieving data from the Twitter API. If you didn't collect your API key and API secret key as you created the app, head over to your app's Keys and Tokens window to regenerate them.
It's important to remember that once you regenerate keys for an app, every instance of these keys will change. If you build projects using the old keys, you'll need to change everything over so that your requests are made using the new keys.
As well as the API key and the API secret key, you need to make a note of your Access token and Access token secret. You should see a way to regenerate these inside of your app's Keys and Tokens window. The same regeneration rules apply.
Now that you've got these keys, it is time to start putting them to use. We've written a guide on collecting tweets here and provided all of the code you need to do it inside of the guide. Don't forget your keys!
We know that data isn't always clean and simple.
Have a look through these topics if you can't see what you are looking for.