Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Main.py
- # Ashish D'Souza
- # June 22nd, 2018
- import instaloader
- from datetime import datetime
- username = "computer_geek64"
- password = "Tech$mart101"
- filename = "C:/Users/skillsusa/Documents/Python/PyCharm/com/ashish/projects/Instagram/no_follow_back_list.txt"
- instagram = instaloader.Instaloader()
- instagram.login(username, password)
- profile = instaloader.Profile.from_username(instagram.context, "computer_geek64")
- followers = list(profile.get_followers())
- followees = list(profile.get_followees())
- no_follow_back = []
- for i in range(len(followees)):
- if followees[i] not in followers:
- if followees[i].followers < 3000:
- no_follow_back.append(followees[i].username)
- print("Current list of followees who have not followed back:")
- print(no_follow_back)
- no_follow_back_list = open(filename, "r").readlines()
- for i in range(len(no_follow_back_list) - 1, -1, -1):
- if datetime.now().timestamp() - float(no_follow_back_list[i].split(" ")[1]) > 86400.0:
- print("Expiration reached for followee " + no_follow_back_list[i].split(" ")[0])
- no_follow_back.remove(no_follow_back_list.pop(i))
- elif no_follow_back_list[i].split(" ")[0] not in no_follow_back:
- no_follow_back_list.pop(i)
- else:
- no_follow_back.remove(no_follow_back_list[i].split(" ")[0])
- for i in range(len(no_follow_back)):
- no_follow_back_list.append(no_follow_back[i] + " " + str(datetime.now().timestamp()))
- with open(filename, "w") as file:
- file.writelines(list(map(lambda x: x.strip() + "\n", no_follow_back_list)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement