-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
146 lines (132 loc) · 3.51 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import instaloader
USERNAME='XXXXXXXXXXX'
PASSWORD='XXXXXXXXXXX'
L = instaloader.Instaloader()
L.login(USERNAME, PASSWORD)
FOLLOWERS=[]
FOLLOWING=[]
i_flwng_oth_no_flbk=[]
oth_flwing_me_no_flbk=[]
profile = instaloader.Profile.from_username(L.context, USERNAME)
for follower in profile.get_followers():
FOLLOWERS.append(follower.username)
for followee in profile.get_followees():
FOLLOWING.append(followee.username)
for i in FOLLOWERS:
if i not in FOLLOWING:
oth_flwing_me_no_flbk.append(i)
for i in FOLLOWING:
if i not in FOLLOWERS:
i_flwng_oth_no_flbk.append(i)
with open('./index.html', 'w') as file:
file.write('''<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Insta-Useer-List</title>
<style>
table,
th,
td {
border: 2px solid black;
border-collapse: collapse;
border-radius: 10px;
padding: 15px;
}
</style>
</head>
<body>
<table>
<caption>To Unfollow</caption>
<tr>
<th>Sl. No.</th>
<th>Profile Picture</th>
<th>Name</th>
<th>Username</th>
<th>Bio</th>
<th>Post Count</th>
<th>Followers</th>
<th>Following</th>
<th>Is Private</th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>''')
with open('./index.html', 'a') as file:
for idx, usrname in enumerate(i_flwng_oth_no_flbk):
profile = instaloader.Profile.from_username(L.context, usrname)
file.write(f'''
<tr>
<td>{idx}</td>
<td><a href="{profile.profile_pic_url}" target="_blank">Pic</a></td>
<td>{profile.full_name}</td>
<td>
<a href="https://www.instagram.com/{profile.username}/"target="_blank">{profile.username}</a>
</td>
<td>{profile.biography}</td>
<td>{profile.get_posts().count}</td>
<td>{profile.followers}</td>
<td>{profile.followees}</td>
<td>{profile.is_private}</td>
</tr>''')
with open('./index.html', 'a') as file:
file.write('''
</table>
<br>
<br>
<br>
<table>
<caption>To Follow</caption>
<tr>
<th>Sl. No.</th>
<th>Profile Picture</th>
<th>Name</th>
<th>Username</th>
<th>Bio</th>
<th>Post Count</th>
<th>Followers</th>
<th>Following</th>
<th>Is Private</th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>''')
with open('./index.html', 'a') as file:
for idx, usrname in enumerate(oth_flwing_me_no_flbk):
profile = instaloader.Profile.from_username(L.context, usrname)
file.write(f'''
<tr>
<td>{idx}</td>
<td><a href="{profile.profile_pic_url}" target="_blank">Pic</a></td>
<td>{profile.full_name}</td>
<td>
<a href="https://www.instagram.com/{profile.username}/"target="_blank">{profile.username}</a>
</td>
<td>{profile.biography}</td>
<td>{profile.get_posts().count}</td>
<td>{profile.followers}</td>
<td>{profile.followees}</td>
<td>{profile.is_private}</td>
</tr>''')
with open('./index.html', 'a') as file:
file.write('''
</table>
</body>
</html>''')