aj-4 / ig-followers

see who unfollowed you with python
199 stars 132 forks source link

i fixed it i can send it to your email if u want to #7

Closed ssdas closed 4 years ago

ssdas commented 4 years ago

i added a option so u can enter ur name and pass in console

a6du1h4q commented 4 years ago

Can you send me please...?

keval170 commented 4 years ago

Can you send me ? k.patoliya001@gmail.com

mrcriciman commented 4 years ago

Can you send me please? avstylefit@gmail.com

jazzi57 commented 4 years ago

My email is Rockyp2007@hotmail.com please send it to me

ssdas commented 4 years ago

from selenium import webdriver from time import sleep ime = (input('Input username: ')) pw = (input('Input pass: '))

class InstaBot: def init(self, username, pw): self.driver = webdriver.Chrome() self.username = username self.driver.get("https://instagram.com") sleep(2)

    self.driver.find_element_by_xpath("//input[@name=\"username\"]")\
        .send_keys(username)
    self.driver.find_element_by_xpath("//input[@name=\"password\"]")\
        .send_keys(pw)
    self.driver.find_element_by_xpath('//button[@type="submit"]')\
        .click()
    sleep(4)
    self.driver.find_element_by_xpath("//button[contains(text(), 'Not Now')]")\
        .click()
    sleep(2)

def get_unfollowers(self):
    self.driver.find_element_by_xpath("/html/body/div[1]/section/nav/div[2]/div/div/div[3]/div/div[4]/span/img")\
        .click()
    sleep(2)
    self.driver.find_element_by_xpath("//a[contains(@href,'/following')]")\
        .click()
    following = self._get_names()
    self.driver.find_element_by_xpath("//a[contains(@href,'/followers')]")\
        .click()
    followers = self._get_names()
    not_following_back = [user for user in following if user not in followers]
    print(not_following_back)

def _get_names(self):
    sleep(2)
    scroll_box = self.driver.find_element_by_xpath("/html/body/div[4]/div/div[2]")
    last_ht, ht = 0, 1
    while last_ht != ht:
        last_ht = ht
        sleep(1)
        ht = self.driver.execute_script("""
            arguments[0].scrollTo(0, arguments[0].scrollHeight); 
            return arguments[0].scrollHeight;
            """, scroll_box)
    links = scroll_box.find_elements_by_tag_name('a')
    names = [name.text for name in links if name.text != '']
    # close button
    self.driver.find_element_by_xpath("/html/body/div[4]/div/div[1]/div/div[2]/button")\
        .click()
    return names

my_bot = InstaBot(ime, pw) my_bot.get_unfollowers()

ssdas commented 4 years ago

here u go guys

ssdas commented 4 years ago

Can you send me please...?

here

ssdas commented 4 years ago

@echo off color a echo starting the program cd C:\Users\38760\Desktop\insta python insta.py echo program started btw if u want ur script to work ur selenium driver has to be in the same folder as ur script

here is a simple .bat file for easy access