-
Notifications
You must be signed in to change notification settings - Fork 0
/
instaunfollow.py
37 lines (25 loc) · 1.17 KB
/
instaunfollow.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
from config import L, user_profiles
def dont_followers(chat_id):
profile_list_dont_followers = []
followers = []
following = []
for follower in user_profiles[chat_id].get('profile_data').get_followers():
followers.append(follower.username)
for followees in user_profiles[chat_id].get('profile_data').get_followees():
following.append(followees.username)
for profile in following:
if profile not in followers:
profile_list_dont_followers.append(profile)
return profile_list_dont_followers
def update_followers(chat_id):
updated_dont_followers_base = []
new_nonfollowers_base = []
if user_profiles[chat_id].get('base') != None:
updated_dont_followers_base = dont_followers(chat_id)
for profile in updated_dont_followers_base:
if str(profile) not in user_profiles[chat_id].get('base'):
new_nonfollowers_base.append(str(profile))
user_profiles[chat_id].update({'base' : str(updated_dont_followers_base)})
else:
user_profiles[chat_id].update({'base' : str(dont_followers(chat_id))})
return new_nonfollowers_base