Advertisement
Guest User

instabot

a guest
Jun 23rd, 2018
1,573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. # Main.py
  2. # Ashish D'Souza
  3. # June 22nd, 2018
  4.  
  5. import instaloader
  6. from datetime import datetime
  7.  
  8. username = "computer_geek64"
  9. password = "Tech$mart101"
  10. filename = "C:/Users/skillsusa/Documents/Python/PyCharm/com/ashish/projects/Instagram/no_follow_back_list.txt"
  11. instagram = instaloader.Instaloader()
  12.  
  13. instagram.login(username, password)
  14.  
  15. profile = instaloader.Profile.from_username(instagram.context, "computer_geek64")
  16. followers = list(profile.get_followers())
  17. followees = list(profile.get_followees())
  18. no_follow_back = []
  19.  
  20. for i in range(len(followees)):
  21. if followees[i] not in followers:
  22. if followees[i].followers < 3000:
  23. no_follow_back.append(followees[i].username)
  24.  
  25. print("Current list of followees who have not followed back:")
  26. print(no_follow_back)
  27.  
  28. no_follow_back_list = open(filename, "r").readlines()
  29. for i in range(len(no_follow_back_list) - 1, -1, -1):
  30. if datetime.now().timestamp() - float(no_follow_back_list[i].split(" ")[1]) > 86400.0:
  31. print("Expiration reached for followee " + no_follow_back_list[i].split(" ")[0])
  32. no_follow_back.remove(no_follow_back_list.pop(i))
  33. elif no_follow_back_list[i].split(" ")[0] not in no_follow_back:
  34. no_follow_back_list.pop(i)
  35. else:
  36. no_follow_back.remove(no_follow_back_list[i].split(" ")[0])
  37.  
  38. for i in range(len(no_follow_back)):
  39. no_follow_back_list.append(no_follow_back[i] + " " + str(datetime.now().timestamp()))
  40.  
  41. with open(filename, "w") as file:
  42. file.writelines(list(map(lambda x: x.strip() + "\n", no_follow_back_list)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement