Twitter Word of the Day Bot With Python (FREE) | Coding United | Skillshare

Twitter Word of the Day Bot With Python (FREE)

Coding United

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
16 Lessons (46m) View My Notes
    • 1. Setting Up Your Twitter Developer Account

    • 2. Installing Python 3 and Pip

    • 3. Setting Up Visual Studio Code

    • 4. Installing PyDictionary

    • 5. Manipulating Dictionaries

    • 6. Finding Definitions of Words Using PyDictionary

    • 7. Finding a Random Definition of a Word

    • 8. Installing RandomWords

    • 9. Generating a Random Word

    • 10. Installing Tweepy

    • 11. Posting a Text Tweet

    • 12. Posting Tweets with Images

    • 13. Generating a Random Word with a Random Definition

    • 14. Handling a Random Word without a Definition

    • 15. Posting our Word of the Day onto Twitter

    • 16. Posting Our Tweets Daily


About This Class

In this course I will be teaching you how to create a Twitter Bot using Python 3, RandomWords, Tweepy, PyDictionary, Random, and much much more!  The first four sections will teach you how to use each of the libraries separately, with the last combining everything to top off this sundae!  We will be programmatically posting these tweets instead of controlling the mouse and other methods of creating bots!  Therefore, the python file can be running while you are playing a video game!  I hope that you enjoy watching this course as much as I had making it!

Good Luck,

Coding Carter


1. Setting Up Your Twitter Developer Account: guys who are in this election will be showing you guys how to get a developer ap High case than you're able to post to his pergament for programmatically using python. So here is my Twitter account that I've created in its body calendar marriages made in, like, 20 seconds that we're gonna be using for this course. So now that I haven't created underscoring negotiate developer don't twitter dot com to apply to me developers that I could get an excess token or what is also known as an A p I key. So when she knew would be on here, it would show, um, a sign up. Apply? No, that's all you have to do is apply in tone like, uh, what you are. So I put it on. I was a teacher noticed teaching you to burn through videos. So you just put in liquid or your student or hobbyists or something like that, and then you adjusting the apply button, and then once you get accepted, if you get accepted, hopefully you do. Then you should be able to see this whole dashboard and everything. So I'm just gonna go to my dashboard to show everything so you can seal of your data on the dashboard of the Twitter developer website. And this basically just sounds you like your limits and on close, you are for certain stuff. And so to get our key, we just have to go do our abs and never to creativeness app, which is tutorial word of the day. But Okay, so to make this, let me just leave this and then let's make a new one. So call this tutorial word of the day, but cause we're gonna be making award of the day. But in this course, So editor, one of the big davon and it posts a tweet every day with the new in New word and its definition. Okay, I probably can't finish for the, you know, um, for website your role you wouldn't want you to. And then we go down here, um, and followers. Er, no. We will be using the twitter a PR to push to programmatically post these tweets. I don't think that this is recognize. Yeah, and then you just have to create create How long is it lunch man create this of eight yet screwed. So then we conceal with the data of Boehner application. And to get an A p I key, you just go to keys and tokens and you shouldn't see it. All of your a p I keys. So you would copy these and put it into the file once we start getting into the actual code and the next part of this course. So that's it. First lecture, and I hope you watch the next one. 2. Installing Python 3 and Pip: Hello, guys. And in this course, we're gonna be using python 3.8 point one, which you can install if you already have it at python dot org's slash downloads. If this version does not correspond to your operating system, just click your corresponding link below to install in federal of the different steps Also , to solve the libraries that we're gonna be using with Python. We're gonna be using pit basically a library language manager for Python. So then sold this. You just needed Don't love this. Beget dash pit about python file on their website which all have a link to this in the description or resource is you just right? Click this and hit save ads and then say that to your desktop and you can see this is a python file. You need to make sure you have python installed before you on this because it uses this problem final to install pip onto your device. So we just run this final region. It should open up your command, prompt your terminal, and then it shouldn't stop pip automatically for you already had installed. So it it says for existing insulation to know that poop is in Seoul. You're ready to start coding, so I'll see you guys in the next lecture 3. Setting Up Visual Studio Code: Hello, guys. And in this election, I will be showing you how to spell visual studio code, which is the co editor that we're gonna be using throughout this course. So I'm going with those. So I would be in selling this Windows version you feel unlike should be either installing the country version or the federal version. And if you're a Mac arrest, you just insulted Mac and run it and you should've visual studio code. So visual studio code is basically just an advanced code editor that has a lot of other features that regular Conor's don't have. For example, we have extensions you bugging and other useful features that are not included in most other editors. So when this current course, we're gonna be need to install the python extension drill to see the python color coding. So you just searched python in the extensions folder and you can just hit. And so and it should have private and self. So now that we have are coded or set up, we can just continue on in our course. I hope I see you guys in the next lecture 4. Installing PyDictionary: Hello, guys. In this section, we're going to be using Pyatt dictionary, which is just a python library that is dedicated to finding definitions of words, synonyms, anti names and etcetera. So we're just gonna be using this for finding definitions of words so we can put that into our body, you know, text it out. And so we just have no number command prompt to install this. And they were just going to copy this install code. So make sure you installed Pip as we didn't in the first section of this course. Twice already had installed sort says requirement. Already satisfied. But for you should have a bunch of loading bars. And once it's done in sewing, you're ready to continue going on to this section. 5. Manipulating Dictionaries: Hello, guys, and in this lecture will be teaching you guys how to manipulate dictionaries in python. So basically a dictionaries and a new order set of data that were ableto access by using certain methods or just calling the dictionary name. So we need to know this because our pride dictionary, when we get the meaning of a word, it gives us a dictionary with certain keys that are the parts of speech, and that has all the definitions for that current speech. So we will just create a simple dictionary, and it will be with us, have people. And then you said it as curly braces. So this is what the pie dictionary setting and then returning so people equals and then curly braces, which means it's a dictionary. If you tried any other programming languages, they usually instead of being called a dictionary. It's called an object. So to get elements instead of your you first have a key, and so we'll just have Robert and then we'll have his age, so we'll make it 23. So this is the value 23 is a value for Robert, which is the key, so we can also have another person whose name is Julia. And then we can have their age being 43 and then to manipulate their, such as have a simple statement and then we will just print out people. And so so we can just run this using python, using dictionaries up I because this is the name of our file. I would just run this and we get prints of the dictionary. So we have Robert and then 23 in Julia 43. So this would be in, like, what we would get, returned his definitions and then you would give us like, no. And then it would have in a rain or a list, and they would have all of the different definitions. And it could be like, if person and then as it could have the verb variation definitions off it, also being array. And we would have this being like someone who angers currently, I don't know. And so we could access this putting in the array and said, This is how you would, like, use the index inside of here. We're just gonna calling the key. So unknown. And Verba, the keys were just gonna put in out and it should actually be definitions now. So if we're on this, then we get a person. And then if we put in index zero, we should get the first element, which is a person. So this is how you manipulate dictionaries in python? I hope you I see you guys in the next lecture. 6. Finding Definitions of Words Using PyDictionary: Okay, guys. So in this, like Shelby showing you guys how to use prion dictionary to find the definitions of specific words that you specify in your python fun. So this is just the repository for prediction, Eri, as you can see here and so we have all the insulation stuff that we already went through previously, and so on we have to do is put in this coat, and it will be able to find the definitions of words once we import this library. So let's get individual studio code. So I'm in my source code folder. You just have to open it open here using this, and so we're just gonna create a new file, and we'll just leave this mean by thumb because p wise ending for python files. So now we just have to import the prediction are, um, library. We're just going to use this or actually, we should be doing this. Aimed to know you're importing the prediction of modules. Then we're able to use it inside of our program. So this is just instance ing a, um dictionary as pride dictionary for further used within the program. Good. So to find the meaning of something on we have to do is run the function dictionary dot meeting and then it has one parameter, which is they were that you would like to find them meaning off. So we can just have a variable. We can have the equal to dictionary, not meaning of the word. In this case, it's indentation that we can also have word equals. Um, we'll have indentation just busy over there, and then we'll put in the word as a private er for the word that we want to find the meaning of. And the ship print imprint is just putting it into the council, as most of you guys probably know. And then we're just gonna print the, um we're in a word, and then we're gonna can't need a string, and then we'll just put in definition. And my son was just long of definitions of for right now. So then to run this private file, we're just gonna open up terminal, and it should already be inside of the location of where we are right now inside of our project. And to run this we just do python. And then we put in the name of file. So many dump you are okay. And now it's rain inside of our term. And so it's found a definition for it. Her definition is is a known and here's the definition right here, and it has multiple different definitions for being unknown. As you can see, here is three different ones. So then we can just pull out inside of here so we can just do a break in and then put in the known key, which should give us the definition that isn't know. So we can just run our file again using python me, not people like. And we get the definitions for a known of indentation, which is a con cave cut into a surface or age and then all these other ones. And this isn't in a race. We can access each of these individually using hard, hard coding in the indexes when we can get the 1st 1 The first definition isn't announced With a string we can get the 2nd 1 because our indexes stir. Zero is the first element inside of Indurain are endless, actually senses his place him so we can just can't need this than it looks nicer. Where We're going to work place and then Colon. Plus, So we had the space before it. We're gonna run file again, and we can see it's his indentation. The formation of small plates and a surface as a consequence of corrosion. No support the 1st 1 or any of the other ones. So we're gonna use this basic idea. You create the functionality for our word of the day. Oh, but using the Twitter by So see you goes in the next lecture. 7. Finding a Random Definition of a Word: Hello, guys. And in this lecture will be improving our previous program to find the arraigned, um, definition from for this word instead of just receiving a huge list of all of the different parts of speech and the different definitions for issue the person's speech So we can just run our previous example here and you can see it is just picking the first definition for now. This one always work. So if we have, like, run, if runners are word, then you can see it's getting a different definition. But if we just return out definition and then if we just return out the whole dictionary because definition is a dictionary type, you can see that, uh, I actually have to do this. Convert this interesting, sir. We run this, then you can see that we get all of the definition seat that you can see them down for the first speech known, and then you can see all the definitions that are announced. Four run, and then we should also have different person speech, such as a verb. So if you're running than your like, moving your feet to profess like walking fast so you can just clear this, so we want to make it. So then, um, you can just pick a random definition out of a random for this speech. So to do that, we're gonna import the random library, which is pre installed with your, um, highs on when you install Python three. And we're also won. Just gonna others put this as definitions equals that showed up. Meaning words. We're gonna have a This is going to be the dictionary type that is gonna hold all of the definitions of this word. You know, we're gonna have a heart of speech, and this is going to be the first speech that we want a target. And so we're gonna access that keys of the definition. So if I just print out what this is, it's basically just the purchase speech using the dictionary. So if I run this file, you can see here that we get all of the we get own of the down and we get all of the like adjective of earth. So if we pick out of here from, turn this into a list which is basically just an array, So this is making it a list and then we can do Brando the choice, and then we can put this as a parameter inside of here. So we're getting the keys, and then we're turning it into a list, and then we're peaking around of one of the keys. And so that is our purse speech, as you can see here. So we have, like, known. And then now we want to get a single rand of definition so we can just put in here, and then we can just make it random. Done. We can make it definitions and then index, So we're gonna put in the key for and then we're just gonna put in part of speech. So it's gonna pick a random definition on the definitions from a random or a speech. So if we run this, you can see that we're getting all of these definitions for all of this. So if we put in here, bring them the choice, it'll pick a random definition from here. So then we can just go down here and run this and we get off these. If we put in definition a single definition, then we get one definition and we can also put inner part of speech. Actually, let's just use an F string. This is something and price on that you can use. We're gonna excess the worst, and then we're gonna put a colon, We're gonna have the definition, and then we're also gonna have some parentheses, and then we're gonna have the partners to be inside of there. So these are the variables that were calling in. And then we're just gonna run this and you can see it run. Caused to omit recorded audio or video sense of the verb tense of this recorded again, we should get a different definition and per speech, run in a Birkin series of events known and also run it again. And we should get a different one, a different definition and a different part of speech for it's just a random definition out of arena, part of speech. So I hope to see you guys in the next lecture 8. Installing RandomWords: Hello, guys. In this section, we're gonna be learning how to use the random warrants library with python sort of solvents . All you have to do is copy this installation code using PIP, which we have already installed in just 50 paces into your terminal or command. Prompt and just hit. Enter. And as you can see, it says I already had it installed, therefore doesn't have consulted for you. You should see loading bars, and that should be working. So now this isn't so You're ready to start coding with random words. 9. Generating a Random Word: what is up, guys. And in this lecture will be showing you how to generate random words using the random warrants module that we have already and still previously. So to import the random words library, you just have to do from random underscore words. Import brand random words. So that imports library into our private file. And then we just have to initiate random words when we're just going to denote that using our W for rain awards, and then we're just gonna use the function that we imported earlier, and then we're just gonna set her word, and then we're gonna set that to our W for random words dot random underscore word. And then we run the function in French word No one's rewards program, which should see that it generates a random word from the dictionary. So then later in this course, we can use this to find a rate of more to the day that we're gonna be posting on the Twitter watch. So I hope I see you guys in the next election 10. Installing Tweepy: Hello, guys. And in this section, we're gonna be in learning how to use Tweetie, which is a python library dedicated to posting tweets and using your Twitter profile with the Twitter FBI. So I only have to do it on solos, his cup of this pip insulation community, and then open our command problems or terminal. He's there in it, enter and it installed. So I already had it installed. So it says requirement. Already satisfied. You should see a bunch of loading bars and it should be in sewing for, you know, this isn't soiled it ready to start tweeting. 11. Posting a Text Tweet: Hello, guys. And in this lecture will be teaching you how to post a simple text tweet to your Twitter account that you have connected with the Twitter developers. So first of all, we need an A p I key in an A p I access token in on this different, uh, credentials that you need to log in using the tweet p a p I. So how to do this is we go to details on her app that we already created. If you haven't created one, just create nap and then what you get done with that You should see the app right here on your app. Age. And so the Twitter developer, every website. So if I got a details, then you can see right here all of the details and we just want to hit keys and tokens. Okay, so right here we can see all of our different FBI keys for accessing your account. So we need Teoh. Uh, I'm just gonna regenerate all of these, and so you would probably be hitting the generate button to get these new ones. You can see I regenerated all the keys now that we have all of the regenerated. We're just going to go into our price on file. So I have my price on file open right here. And first of all, we're gonna import Tweety. So we're just gonna import three B and then we're gonna put in consumer Underscore Key, and then we're going to send that to a string of wait a small that wrong. There we go. And so, consumer key and that is gonna be right here. So if you look right here, it says consumer FBI keys and the a p I key, and we're just gonna copy this right here and paste it in there And don't even try to copy my e p I keys, cause I'm just gonna resettle these after this course. So no, no, we just have to copy the secret king for the consumer secret. And so we're gonna need this consumer underscores secret, her skirt, and we're gonna set that to that Concede, Ricky, No, we're gonna have an access token, and then and then we're gonna set that. So we need to access our access tokens so you would be hitting the generate and then I have to regenerate again, and then you can see your access token. And these air, the really important wants to keep, uh, private Don't share these with anybody. So I'm just going to pop in my access token, and then we're gonna set that to that variable, and then we need access token secret. And we're gonna set back to this, You know, we have all of our data walked in to our tweet be filed. So now we just have to do off, cause we're gonna authorize this file, and then we're gonna do tweety 0.0, oh, can learn. And then it takes two parameters. We're gonna ever consumer key, and then we're gonna ever consumer secret key. Uh, you know, we can see that we authorize air filed, and now we also have to sent access our center center axis token. And we're gonna set this to access token, and then the other parameter is access token secret. Right there. Um, she could read his father from okay. And now we have authorized our file to be able to post on her twitter. Come now on we have to do is said the a P I equals Tweety that a p I and then put in the off. So we're authorizing are fire with all of these credentials. So it knows which account we are and it's knows which one we're gonna post you. It's not opposed to a simple tweet. We just have to do a P I the update underscore status, and then we're just gonna put in the tax. So we're gonna say, testing a tweet using the tweet be if you are, and then we should be able to run this. And if I can just copy the name of this file, son, and then we could you pay, sit in there, run and you can see the fire. And if we go to our Twitter account and refresh it, you can see that it posted a tweet that we had set in here. So I hope I see you guys in the next lecture 12. Posting Tweets with Images: Hello guys, and in this lecture will be teaching you on our bloated tweet with images. So the image that I will be using is a gift file, and so you can upload Ah, variety of different final formats such as J. Paige, PNG or Jif or maybe animated PNG's. I don't really know, though, because people were uploading strobe images onto Twitter that we're giving people seizures so they might have removed that feature. So basically a home we do this is instead of saying updates Stairs, we say update with media so I can just change this with a script Media. Another way of this changed. The first parameter in here should actually baby location or the directory of the file. And so I'm just gonna be doing celebration No J area, and that is in the current directory of my Python file. If it wasn't, then you would have Teoh like there's inside of a folder. Such image very foods instead of an image folder. So if I a folder called Image and then celebration dot GF was in there, then I would have to put in that directory towards it. But since this is incentive, the same folder as it like you just put in celebration. And now the second parameter is the tweet. And also I forgot to mention in The last lecture is that there's a limit to 280 characters inside of a tweet, so make sure you don't go over that to know if I run this, I should see one on. One. Other thing to know is that the image cannot be more than three megabytes in size, so you know, if you compress it or something, if it's a pleasure than that. So if I just run my prints on file shouldn't take longer since your self loading image to Twitter. And now, if I go into my Twitter account, just refresh it and you can see that I have my tweet with my office. Jerry F. So I hope I see you guys in the next lecture 13. Generating a Random Word with a Random Definition: Hello, guys in this election will be shown you how to generate a rain ward with the rent definition in python. So first of all, we're gonna import the random library, and then we are all so going to import random words which we have been working with inside of our previous to talk tous rooms. So no incentive to import prediction. Er someone confined the definition of the word that were that the rate of more than we're generating. So I'm gonna import pride dictionary, and we're gonna send dictionary. It goes to Kaya Dictionary on a R w. For random words equals random words. Because you can see we're just incorporating all of the things that we've been learning in the previous lectures into this ward master. But we're creating, so we're equals r w don't random word. And when we're running this, you're probably gonna find, um, that we might find a couple have a couple of years in which the prediction It doesn't have a definition for the word that was generated by the Random Ward Library. So what we're gonna do to handle that? We will be learning in the next lecture. So also next we're gonna have definitions. You close dictionary. Mr. Public lately, Wrong dictionary. Don't meaning of words. And we're also gonna have part of speech equals random treats approaching the spacer. And then we're gonna convert this to a list earned definitions that keys. So this is basically just taking the dictionary that is created right here for word is converting it into a list, all of the different keys, and then it's peaking. One of the random keys that is inside of that list. And that will be the purse speech. And then we're gonna target one of the definitions that it is that part of speeds using Brendan Duck Choice and the definitions in banks hurt of speech. Basically, what this means is we're getting a random purchase speech out of the definitions. And then we're finding the definition a random definition for the word with that part of speech. So it's getting a random definition of that word, and then we're just gonna print out. We're gonna use enough string word and definition. Well, this should actually be singular, and then in parentheses at the end, we're just gonna have the part of speech. So now we should be getting the word, the definition of it, and then the purchase speech when we will be having an air sometimes because the Dick Pride Dictionary doesn't have a meaning for the rent of more generated. So let's hope we don't have that. So I'm just gonna run this file and the word is pairs. And it's an old world tree having sweet grew detection, juicy fruit. It's the no definition we can generate again periods in amount of time. No commissions charged with the task burn. So now we're going to be using this, your creator, but in later tutorials those you guys in the next lecture. 14. Handling a Random Word without a Definition: Hello, guys. And in this lecture, we're gonna be learning how to a handle the air that happens when the word that is generated by the random word library isn't actually in the pie addiction. Er, so we're first going to do is we're going to create a function, so that's defined in python and a load random word. And then we're gonna have a colon, and then we'll just invent all of this and remove this. For now, it's known Leave all of this code in here. So know what we're going to do. Is this right here? This covert here is where the air happens in heaven's when it's not able to purse the definition. Keane's peas. There isn't any piece that isn't any definitions for the word. So what? We're gonna do it a try, which basically says, Try this. And if it doesn't work, if you get in the air, then do this. So then are then code is, except that's right there. And we can just invent this. So it's gonna try doing this. If it gets an air that is going to the except code and inside of the except Co. We're just gonna return return, and then we're gonna create our own miracle code called No, no underscored definition. So that's where it is going to return when it's not able to do this. So know what we're gonna do is go under here, and then in the end, we're just going to return our own dictionary and it's gonna have a word. And that word is gonna be word. So it's gonna be the word that we're getting the death, the random or that we're getting. And then we're always gonna have a definition. It's gonna be definition George is returning on this status. Then we're able to send a variable to this function, and then we'll be able to pull this data out. And then we're also going to have a part of speech, and we're gonna set that part of speech. This issues us, adding in all of these variables into the dictionary. Now all we have to do is at the end of our code, we're gonna do we're underscore of the A in close world. Random word. This is a function. So we have to use these parentheses and this is going to return data don't either return or definition. If it's not able to find a definition for that word or you'll return this dictionary. So what we're gonna do is wild. Word of the day equals room builders copy. It's a little definition error code. I don't want to do this. And what we're gonna do is we're gonna set this word of the day to this function, son, Every time you get an old definition as the air, you don't just redo it. So then even if it happens, like five times in a row and I'll just keep on going until fixes it and then the n word is gonna have a print statement and have strange And where have you 100 dio word on a score of the day and then we're gonna since its addiction, or we're gonna pull up this word key. We're just gonna put a word and was copied this and it's easier. But in the code later, we're gonna do colon, and then we're gonna have this word of the day, and then we're gonna pull up the definition, and then we're gonna have parentheses, and we're gonna have a part of speech. Oh, okay. It's no once we run this, it should automatically fix it if the word doesn't have a definition. So let me just open up our terminal. It the name of her file and will run point son. And I'm putting the file Name A in which we run it. We get the word eliminator. An agent that eliminates something. That's a great definition, but running begin to see. Um oh, I just accidentally didn't have the python in front of it. This on me. Okay. Restraints, discipline in personal and social activities now, But it again participation the condition of sharing in common with others as fellows or partners extension and finally cliffs a steep high face of Iraq. So we should never get in air after running this code because we already handled the air and fix the word of the day. Yes and no. After this, we're gonna be actually creating our Twitter bots and sending it toe upload a random word of the day every single day. So I'll see you guys in the next lecture. 15. Posting our Word of the Day onto Twitter: who have any scenarios lecture. We're gonna be posting our word of the day and it's definition and purchase speech onto Twitter. As you can see, I've already opened up the file that we had from less lecture. So now we just have to load in our Twitter credentials on just gonna pacing the code that we had for me. Another, like sure, which taught us how toe post a tweet. And so here's just the code in just use all the keys off the FBI keys. And I just authorized this program with Tweety. So then we have all over codes in there. So no, on we have to do is we're gonna go down to the bottom and we are, instead of just creating this f string, we're just going to leave this right here, and we're gonna have word of the day. That's what this acronym stands for. And they were gonna underscore tweet, and then we're gonna set that equal to an F string. It was going to teach a day, and we can't use another, uh, single Cuomo signal apostrophe because we are using that wrapping around the strength. So what we can do is escape it so that it doesn't think that we're open up a new a string. So then we can do today's hash tag. Word of the day seven, it appears in that hash tag category is and then we're also gonna have another escape single apostrophe, and then we're gonna have word of the day under score of the day, and then we're gonna pull out that word, Kim, and then we're gonna have another escape, single prosperity, and then we're gonna put in period. So we're saying that today's word of the day is, and then it's gonna put it that word. And then I was going to say it means and then we're gonna have escape out another word of the day. And then we're this some we're going to call in the definition key. No, we have to is put in and drew their sale about me, and then is a and then finally, just copy this and then we're gonna have part underscore of speech. Is that not only ever tweet formatted that we're gonna be posting onto Twitter, so this will just posted every single time that this program is ran. So all we have to do is now we just have to post the tweet. And I have actually included a GF that I'm gonna attached to this tweet because everybody knows that tweet with images get much more notice than just text. We're gonna AP I got a thanked our school with media and then we're gonna have the location of the image and it's just words that Jeff and then between is going to be word of the day . Underscore. Tweet. And so now it's just gonna print out our random word with its definition. And we won't have any heirs because we already handled this in the wife's lecture. There's no we should be able to just run this program. And don't post it on to our Twitter accounts. Let's see if this works my son in a name. Okay, so this will probably take a little bit longer, and now it's ran and we should be able to go into our Twitter account. Refresh the page and today's word of the day is hairs. It means film mentis, hair lee, growth in a plant as a noun. That's just some exc your definition, and I actually just realized forgotten, period there and let's just run it again and post another tweet and refresh the page. Today's word of the day is delights. It means a feeling of extreme pleasure or satisfaction. As a no to know. Weekend just pushed all these tweets. And in the next lecture, we're gonna be learning how to automate this so that it automatically does this every like , 24 hours and posts it in like a certain time frame. So, like maybe we wanted to pose between 8 a.m. and 12 uh, PM. So we'll learn that in the next larger lecture. So thanks for watching guys. I hope you stick around for the next lecture. 16. Posting Our Tweets Daily: What's up, guys? In this lecture will be teaching out a poster tweets daily. So we will be doing is person treat. If the time is between 8 a.m. or 10 am, that's not always gonna be posted a certain exact time. Then we can save our memory. Instead of making this thing run all the time, it will only run like every hour and 45 minutes. So what we're going to do is import date time just included in price family in storm. So you guys don't have to install any of these libraries. It's already insult with Python. We're just gonna be using date time in time, how we're going to be using for the sleep command which will just make the program sleep for a little bit. So now we have to go down here under this return, and we're just gonna create a wild, true loops where you while on true. So this will always be running. We're gonna slink command at the end of it so that it's not It's just gonna stop. Then we're gonna his statement, and then we're gonna date time, date time that now this is a function. If this date time. I don't know if it is done. Our it's less than burner than an equal to eight. So 8 a.m. and just copy this is less than able to 10. Then do this and then it's gonna push your tweet. And then after this, we just wanted your time, not sleep 1.75 times three, 3600. And so that is equal to one hour in 45 minutes. It is time that sleep takes in an integer. And one inter Juries equaled a one second and there were 3600 seconds within an hour. So 1.75 ours is equal to one out 45 minutes and this date time during daytime now dot Our is we just printed out for you. You can visualize it issues the current hour in a one through 24 hour for man. So right now, it should be 23 because it is 11 45. I'm on the 12 hour for May, but that doesn't really matter for us because we're just doing 8 a.m. There. 10 AM, But if you were trying to get it so that it was at eight PM You just add 12 to this side of 20 and then in 22 is there will be between 8 p.m. and 12 for 10 p.m. And we're just undo that and I want to remove this. So now this one, Just wait every hour, 45 minutes and check to see if it's between this hour. Indifferent is that I'll just post display the post and then posted onto our Twitter. So when we are running this, uh, the group and keep on going, but they don't wait that it won't display it all the time. And that's why we needed to import the date time in time. So now if you don't want to have to run this in your code editor, I just cancel this and then run it. We would be running this 24 7 and our code editor and our code editors taking more memory onto our computer. Sent to save some Ram. We can just open up our filed open out are python file and are explorers. So we can just right click this interview and explore, and then we can just right click it and then open with and then python. We're just going over up with this. No. Open up this terminal. No, we can just leave this open and you'll automatically check every one hour, 45 minutes to see if it's within our time friend. And if it is, it'll just posts out our Twitter posts. So that's how we post their tweets daily within a certain timeframe. So I guess I'll see you guys in the next lecture.