Advertisement
Lulz-Tigre

unfollowpub

Jul 6th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. from instabot import InstaBot
  2. from userinfo import UserInfo
  3. import time
  4. import random
  5.  
  6. #use userinfo
  7. ui = UserInfo()
  8. ui.search_user(user_name="login")
  9.  
  10. #take following
  11. ui.get_following()
  12. following = ui.following
  13.  
  14. #take followers
  15. ui.get_followers()
  16. followers = ui.followers
  17.  
  18. #favorite id list
  19. favorites = ['111','222','333']
  20.  
  21. #some lists
  22. newlist = []
  23. endlist = []
  24. followerslist = []
  25.  
  26. #get following id
  27. for item in following:
  28.     newlist.append(item['id'])
  29.  
  30. #get followers id
  31. for item in followers:
  32.     followerslist.append(item['id'])
  33.    
  34. #create final list with followers
  35. endlist = set.difference(set(newlist), set(favorites), set(followerslist))
  36.  
  37. #create final list without followers
  38. '''
  39. endlist = set.difference(set(newlist), set(favorites))
  40. '''
  41.  
  42. #use instabot
  43. bot = InstaBot('login', 'password')
  44.  
  45. print ('Number of unnecessary subscriptions:',len(endlist),'\n')
  46.  
  47. for items in endlist:
  48.     rnd = random.randint(1,16)
  49.     bot.unfollow(items)
  50.     print ('Wait',30+rnd,'sec')
  51.     time.sleep(30+rnd)
  52.  
  53. print ('All done.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement