You are on page 1of 1

!"#$%&'()*'#+ !"#$%&&%'()* +,%-. $%&&%' /2>:#2: Y(.#*.1).

(;

9<,&>%-3*'-,?
6-:2%)#+).232C21&
4:.(&&2>(:C(
H:>2:(()9#I1:.)2F

$%&&%'
,&-.+#-/(0.&1(2.+3&-/1(%.1
4#2/5..6(2.++/7-
MX
/0123-&#4*&15 6-&#789#7878 · 7#52:#)(1;

<%=()#251>(#3)%5#0..?*@AA'1&&01=(:BCCA

Automation is sexy. It just getting sexier with python…

This article will explain the step by step procedure of building a python
script which will automatically comment in a FB post. Make sure that you
are not spamming or harm anyone with this python script.

!"#"#$%&'&(#)
You will be required to install Python 3.6 or above on your PC or laptop.
Here are the list of libraries you’ll be required to install —

1. pyautogui — This is a library which has functions to interact with


Graphical User Interface(GUI)

2. Time — Used for giving diOerent delays between executions

*+'(,--,(&.+)
Considering you’ve already installed Python 3.6 or above on your PC or
laptop. In this part, I’m going to explain only the installation of pyautogui.

/&+0.1')
On Windows, it is much easier to install and use the PyAutoGUI. On
windows, you can install it from the PyPI using pip if you have pip installed.

pip install pyautogui

2'34)
On Os X, you need to install some extra modules to be able to run
PyAutoGui.

pip3 install pyobjc-core


pip3 install pyobjc
pip3 install pyautogui

5&+%6)
On Linux, You may have to install some packages.

pip3 install python3-xlib


sudo apt-get install scrot
sudo apt-get install python3-tk
sudo apt-get install python3-dev
pip3 install pyautogui

7#((&+839(,"(#0)
First, you've to import the necessary packages. In this script, we’ll import
two necessary packages.

import pyautogui
import time

Now, We’ll make a python list where we will store all our comments. I’m
storing some questions on the comments variable. You can make your list as
your own interest.

comments = ["Hello", "This is a bot", "This comment is being


generate automatically", "Isn't it cool?", "What do you think?", "A
simple python script for autocomment", "Hola", "Konnichiwa", "Ohayo
gujaimas"]

Now we’ll set a timestamp for delaying 5 seconds so that in the meantime
we can set our cursor on the desired point.

time.sleep(5)

Finally, we’ll execute a loop so that all the comments in the list will
automatically post as a comment serially on Facebook.

for i in range(len(comments)):
pyautogui.typewrite(comments[i])
pyautogui.typewrite("\n") # For pressing the Enter button
time.sleep(3)

In each iteration, we’ll delay a minimum of 3 seconds so that Facebook


doesn’t recognize us as automated bot. If you don’t delay between diOerent
iteration your Facebook ID may have blocked by authority.

That’s all. Now just run/execute the script and put your cursor on the
Facebook comment box within 5 seconds after running the script. It’ll
automatically start commenting on this post.

For the full script, visit my github link.

:;.%(3(<#3:%(<.")
Shaiful Islam is a Data Science Enthusiast. Currently, working as a Junior
Arti<cial Intelligence Programmer at Zantrik. Follow me on LinkedIn,
Facebook, and Twitter

MX#

DE.0%: /C)2?. +-.%51.2%: $1C(,%%F#<%55(:.* G%.*

=."#3>".?39<,&>%-3*'-,? $%&&%'

6-:2%)#+).232C21&#4:.(&&2>(:C(#H:>2:(()9#I1:.)2F

6-&#JK9#7878

!ডটা(সাই'(ও(!মিশন(লা.ন/ং(ক2ািরয়ার(5র6র(পথ8
িনেদ;িশকা
পৃিথবীেত এ পয+, যত -ডটা 1তির হেয়েছ তার ৯০% 1তির হেয়েছ 8ধ: মা< গত ২ বছের।
িবে?র বড় বড় AিতBান এখন অেনক -বিশ তথH 1তির করেছ। AিতBানIেলা চাইেছ এসব
তথH িবেNষণ কের কােজ লাগােত। ফেল -ডটা সােয়েS িবেশষT কমীUর চািহদা বHাপক
আকাের বাড়েছ। আমার XY Tানভা[ার -থেক িকছ: িরেসাস+ সহ -ডটা সাইেS কHািরয়ার
8র\র পথ-িনেদ+িশকা আপনােদর সামেন উপ^াপন করিছ। সেব+াপির আিম
িজিনসIেলােক ৩ ` ভােগ ভাগ কেরিছ।

জুিনয়র3@১ম3ও3২য়3বেষ.র3জন/A
-য -কান এক` -Aাaািমং লHাcুেয়েজর -বিসক -শষ কের Aেeম সিfং এ -নেম পেরন। 8র\র
জনH URI, Hackerrank িনেজেক যাচাই ও দhতা এiাই করার জনH, Codeforces,
Codechef, Topcoder সতর্কতাঃ এখা-ন Aথেম আপনার অেনক kােlশন আসেব।…

L(1;#5%)(#·#7#52:#)(1;

M!

=."#3B".?3=#0&%?

C.(-&+30&-#??,) 9(,(&E3F'G3HI+,?&E K.13(.3*+'(,--3,+0 !".8",??&+831&(<39(,(#)


D6(#+'&.+3."3=#?;#" 5&;","&#'3&+3J =,+,8#3=%-(&L-#3!I(<.+ J.+E%""#+EI
N1)*01;#O1'1.0(#2:#P0( Q(*C%..#/01)?&(*
M#"'&.+'3.+35&+%6 611FF%#T1:>1*01)U-#2:#P0(
/.1).-? R1=2;#S2..&(32(&; /.1).-?

J.+(,&+#"'3F'G39#"F#"-#'') K,??&+83J.0# H#F#-.L&+83,39#"F#"-#'' C%;#"+#(#'39#"F&E#' T 


/<&E<3.+#3I.%3'<.%-0 7#+#",(&.+3Q3J.""#E(&.+ R,ES#+03:!*3%'&+83B-,'S !,"(3U
E<..'#3&+3NONOP @1&(<3#6L-,+,(&.+'3%'&+8 /%-)1,0#W%F01*2#2:#P0( /1:;((?#G1&;1'1#2:#P0(
D)13-&#R01,(F1)#2:#R(=V?*
J3E.0#'A /.1).-? /.1).-?
R-;(* 4*-)-#D15-;2.01#2:#P0(#/.1).-?

+,%-. N(&? S(>1&

You might also like