馃攳
Instagram automation with 10 lines of python code | Python Instagram BOT - YouTube
Channel: codebasics
[2]
baby Yoda's demand has been increasing
[4]
last time he asked me to write
[6]
bitcoin mining code in 15 lines of
[8]
Python
[9]
today's latest demand is to write
[13]
automating Instagram in Python in less
[15]
than 10
[16]
lines of code
so in this video we will
[19]
be
[20]
uploading an image following someone
[23]
getting a list of followers in Instagram
[26]
using Python so this is Instagram
[28]
automation using Python let's get
[30]
started
[32]
i'm super active on Instagram you see
[34]
that I have three post and 66
[36]
followers so i'm going to automate this
[38]
particular account using Python
[41]
I open here Pycharm which is
[44]
a free editor for Python you need to
[47]
also
[48]
download the Python okay so you install
[50]
Python on your computer
[51]
and after you do that, go to Google and
[55]
type in
[56]
Python Insta board so python Instaboard
[58]
is the module we are going to use to
[60]
interact with Instagram
[62]
and if you open that link you will get
[65]
this command to install it so just copy
[67]
this
[68]
pip install Insta board and
[71]
copy paste this command, and it's going
[73]
to install it.
I have already installed
[75]
it so it will say
[76]
it's already installed doesn't matter
[79]
now it is installed
[80]
so i will start writing code.
Now, before
[83]
I do that
[84]
here on this page they have given
[88]
examples.
So if you open the example
[89]
links you will find
[91]
many examples you can do so many things
[93]
I'm just going to show you some basic
[95]
stuff
[96]
so now let's move on to my
[101]
Instagram and here I'm going to increase
[103]
the font size
[104]
and also I am going to go into
[108]
my Zen mode
you know I want to
[111]
meditate
here is how I meditate
[115]
so first install
or import actually
[118]
from Insta bot import board
[121]
so this is type of a bot that is
[124]
interacting with
[125]
Instagram okay and i will create an
[129]
instant of
[129]
a bot here
and I will say bot dot
[133]
login
[136]
and here just specify your username and
[139]
password.
So my username is
[144]
so just specify that as an
[148]
argument
[153]
and the first thing i'm going to do is
[155]
what do you do usually with Instagram
[156]
we'll upload pictures
[157]
yes, so bot dot upload
[161]
photo
and here you will specify the
[164]
photo
so in my folder here
[166]
I have a cute biscuit eating Yoda
[170]
so I will upload that okay so yoda.jpg
[175]
yoda.jpg
[180]
and you can specify caption here
[183]
cute biscuit
[187]
eating Yoda
[195]
okay?
well
[198]
let's run this code and see what happens
[201]
so right click
[202]
run.
So it is
[206]
trying to log in here
so it will take
[208]
some time
few seconds
[210]
it will log in and after it's logged in
[213]
it will just
[217]
upload.
See this is probably the image
[219]
dimension
[221]
and it will try to upload it take some
[224]
time but finally the photo is uploaded
[226]
let me go back
[227]
to my profile and check what happened so
[230]
here's my profile
[233]
refresh my picture
is uploaded cute
[236]
biscuit eating Yoda
all right
[238]
so this is how you upload a picture now
[241]
I am following
[242]
only one person so I want to follow
[245]
let's say whom I want to follow
[247]
well maybe Elon Musk.
you know,
I want to
[250]
know when he's sending
[252]
humans to Mars so Elon R Musk
[255]
okay so let me follow him
[258]
and it's pretty easy see
that's a
[261]
cool thing with Python you write
[262]
just one line of code you just say bo bo
[265]
dot
[266]
follow whom do you want to follow Elon
[270]
R Musk okay
[275]
I'll just remove this code okay so now I
[276]
want to follow Mr
[278]
Elon Musk so just run the
[282]
command again
few seconds wait
[286]
let's see
[290]
Hooray
I'm following Elon R Musk
so if
[292]
you have
[293]
let's say 20 celebrities you want to
[295]
follow and you are
[296]
you don't want to do all the hard work
[298]
to type in their name and click on
[300]
the following button then just write a
[302]
Python code for it
[303]
super easy.
how do I send messages by the
[305]
way to
[306]
people.
So I have
[310]
So I have let's see I have this
[314]
followers people you know okay
[317]
mr smart 1k is my buddy Mr Smart 1k I'm
[321]
going to send you a message using python
[325]
and I will also send a message to my
[327]
other profile which is by
[329]
the way code basics hub
[332]
so Instagram so if you look at
[335]
CodeBasics up this is the profile for
[338]
my channel
[338]
so I will send a message to this
[341]
as well so I will just say bot
[345]
don't send a message
see it's so English
[347]
like send a message
[352]
send a message hi from
[355]
baby Yoda you can see how obsessed I am
[359]
with
[360]
baby Yoda so Mr Smart 1k
[365]
is one account and then code basics
[368]
hub is the another account and just run
[371]
it
[371]
and it's gonna send a message to them
[375]
okay looks like it sent a message
[379]
let me check it out so I go here
[383]
I go to not now you see
[387]
you see it's handed it's real it works
[389]
hi from baby Yoda I see two people
[392]
you want to send a group message to 10
[393]
people yeah sure Python code
[396]
see python is so powerful I want to get
[399]
a list of
[400]
all my followers and print it here so
[402]
who are my followers well
[404]
so if you go to my profile again so this
[408]
I have 66 followers you see how famous I
[411]
am
[412]
and I want to print their name or
[415]
their tagline whatever
[418]
so again bot dot get
[422]
user followers so when you do user
[426]
followers by the way there is
[428]
get followers as well it will get you
[430]
the followers of the current profile
[432]
but if you do user followers it you can
[435]
type in name you know
[436]
so I have my account
[439]
name is Dhaval says if you do Elon R
[441]
Musk it will get you
[443]
all the followers of Mr Elon
[446]
okay so followers and I want to
[451]
see like who those followers are
so what
[454]
I do
[455]
is usually okay now I need to come out
[457]
of my meditation so
[459]
exits and more and I need to put a break
[462]
point here
[463]
just to see you know what happens and
[465]
right click and debug so when you do
[466]
debug
[467]
I have this habit of doing debug so that
[469]
at least I know what kind
[470]
of object I am getting back and it's a
[473]
list
[473]
of strings so these are the ids
[478]
of those users okay
so see 66 of them
[482]
and if you want to get their let's say
[485]
name so
[486]
I can say for follower in followers
[490]
okay follower
in followers print
[495]
I can do both dot get
[498]
user info
get user
[502]
info okay and
[506]
so you can get user info of these
[510]
followers and when I right click run it
[514]
it's gonna print a lot of stuff by the
[516]
way
[517]
you see just printing all this
[521]
so I stopped the execution but you see
[523]
username is too smart one
[525]
Zalak Chauhan Yogi whatever Vishal Patel
[529]
so you see all those guys here
[540]
so you see that profile pic you see
[545]
actually you see lot of useful
[547]
information
[551]
if it is your age and you want to retire
[553]
you can also say
[554]
board dot unfollow everyone.
if you do
[557]
this
[557]
you're gonna fall unfollow every single
[560]
person in your profile
[562]
I hope you like this there are many
[564]
examples I just showed you
[566]
few important things but if you go to
[569]
this page i'm gonna link
[571]
this page in a video description below
[573]
you will find
[574]
so many examples you can do so many
[576]
things with Instagram
[578]
one caveat you need to remember is and
[580]
that's what is mentioned on this project
[582]
page
[583]
is...
so see
[587]
right now the uses of this library may
[589]
harm your Instagram profile because of
[590]
the new script detect algorithm
[593]
whenever there is any bot or web
[595]
scraping software
[596]
the websites which is like Instagram or
[598]
Facebook they don't like
[600]
boats accessing the software they want
[602]
humans to use their platform
[604]
for that reason they deploy this script
[607]
detection algorithm so if you are using
[609]
this script
[609]
make sure you don't overuse it otherwise
[612]
it will affect your profile
[614]
and you have to be mindful about the
[616]
implications of using boards for
[618]
any software i have a complete playlist
[622]
of
[622]
these kind of cool apps which you can
[624]
write in 10, 20 lines of python code
[626]
check it out in the video description
[628]
below i have a video on how you can mine
[630]
bitcoin
[631]
only by writing 15 lines of code
[634]
and if you have any comments post in a
[637]
video comment below
[646]
he has come up with a new demand already
[648]
so you have to make a guess
[650]
on what the demand is and what you want
[653]
me to write
[654]
some cool stuff you want me to write in
[656]
python in very less lines of code
[659]
post that suggestion in video comment
[660]
below and I will try to make a video on
[663]
it
[664]
and make my little cute baby happy
Most Recent Videos:
You can go back to the homepage right here: Homepage





