A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week

Introduction

This is the second in a series that uses Python with impure motives. The previous (first) article also touched on Python, so if you haven't seen it yet, please take a look.

This time, SNS has a tremendous number of users all over the world including teens in Japan. I worked to fulfill the simple and clear desire to increase followers on Instagram.

For those who like Instagram

** "I have this many followers," **

With a yellow voice

"great"

I'm likely to be told.

Do you want to be told? However, my face is also cool, and it's annoying to go around the spots that look good on Instagram. .. .. ..

It is an impure motive again. It's a very simple program, but I've made it so I'll introduce it.

It took about 3 hours to make it **

I've never used selenium, but it's easy because I made it right away.

What are the conditions for increasing followers on Instagram?

If you have the potential of a celebrity or something in the first place, you might get it by face, style or original name recognition. If you don't meet the conditions like me, you can't do it normally.

I think there are some points for such ordinary people to increase their followers. This is far from the main program,

** ・ Easy-to-understand profile design ・ Follow the post hashtag of the same attribute user and like ・ Enriched content ・ Promote mutual follow-up of the same attributes **

I think this is about the number of ordinary people.

** I also wanted proof that anyone could increase it, so I experimented with an account that I would never follow. ** **

This time, we will specialize in encouraging mutual follow-up.

Account settings and prerequisites

Speaking of the condition that anyone can increase and the account that I would never follow?

That's right!

** It is an account that seems to sell faceless information products that are not beautiful! !! ** **

"Vending" "Rights income" Such

This is the attribute I hate the most.

We will create and operate such an account.

Technology used

Python only. I will not give it to the server.

The editor is VS.

Only this

This is the actual account

You will be happy. Click here for the actual account.

https://www.instagram.com/truthhack/

It will be a wonderful workmanship. Thank you very much. The image has pulled the photos posted by rich people overseas.

When I saw it now, my followers were a little off. If you do it continuously, it will increase a little more.

Necessary preparation to move

Anyone looking at this article will have what they need

** PC, editor and Instagram account. ** **

Only this.

I will actually write when I am ready

Let's write it because it will actually be released!

Push in the required modules

The following modules are used, so if you haven't installed it, just type pip install (module name) and it will be pretty lol

filename.py


import time
from selenium import webdriver
import chromedriver_binary
from bs4 import BeautifulSoup
from selenium.webdriver.common.action_chains import ActionChains

First login

Since you have to log in on the WEB, prepare your login ID and password and enter them to log in to your account.

filename.py


Username = 'Instagram username'
password = 'Instagram password'
#If you change the above ID and password, you can do the same with other accounts, so if you want to increase the followers of other accounts, just change the above.

If you hit the program below, Chrome will start automatically and even log in to the specified account. At this point, if you put it in your account, it's working.

filename.py


chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.implicitly_wait(10) # seconds
#Instagram URL
driver.get("https://www.instagram.com/")

#Enter necessary information such as user name here
el = driver.find_element_by_name("username")
el.send_keys(Username)
el1 = driver.find_element_by_name("password")
el1.send_keys(password)
el.submit()

Transition to the target location

Once in your account, it's time to move to your list of followers. You can click on the recommended account, but since we only recommend new accounts, there is a possibility that it is a zombie account, so go to the followers and list to follow the followers I will. ** * I will leave it to you where to transition. ** **

filename.py


try:
    annual_link = driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[5]/a')
    annual_link.click()
except Exception:
    oter_link = driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[4]/a')
    oter_link.click()
#Click on your followers
annual_link1 = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/header/section/ul/li[3]/a')
annual_link1.click()

Follow me

Let's follow the rest! If you scroll in the middle, the next button will not appear unless you scroll, so scroll it. If you change the number of the for statement, the number of followers will increase, so please change it appropriately.

filename.py


#Click at the beginning of a follower
annual_link2 = driver.find_element_by_xpath('/html/body/div[4]/div/div[2]/ul/div/li[1]/div/div[2]/div[1]/div/div/a')
annual_link2.click()
#Click the follower of the follower
annual_link3 = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/header/section/ul/li[2]/a')
annual_link3.click()
#Scroll
target = driver.find_element_by_xpath('/html/body/div[4]/div/div[2]/ul/div/li[12]')
actions = ActionChains(driver)
actions.move_to_element(target)
actions.perform()
for iyy in range(3,50):
    try:
        inside = '/html/body/div[4]/div/div[2]/ul/div/li['+ str(iyy) +']/div/div[2]/button'
        followButton = driver.find_element_by_xpath(inside)
        followButton.click()
        time.sleep(2)
    except NoSuchElementException as e:
        followButton1 = '/html/body/div[5]/div/div/div[3]/button[2]'
        target = driver.find_element_by_xpath(followButton1)
        driver.execute_script("arguments[0].click();", target)
    except Exception:
        continue

Unfollow

It's the same until you log in to your account. After that, you can rewrite it or create it in a separate file. Let's remove the last person we followed. This should be removed after a period of time. In the future, I would like to make sure that the timing of mutual follow-up is successful.

filename.py


try:
    accept_link = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/div/div/div/button')
    accept_link.click()
except Exception:
    pass

try:
    annual_link = driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[5]/a')
    annual_link.click()
except Exception:
    oter_link = driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[4]/a')
    oter_link.click()

#Click on your followers
annual_link1 = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/header/section/ul/li[3]/a')
annual_link1.click()

#Scroll
target = driver.find_element_by_xpath('/html/body/div[4]/div/div[2]/ul/div/li[12]/div/div[3]/button')
actions = ActionChains(driver)
actions.move_to_element(target)
actions.perform()

for iyy in range(1,201):
    followPeople = '/html/body/div[4]/div/div[2]/ul/div/li[' + str(iyy) + ']/div/div[2]/button'
    annual = driver.find_element_by_xpath(followPeople)
    annual.click()
    time.sleep(2)
    unfollow = driver.find_element_by_xpath('/html/body/div[5]/div/div/div[3]/button[1]')
    unfollow.click()
    time.sleep(2)

print(Username + " " + 'Done!!')

#Finally exit the driver
driver.quit()

from now on

As I mentioned earlier, I'm making another one, so I can't secure time, so it's a hassle. If you would like to work with us, please contact us. Or the same for those who want to participate in another PJ.

Other PJs are making sales support tools for toB. There are 4 people including me.

I would be grateful if you could contact me on the FB below. https://www.facebook.com/kei.nakanowatari

Recommended Posts

A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week
[Python] A program that calculates the number of socks to be paired
[Python] A program that counts the number of valleys
The story of creating Botonyan that returns the contents of Google Docs in response to a specific keyword on Slack
[Python] A program that finds the shortest number of steps in a game that crosses clouds
A story about trying to introduce Linter in the middle of a Python (Flask) project
Now in Singapore The story of creating a LineBot and wanting to do a memorable job
[Python] Programming to find the number of a in a character string that repeats a specified number of times.
[Python] A program to find the number of apples and oranges that can be harvested
The story of writing a program
A story that struggled to handle the Python package of PocketSphinx
The story of creating a site that lists the release dates of books
[Python] A program that rotates the contents of the list to the left
The story of creating a bot that displays active members in a specific channel of slack with python
[Python] A program that calculates the number of chocolate segments that meet the conditions
I made a program to check the size of a file in Python
The story of creating a store search BOT (AI LINE BOT) for Go To EAT in Chiba Prefecture (1)
[AtCoder for beginners] A story about the amount of calculation that you want to know very roughly
A story about trying to improve the testing process of a system written in C language for 20 years
Create a bot that posts the number of people positive for the new coronavirus in Tokyo to Slack
Set the number of elements in a NumPy one-dimensional array to a power of 2 (0 padded)
The story of IPv6 address that I want to keep at a minimum
How to count the number of elements in Django and output to a template
The story of creating a store search BOT (AI LINE BOT) for Go To EAT in Chiba Prefecture (2) [Overview]
Find the number of days in a month
Create a BOT that displays the number of infected people in the new corona
The story of Django creating a library that might be a little more useful
[Python] A program that calculates the number of updates of the highest and lowest records
A story of creating 16 * 16 dots from a Digimon photo
The story of moving from Pipenv to Poetry
A story that failed when trying to remove the suffix from the string with rstrip
A python script that gets the number of jobs for a specified condition from indeed.com
A story about improving the program for partial filling of 3D binarized image data
How to identify the element with the smallest number of characters in a Python list?
The story of Linux that I want to teach myself half a year ago
The story of switching from WoSign to Let's Encrypt for a free SSL certificate
A script that can perform stress tests according to the number of CPU cores
[Python] Representing the number of complaints from life insurance companies in a bar graph
Find a guideline for the number of processes / threads to set in the application server
The story of launching a Minecraft server from Discord
A story that reduces the effort of operation / maintenance
How to get the number of digits in Python
A story about changing the master name of BlueZ
A story about a Linux beginner passing LPIC101 in a week
A story that analyzed the delivery of Nico Nama.
A reminder about the implementation of recommendations in Python
[Python] A program that compares the positions of kangaroos.
I made a program in Python that changes the 1-minute data of FX to an arbitrary time frame (1 hour frame, etc.)
[Python] About creating a tool to display all the pages of the website registered in the JSON file & where it got caught
A server that returns the number of people in front of the camera with bottle.py and OpenCV
The story of creating a "spirit and time chat room" exclusively for engineers in the company
A program that automatically resizes the iOS app icon to the required image size in Python
Summary of points to keep in mind when writing a program that runs on Python 2.5
How to quickly count the frequency of appearance of characters from a character string in Python?
VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
A story that makes it easier to see Model debugging in the Django + SQLAlchemy environment
How to plot the distribution of bacterial composition from Qiime2 analysis data in a box plot
A Python script that allows you to check the status of the server from your browser
I tried to find the trend of the number of ships in Tokyo Bay from satellite images.
A story about porting the code of "Try and understand how Linux works" to Rust
How to find the optimal number of clusters in k-means