← yazılara dön

❯ cat finding-instagram-un-followers-with-python.md

Finding instagram un-followers with Python

1 dk okumatr#Python
import instaloader
from instaloader.exceptions import TwoFactorAuthRequiredException
username="username"
password="password"
L = instaloader.Instaloader()
try:
    L.login(username, password)
except TwoFactorAuthRequiredException:
    # 2-FA factor
    #L.two_factor_login(209333)
    profile= instaloader.Profile.from_username(L.context,username)
#takipciler aliniyor
for followers in profile.get_followers():
    with open('followers.txt','a+') as f:
        file= f.write(followers.username+ '\n')
    print(file)
#takip edilenler aliniyor
for followees in profile.get_followees():
    with open('followees.txt','a+') as f:
        file2= f.write(followees.username+'\n')
    print(file2)
#takip etmeyenler bulunuyor
followers_file= set(open('followers.txt').readlines())
followees_file= set(open('followees.txt').readlines())
unfollowers_set = followees_file.difference(followers_file)
for unfollowers in unfollowers_set:
    print(unfollowers)