This course is designed to help you create your own social media bots with Python. You will learn how to use Python to create automated programs that can interact with social media platforms like Twitter and Reddit. You'll be able to create bots that can post content. We'll also explore how to use APIs to access data from these platforms. API stands for Application Programming Interface. It's a way for different pieces of software to talk to each other. Using this techniques, you should be able to create a social media bot for any platform you want.
The course is perfect for anyone who wants to learn how to use Python to automate their social media activities. It's easy to follow and you'll have access to our experienced instructors who can help you every step of the way. If you're interested in learning more, please don't hesitate.
So if you're interested in learning how to create social media bots with Python, this is the course for you. The course is created for beginners, those who are new to Python. You will also learn the basics of Python when starting this course. Are you looking to become a Python expert? Don't miss out on this opportunity to take your Python skills to the next level!
so what are social media Bots you you
have heard about social media BS by now
there are special computer programs that
help us on social media it can be on
Twitter on Facebook on Reddit YouTube or
any social media
platform so how do these social media
Bots work social media Bots are written
in codes they're computer program s and
they're written with a computer
programming language in this case we're
using the Python programming language
that means that um as it is a computer
program we tell the bot what to do and
it will follow our instructions so that
can be posting uh messages specific
temperatures or whatever you wanted to
post it images videos the bot is just a
program and it will follow our
instructions
social media BS can do many things so
they can post messages they can post
pictures answer our questions help us
find information and they can make the
whole social media experience much
better so basically the social media bot
can do everything that the platform
allows and whatever you make it to do so
it could be that you make it just post
text or a certain message but it's it
could be that you wanted to upload a
picture every day or or more complicated
things like it could be that your Bot is
interactive and other users can interact
with bot it can answer
questions and such kind of things but
the whole idea is is of bots is to make
your social media experience
better what is better it depends on what
is your need for the bot so it could be
that it just provides information but
you can also use it for marketing like
if you have a course and you want to
sell the course maybe you want it to
post to social media automatically it
really depends on what you want to B to
do it's just a program and it will
follow the instructions that you tell it
to
do making your own social media bot is
fun and it's also easy to learn and it's
a fun way to get better at a programming
language so do you want to make a cool B
together let's do it
in this course we'll be using the Python
programming language to create a Bots
you should already know the Python
programming language but if you are not
familiar with the programming language
you should still be able to follow along
doing all the steps and and you will
have a social working social media bot
by the end of this
course thanks for watching this video
and I hope you learned something new
today so don't forget don't forget to
give it a try and program your own Bots
uh and that does whatever you want it to
do hi have you ever heard of programming
programming is like giving the a
computer instructions to do something
just like you might tell someone uh like
what you want for dinner in programming
we tell the computer what to do there
are many programming languages but today
we're going to learn about one of the
more popular ones
python with python we can do all kind
sort of things like making games
creating animations or even making our
own
websites we can use it to solve M
problems or make the computer talk to us
the possibilities are endless any
program you see on the computer is made
in a programming language which could be
python
so we use Python by writing commands
socaled codes and then run that codes
the computer takes the code and uses it
to to do what we tell it to do so we
cannot speak English to the computer we
must write in code in this case python
code and then the computer will obey
those
commands let's start with a classic
example and the classic programming
example hello world this is a simple
program that just prints the words hello
world on the screen so here's the code
for that it just is one line of codes
print hello world notice that the text
is between quotes So you'll see here any
text you have must be between quotes and
we are
calling we are telling the print
commands and that will I'll put it to
the screen now this is the text itself
and it must be between
brackets so when you run this code this
python code the computer will print
hello
world python can do many mathematical
operations like here we have X and Y and
it sums
those and in addition to just outputting
things and calculating things you can
also ask the computer for keyboard input
for example we can ask the user or
whoever uses the program for their name
and then uh output that so when you run
this code the computer will ask the user
for their name and then print their name
with a nice
greeting whenever you want keyboard
input you can always use input so this
will always uh ask for input and this is
the text it shows before you can type
the keyboard input then that input is
stored here and you can then output it
like
this you can work with different types
of data with python so for example just
regular numbers floating Point numbers
text text are sometimes called strings
and you can work with lists so for
example a list of numbers here and the
the only difference here is just how we
Define it so here when we just want
regular numbers we just type uh the
numbers when you want floating Point
numbers you type with a dot in between
when you want text you make those ques
around it so that's how python
differentiates between different types
of data when you want a list you put
those brackets around it and commas in
between so different types of data with
python now python can do all kind of
mathematics so anything that you can do
in mod you can do with Python
programming
language let's take a look at functions
sometimes you want to use a piece of
code more than once that's where
functions come
in functions are like like programs that
you can use over and over again just by
calling the function's name so here we
have a function called
add and then we have function call and
you can uh this is like a small
programmer function and you can call
this as many times as you
want with uh just the name of the
function so any function starts with the
words DF for
Define and then you can call the
function again and again so let me give
you an
example here we have a function that's
given a name it prints the name to a
screen the function is called greet and
we know it's a function because it has
the characters DF or Define in front of
it a function must be called if if this
is the program it doesn't do anything we
we need to call it with this name so we
can say greet with whatever
name if you run the program
you'll see it run the fun it run the
function you can call a function
multiple times with the same
input or with different
input so you'll see the function has now
been called five times which matches the
program where we call the function
function five
times programs we made so far were top
down so everything is every operation is
done in
order sometimes you want to do things a
bit different based on conditions for
example we might want the computer to
print too hot if the temperature is over
80 or just write if the temperature is
between 70 and 80 you can do that with
the so-called if then statements
so here we have a simple program that
says if x is greater than y then it does
this code if it's not great X is not
greater than y then it won't do that
code now you can also repeat code so if
you have a line of code that you want to
repeat for example with numbers and you
can use a for
Loop or a y Loop that will repeat lines
of code now it will only repeat
repeat the lines of codes that have four
spaces before so you'll see these have
four spaces
before that's why they get repeated so
the first uh control flow block that is
only do something if something is
true the next blocks are for repeating
code so two different ways to repeat
codes so you can imagine if you want to
print the numbers one to, you could
uh use the print statement 1,000 times
or you could use a for Loop or Y Loop
that does it that repeats the code block
automatically python has a lot of
built-in functionality but sometimes we
want to use functionality that isn't
built in so that's where modules come in
modules are like extra pieces of code
that you can use in your own code like
components you can use several
components and use that to create your
program hi there today we're going to
learn about
apis so you might have heard about
secret handshakes between friends an API
is like a secret handshake between two
computer programs now you might think of
a computer program is just something
running on your computer but anything on
the web is also a computer program
like Twitter Facebook YouTube or any
website for that matter has a program
behind
this so with an API a computer program
allows to and computer programs are
allowed to talk to each other and share
information through that
API so here we have a python example
with three lines of code and let's say
you want to know the weather so what you
do is import a requests module then you
gets data from that web URL from that
API see API here on openweathermap.org
then it gets a response and when you
output that response you know the
current weather for in this case London
UK was inside that link so that is an
example of how you can use an
API so why would you use an API well you
want to communicate with many things on
the internet can be social media or
anything else or even another computer
program then when you have an API you
can access all of its functionality
without having to worry about all kind
of other complexities you can just worry
about your
program so let me give you an example
let's say you want to make a new video
game and the video game needs to know
the information about the current
weather well you could try to write code
that context the weather station and
then inside the weather station convert
from Fahrenheit to Celsius or vice versa
and check the units and check the
geolocation and all that but it quickly
gets very complicated and so what you
could do instead is communicate with an
API that an API that is like a software
running
somewhere that you can communicate with
and then through that
communication you can then um access
whatever information you need from other
software programs so it makes it a lot
easier when you use apis apis are also
used in social
media so all of these social medias have
a different API for example Reddit
Twitter YouTube Facebook and any social
media Network you can think of and they
have an API for example you can use an
API to post a message on Twitter from a
computer program from a Python program
you can do the same thing for Reddit so
you can post something to Reddit using
the Reddit
API and so it's it's like the connector
between the your program and the social
media network is the
API so you can think of it like a
connector or a secret handshake that
lets you communicate with those
software
platforms so by using the API you can
easily share information to the other
platforms and get information and do all
kind of functions so there's a lot of
functions available on and and they're
different on every platform for example
posting on on Reddit posting on Twitter
but on Reddit for example you can also
get information from a subreddit which
is specific for that
platform but you can access all of the
publicly available functions and you can
use that to create your
Bots now apis are not only used in
social networks so they're
used in in many different uh websites
and also outside of websites they are
used for example they can be used for
certain Electronics or other things so
in summary apis are like secret
handshakes or connectors between two
computer programs and they are created
because or or you can use them because
it makes it easy to let them share
information and talk to each other
without an
API writing software would become very
complicated because you don't have any
way that the components communicate with
each other
so you might have to write the whole
program itself or do all kind of network
codes and it it gets very complicated
and API is just very easy you just call
the function that you want as you saw in
the code example just one line of code
that says okay this link gets the
weather from London UK and it Returns
the information directly you don't have
to write any weather station codes so
apis make it easy for applications to
talk to each other to share information
and also to call remote functionality
and that's why we use apis they just
make it easy for different computer
programs to work together and share
information and there's basically no
reason not to use an API and sometimes
there's no API available in such a case
it gets very hackish maybe you need to
start a web browser and then you need to
use the code to control the web browser
browser to get information and to click
with the mouse on all kind of locations
so it's it's a very tedious process you
can do that with python selenium that I
have a course about on this
platform um but the most easy way to
make two programs talk to each other for
example um your program and talk to
weather station or your or sorry talk to
the weather API or your program and talk
to the Reddit API to talk with that
social media platform is through the API
if you don't use an API it just gets
very very hackish it's possible it's a
lot of fun but when you want to make
quick programs then it just takes a lot
of time for example you can use selenium
to do all of that website Automation and
you can basically automate anything but
it's a more timec consuming process and
using an API is just very easy there's
just certain commands that you can
communicate with they're all web
commands for examp example here you see
a web URL you recognize maybe the HTTP
slash slash that is always used in
websites so basically you have web
addresses that you can communicate with
and they return data that you want in
this case London UK is in the web link
and then you get response now most apis
they also use an API key to uh access
their API so there might be just public
calls so without API key but for most
actions like in Twitter posting a tweet
or Reddit posting a new Reddit post or
any other social media action they most
likely use an API key which you need to
get to interact with the
API hi are you ready to start coding
with python you might have already run
some python
programs but today we're going to talk
about a special tool called a python IDE
or a development
environment an IDE is a special tool
that makes python coding um easier and
more
fun so what is this IDE stuff all about
or why would you use it an IDE stands
for integrated development environments
now a lot of complex words but basically
it's a software app or just an app that
lets you write python codes and it's a
special app because it makes writing
python codes
easier so you can use an IDE if you want
to write code faster and with fewer
mistakes and it has all kind of uh
tricks to make you make less mistakes
and make programming
easier so what is an python IDE it's a
special kind of app or special kind of
software to write and run python codes
just like um if you if you would to draw
something you might have a drawing
notebook where you put your drawings if
you write things you might have a
special notebook for your stories and a
python IDE is like a special notebook
for writing code it's it's more than a
text editor because a text editor is
just black and white screen for example
notepads and and you can just type code
there but it's not really made for
writing codes it's it's the wrong tool
for the
job just
like when when you have a car wheeel you
can't use it on a bicycle or maybe you
can but it's not very practical and so
there are special software created for
programming and those are python idees
so many different programs for that and
we'll take a look at some of these
programs and you'll see some of them on
the screen here like spider um pie charm
which is a very popular one you have
Eclipse here anaconda and many different
um
idees now one of the simple idees is
Idol it usually comes with python so
it's a very simple IDE you can use this
Idol program to write and run codes as
you see on the right there that person
wrote some code here and it cost some
output so you you can use it and you'll
see it also has some coloring here so it
makes it a bit easier to read than just
black and white
screen so Idol is a great choice if you
are just starting out with python and
want to just try out some simple codes
if you want to make more complex
programs that as we are doing in this
course then you are better off
downloading some other IDE for example
this studio codes and or any of the
others
that supports many more features so
visual studio code is another IDE you
can use it to write python code this
also available for free so all of these
idees are available for free you can
download them from the Internet and try
them out on your own and see what do you
like most so this one has a lot of
features it has this coloring feature
again called syntax highlighting so
depending on the function of the code
has different colors
um it can work with multiple files you
can see you can plot inside the IDE as
well and overall it's just a very nice
tool for writing code but there are many
idees available so it really depends on
what you
prefer so when you choose an ID think
about what you use it for is it very
very simple maybe idle is enough but
more complex programs could be Visual
Studio codes or pyth charm or any of the
other programs you can try them out on
your own because you can download them
for free and it really depends on your
own
preferences but what whatever IDE you
choose you're on your way to becoming a
great python coder and have fun happy
coding
what is a Reddit bot a Reddit bot is a
computer program that
performs actions automatically on the
website Reddit just like you and me my B
can read posts make comments and even
post new things on Reddit it can be text
posts but also link posts the cool thing
about Bots is that it can do all of that
really fast 24 hours a day and without
getting tired so it's a computer program
in this case a Python program that
interacts with website Reddit social
media website and then can do
automatically do things like make posts
make comments and post new things read
posts basically whatever you would do U
as a user on the social media
platform we need Reddit Bots because
they can save us time and they can help
us do a lot of things uh without us
having to do it ourselves for example a
b can keep track of new post about a
certain topic and send us an email when
there's a new one or a bot can
automatically post a message to say
hello whenever someone joins a certain
Reddit group so such kind of tasks would
be very tiring if we were were to do it
manually it would basically be a day job
so a bot a robot computer robot can
automatically do that so with our Reddit
bot you can save a lot of time and make
a lot of cool things happen on the
social media Network
reddits you can make also things a lot
easier for yourself if you have your own
subreddit and you want to automatically
post maybe one or 10 or any amount of
Reddit posts to your reddits to your
subreddits then the bot can do that for
you we are going to use a building block
called PR aw
that's a python library that makes it
easier to create a Reddit bot so the pr
Library makes it easier for creating
Reddit Bots with python it's python
specific so what does this P aw stand
for it's the python Reddit API wrapper
so basically it's a building block for
making Reddit bots in
Python and it has a lot of cool tools
that we can use to make our bot do
whatever we want it to do
the first thing to do is to install the
PW library or package into your computer
to do that you can use the standard
python package manager
pip um and you can just run that command
or in your uh programming environment
install the PW package and once you have
it installed you can use it inside your
code to use it you just type import PW
and that then you will have the whole
Reddit um B Library available in your
python
code before we start creating our Reddit
bot we need to create a Reddit app this
is a special tool that will help connect
our bot to Reddit and do some things
there so that is an absolutely required
step and it's also very easy step so you
can do this by going to the Reddit
websites and following some simp
steps so basically you need to give your
app a name and then select that you want
to script and then click create app then
you will have created our Reddit
app once we have our Reddit app set up
you can then start using it to get
information from Reddit so you would
need to copy your client ID and the
client secret from your Reddit app and
then you will need those two to make the
communication between your python code
and the reddit
website so the two values are listed
there client's ID and client secret and
then you would paste them in your codes
so you would say client ID is the client
ID you just copyed so replace this and
the client secret you would replace
this then you are able to use the uh p p
w module and communicate with the Reddit
using the Python programming
language so you can log into to
Reddit you can get data from Reddit from
any subreddit and for example this would
get um five uh items from the subreddit
Learn
Python you can do something with the
data for example uh you can output it
and show a certain score so this would
be terminal
output um so you can get data just like
on a reddit website you can read data
your Bot can read data from Reddit as
well you can add many more features with
the PW librar for example responding to
comments posting new submissions or
automating uh some tasks that you
have now posting to Reddit is very easy
Once once you have those things done
already so once you have the uh client
ID client secret you are logged in you
have already created an App then you can
just post the Reddit using the function
called submit so specify your
subreddit then submit your title and
your text and once you run it it will
automatically post to Reddit using the
python code and then you can post as
many times as you want um
and this could be like the basic of your
Reddit bot right so once you start your
Bot or maybe your Bot is running forever
and every 24 hours make some automatic
post so that's it I hope you learned a
lot about Reddit Bots and that you can
now try your own try to create your own
Reddit bot using the PW
Library who knows maybe you'll be the
one on creating the next schol Reddit
bot have fun and happy
coding hi there we're going to learn
about Twitter bots so a Twitter bot is a
special kind of computer program that
post messages on Twitter all by itself
that's pretty cool isn't it to make a
Twitter bot we need to use some
something called a Twitter
API or application program
interface API is a way for us to talk to
Twitter and ask it to do things like
posting a message to
Twitter but you don't have to worry
about all the
complexity it's a simple way to
communicate with other
software so the first thing you need to
do is to create a Twitter
app or a Twitter developer account if
you don't have a Twitter account yet you
should create it then create the Twitter
developer account and create a new app
that will give you so-called API Keys
API keys let you communicate with the
Twitter software or the Twitter
website once you have that you can write
you can use twey a Pyon module to write
code for your Twitter
bot to talk to
Twitter and so
let's talk about
twei so what is twei twei is a python
module library or package however you
want to call
it that lets you make your Twitter bot
it's like a big box of tools that makes
the job easier you don't have to worry
about whatever Twitter is doing you just
can communicate directly with the
Twitter software saying I want to tweet
and it will tweet to your Twitter
timeline so with twey you can talk to
the Twitter API without having to worry
about all the hard stuff or with any API
for that
matter so let's install the twey module
the way to install it is just typing pip
install twey so you open a
terminal and then you
type and press enter that's installs
tweet P to your computer so that's it
you just use the P package manager the
python package manager to inst Sol it so
it could be in this way if you use an
IDE like py charm you need to do it
inside the
IDE but it is that easy now that you
have twey you can start making to make
your Twitter bot you just have to write
a little bit of code and then your
Twitter Bots will be ready to
go
so here's what the basics might look
like you need to put your API keys so
you can get all of these from your
Twitter app and in here then uh you load
the twey of course the module you need
to authenticate so this is all the
standard code what you need to do is to
replace all these values that you can
get from the Twitter website so if we
look you slides
back you'll see we need to go to the
Twitter developer site to create a new
app and then you can get the API keys
that you see here you need those keys in
your codes and then you'll paste them in
here
so that is what it might look like then
uh you are connected with Twitter so you
can uh create a new API object and start
to post to Twitter with the function
update status and then whatever text you
want to put onto Twitter and it will
then automatically do
it so that's
it now this is the full an example of
what the full program might look like um
so now you have a Twitter bot that can
post messages on Twitter all by itself
cool right but one thing to keep in mind
is that once you register on Twitter for
the um to create an app it might take
some time because they review uh whether
you're using it for legal
purposes well that sums it up for the
Twitter app so if we go back a few
slides these are the actual steps that
you need to do to create a Twitter app
and I showed you the code on the last
slide
um so thanks for watching I hope you
learned a lot about Twitter Bots and how
you can use the Tweet Pi Library so make
your own Twitter Bots bye for now