-
Notifications
You must be signed in to change notification settings - Fork 0
/
main2.py
104 lines (90 loc) · 2.4 KB
/
main2.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
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('./index1.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>Username</th>
</tr>
<tr>
<td></td>
<td></td>
</tr>''')
with open('./index1.html', 'a') as file:
for index, usrname in enumerate(i_flwng_oth_no_flbk):
profile = instaloader.Profile.from_username(L.context, usrname)
file.write(f'''
<tr>
<td>{index+1}</td>
<td>
<a href="https://www.instagram.com/{profile.username}/"target="_blank">{profile.username}</a>
</td>
</tr>''')
with open('./index1.html', 'a') as file:
file.write('''
</table>
<br>
<br>
<br>
<table>
<caption>To Follow</caption>
<tr>
<th>Sl. No.</th>
<th>Username</th>
</tr>
<tr>
<td></td>
<td></td>
</tr>''')
with open('./index1.html', 'a') as file:
for index, usrname in enumerate(oth_flwing_me_no_flbk):
profile = instaloader.Profile.from_username(L.context, usrname)
file.write(f'''
<tr>
<td>{index+1}</td>
<td>
<a href="https://www.instagram.com/{profile.username}/"target="_blank">{profile.username}</a>
</td>
</tr>''')
with open('./index1.html', 'a') as file:
file.write('''
</table>
</body>
</html>''')