It's time for another project.
And in this project, I'm going to show you how to create a Twitter bot.
And this Twitter bot is going to do a bunch of interesting things that well might help us with Twitter,
maybe following back people, maybe retweeting something or liking a tweet based on a keyword.
It's going to be a lot of fun.
Now, this section requires us to work with what we call the Twitter API.
If you remember with our discussion of APIs, there are APIs that websites provide that gives us data.
There's also ways for us to grab data from a website that doesn't have an API.
Using something like scraping.
And that's something that we talk about in the scraping section of the course.
But then there's also permissive APIs that is, well, Twitter gives us access to its data, but we
have to get permission from Twitter to access that data.
Not just anybody can get it.
So if I go to Twitter API and I click on the link here, I actually already have set up an account.
But if you don't have an account, your page is going to well look like this and you're going to have
to click on Apply to Apply for access.
Now the Twitter API is completely free.
The reason you need to apply is because, well, they don't want people to do bad things, such as create
a bot that just posts sensitive information, maybe does something illegal, does some spamming.
So they just want to make sure that, hey, this is legitimately for a good use.
What you can do when you apply is just say this is a personal developer, use account, make sure you
read the agreement and policy.
Essentially, don't be a jerk.
And as long as you're nice and you're just experimenting like we are now and we don't abuse the API,
they'll give us access.
Now you can do that, or you can just watch me code a Twitter.
But like I said, it doesn't take long so you can do this on your own.
And I do recommend you signing up for the API because it is kind of fun and cool to build a Twitter
bot.
Now, once you've created an account, you'll have something like this.
And they've actually recently changed their UI.
So it looks a lot more confusing than it needs to be.
But all you need to do is to just click on Get Started.
They have really, really good documentation here that you can actually go to docs, documentations
and read up on how you can use the API.
But in my case, I want to just create an app.
Now in here, I've already created a XHTML bot, but you can just click on create an app here, you
can add an app, name some description of what the application does.
So you can say for developer use.
You'll have to provide some sort of a website URL.
And you just have to fill out some of this information.
Now, I wasn't going to just record me entering this information because that wouldn't be exciting to
you.
So I've created one ahead of time.
Now what we're going to do with this spot is write our own Python script and interact with this API.
In order for us to do that, we're going to use something called tweep, which, as you can see, is
an easy to use Python library for accessing the Twitter API.
So using the IP library, we're going to be able to interact with this API and well write Python scripts.
It's going to be a ton of fun.
So in the next video, we're going to get started.
I'm going to show you how to build your first Twitter bot.
I have a folder here called the CTM bot with my tweet tweet dot py file.
So get ready and let's start coding in the next video.