forked from jaguar754/instabot.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunfollowpub.py
53 lines (40 loc) · 1.05 KB
/
unfollowpub.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from instabot import InstaBot
from userinfo import UserInfo
import time
import random
#use userinfo
ui = UserInfo()
ui.search_user(user_name="login")
#take following
ui.get_following()
following = ui.following
#take followers
ui.get_followers()
followers = ui.followers
#favorite id list
favorites = ['111','222','333']
#some lists
newlist = []
endlist = []
followerslist = []
#get following id
for item in following:
newlist.append(item['id'])
#get followers id
for item in followers:
followerslist.append(item['id'])
#create final list with followers
endlist = set.difference(set(newlist), set(favorites), set(followerslist))
#create final list without followers
'''
endlist = set.difference(set(newlist), set(favorites))
'''
#use instabot
bot = InstaBot('login', 'password')
print ('Number of unnecessary subscriptions:',len(endlist),'\n')
for items in endlist:
rnd = random.randint(1,16)
bot.unfollow(items)
print ('Wait',30+rnd,'sec')
time.sleep(30+rnd)
print ('All done.')