File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ from selenium import webdriver
2
+ from webdriver_manager .chrome import ChromeDriverManager
3
+ from selenium .webdriver .common .keys import Keys
4
+ from getpass import getpass
5
+ import time
6
+
7
+ chrome = webdriver .Chrome (ChromeDriverManager ().install ())
8
+ chrome .get ("https://www.instagram.com" )
9
+ time .sleep (10 )
10
+
11
+ username = chrome .find_element_by_xpath ('//*[@id="loginForm"]/div/div[1]/div/label/input' )
12
+ username .send_keys (input ("Enter your username: " )) #enter username
13
+ print ("Enter your Password: " )
14
+ password = chrome .find_element_by_xpath ('//*[@id="loginForm"]/div/div[2]/div/label/input' )
15
+ pswd = getpass ()
16
+ password .send_keys (pswd )
17
+ login_button = chrome .find_element_by_xpath ('//*[@id="loginForm"]/div/div[3]' )
18
+ login_button .click ()
19
+ time .sleep (10 )
20
+
21
+ search_bar = chrome .find_element_by_xpath ('//*[@id="react-root"]/section/nav/div[2]/div/div/div[2]/input' )
22
+ search_bar .send_keys (input ("Enter the username of the other person: " )) #enter the username to be searched
23
+ time .sleep (7 )
24
+ search_bar .send_keys (Keys .ENTER )
25
+ search_bar .send_keys (Keys .ENTER )
26
+
27
+ time .sleep (2 )
28
+
29
+ post = chrome .find_element_by_xpath ('//*[@id="react-root"]/section/main/div/div[3]/article/div[1]/div/div[1]/div[1]/a/div[1]/div[2]' )
30
+ post .click ()
31
+ time .sleep (2 )
32
+ like_button = chrome .find_element_by_xpath ('/html/body/div[5]/div[2]/div/article/div[3]/section[1]/span[1]/button' )
33
+ like_button .click ()
34
+ next_button = chrome .find_element_by_xpath ('/html/body/div[5]/div[1]/div/div/a' )
35
+ next_button .click ()
36
+ time .sleep (2 )
37
+
38
+ while True :
39
+ try :
40
+ like_button = chrome .find_element_by_xpath ('/html/body/div[5]/div[2]/div/article/div[3]/section[1]/span[1]/button' )
41
+ like_button .click ()
42
+ next_button = chrome .find_element_by_xpath ('/html/body/div[5]/div[1]/div/div/a[2]' )
43
+ next_button .click ()
44
+ time .sleep (5 )
45
+ except :
46
+ close_button = chrome .find_element_by_xpath ('/html/body/div[5]/div[3]/button' )
47
+ close_button .click ()
48
+ break
Original file line number Diff line number Diff line change
1
+ What is the use:
2
+ Given a username if the Instagram account is public or the posts are accessible to the operator, will auto-like all the posts on behalf and exit.
3
+ Instructions to use:
4
+ 1. Once we run the program, web driver will start the default browser under automated software (here we use chrome).
5
+
6
+ 2. Then it will ask for the username and password for the account that will be used to give the likes.
7
+
8
+ 3. Then it will automatically go to the search bar, and ask for the username of the person whose post you want to like.
9
+
10
+ 4. After pressing enter, it will automatically open the Instagram account of the user and keep liking every available uploaded post.
11
+
12
+ 5. Once done, it will close the posts itself.
13
+
14
+ Side note:
15
+ If you are using some other web browser, replace ‘chrome’ by the name of that browser
16
+ Modules and tools used:
17
+ Selenium, getpass and time
18
+
19
+ Development status: This is a complete version and the future version might function in adding auto-comments as well
20
+
21
+ BY SAYANTANI SAHA
You can’t perform that action at this time.
0 commit comments