-
-
Notifications
You must be signed in to change notification settings - Fork 227
/
clean_facebook.html
315 lines (308 loc) · 9.65 KB
/
clean_facebook.html
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE html>
<html>
<head>
<title>Delete all thing on Facebook</title>
<style type="text/css">
.div_hide{
display: none;
}
</style>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2-bootstrap-theme/0.1.0-beta.10/select2-bootstrap.min.css">
</head>
<body>
<div class="container form-horizontal">
<h1>Code xóa toàn bộ ảnh, bài đăng, video</h1>
<h4>Không xóa được bài đăng mình không có quyền xoá (người khác tag mình, vân vân...)</h4>
<div class="form-group">
<h3>Bạn đã có token?</h3>
<select class="form-control" id="choose">
<option selected disabled>Chọn 1 cái</option>
<option value="1">Rồi</option>
<option value="0">Chưa</option>
</select>
</div>
<div class="form-group div_hide" id="div_login">
<h3>Nhập email(tên đăng nhập, id facebook):</h3>
<input type="text" id="email" class="form-control" placeholder="J2TeamNNL" value="">
<h3>Nhập mật khẩu:</h3>
<input type="password" id="password" class="form-control" value="">
<a id="get_token" style="display: none;" class="btn btn-success" target="_blank">Lấy token (copy đoạn từ access_token EAA... ấy)</a>
</div>
<div class="form-group div_hide" id="div_token">
<h3>
Nhập token của bạn:
<a href="https://www.facebook.com/groups/j2team.community/search/?query=token" target="_blank">
Tìm cách lấy token trong nhóm J2Team Community (bấm vào đây)
</a>
</h3>
<input type="text" id="token" class="form-control" placeholder="EAAA...." value="">
<h3>
Chọn đối tượng bạn muốn xoá
</h3>
<select class="form-control" id="type">
<option value="profile">
Cá nhân Profile
</option>
<option value="page">
Trang Page
</option>
<option value="group">
Nhóm Group
</option>
</select>
</div>
<div class="div_hide div_page form-group">
<h3>
Chọn trang muốn xoá
</h3>
<select id="choose_page">
</select>
</div>
<div class="div_hide div_group form-group">
<h3>
Chọn nhóm muốn xoá
</h3>
<select id="choose_group">
</select>
</div>
<div class="form-group" align="center">
<button class="btn btn-primary">OK</button>
</div>
<div class="form-group div_hide" id="div_result" align="center">
<h1 id="fail">Đang xoá (hãy kiên nhẫn đợi vì chạy từ từ cho chắc)</h1>
<ol id="result" reversed>
</ol>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js"></script>
<script type="text/javascript">
let token, link, link_album, link_photo, link_feed, type, type_delete, id_object, id_album;
var num;
let array_cant_delete = ['cover','wall','mobile','profile','app']
$(document).ready(function(){
$('#choose_group').select2({
theme: "bootstrap"
});
$('#choose_page').select2({
theme: "bootstrap"
});
$("#choose").change(function(){
$(".div_group").hide();
$(".div_page").hide();
choose = $(this).val();
switch(choose){
case '1':
$("#div_login").hide();
$("#div_token").show();
break;
case '0':
$("#div_login").show();
$("#div_token").hide();
break;
}
})
$("#password, #email").change(function(){
if($("#password").val()!='' && $("#email").val()!=''){
var password = $("#password").val();
var email = $("#email").val();
var link_token = `https://b-graph.facebook.com/auth/login?password=${password}&email=${email}&access_token=350685531728|62f8ce9f74b12f84c123cc23437a4a32&method=POST`;
$("#get_token").show();
$("#get_token").attr('href',link_token);
$("#div_token").show();
}
else{
$("#get_token").hide();
$("#div_token").hide();
}
})
$("#type").change(function(){
$(".div_group").hide();
$(".div_page").hide();
token = $("#token").val();
type = $("#type").val();
switch(type){
case 'page':
getPage();
break;
case 'group':
getGroup();
break;
}
})
$("button").click(function(e){
e.stopPropagation();
num = 0;
token = $("#token").val();
type = $("#type").val();
type_delete = $("#type_delete").val();
$("#div_result").hide();
switch(type){
case 'profile':
id_object = 'me';
break;
case 'page':
token = $('#choose_page').find(':selected').data('access_token');
id_object = $("#choose_page").val();
break;
case 'group':
id_object = $("#choose_group").val();
break;
}
link_album = `https://graph.facebook.com/${id_object}/albums?fields=id&limit=25&access_token=${token}`;
getAlbum(link_album);
link_feed = `https://graph.facebook.com/${id_object}/feed?fields=id&limit=25&access_token=${token}`;
getFeed(link_feed);
});
});
function failToken() {
$("#fail").html('Nhập token sai, hoặc bạn đã bị khoá chức năng');
}
function getPage() {
link = `https://graph.facebook.com/me/accounts?fields=name,access_token&access_token=${token}`;
$.ajax({
url: link,
dataType: 'json'
})
.done(function(response) {
$("#choose_page").html('');
$(response.data).each(function(){
$("#choose_page").prepend(`
<option value='${this.id}' data-access_token='${this.access_token}'>
${this.name}
</option>`);
})
$(".div_page").show();
})
.fail(function() {
failToken();
});
}
function getGroup() {
link = `https://graph.facebook.com/me/groups?fields=name&limit=100&access_token=${token}`;
$.ajax({
url: link,
dataType: 'json'
})
.done(function(response) {
$("#choose_group").html('');
$(response.data).each(function(){
$("#choose_group").prepend(`<option value='${this.id}'>${this.name}</option>`);
})
$(".div_group").show();
})
.fail(function() {
failToken();
});
}
function getAlbum(link) {
$.ajax({
url: link,
dataType: 'json'
})
.done(function(response) {
$(response.data).each(function(){
var id_album = this.id;
if(array_cant_delete.indexOf(this.type)>0){
num++;
time = Math.random()*5000;
setTimeout(function(){
deleteAjax(id_album);
},
time * num);
console.log(time*num,'album');
}
else{
getPhotoFromAlbum(id_album);
}
})
if(response.paging){
if(response.paging.next){
link = response.paging.next;
getAlbum(link);
}
}
})
.fail(function() {
failToken();
});
}
function getPhotoFromAlbum(id_album) {
link = `https://graph.facebook.com/${id_album}/photos?fields=id&access_token=${token}`;
$.ajax({
url: link,
dataType: 'json'
})
.done(function(response) {
$(response.data).each(function(){
num++;
time = Math.random()*5000;
var id_post = this.id;
setTimeout(function(){
deleteAjax(id_post);
},
time * num);
console.log(time*num,'photo');
})
if(response.paging){
if(response.paging.next){
link = response.paging.next;
getPhotoFromAlbum(id_album);
}
}
})
.fail(function() {
failToken();
});
}
function getFeed(link) {
$.ajax({
url: link,
dataType: 'json'
})
.done(function(response) {
$(response.data).each(function(){
num++;
time = Math.random()*5000;
var id_post = this.id;
setTimeout(function(){
deleteAjax(id_post);
},
time * num);
})
if(response.paging){
if(response.paging.next){
link = response.paging.next;
getFeed(link);
}
}
})
.fail(function() {
failToken();
});
}
function deleteAjax(id_post) {
link = `https://graph.facebook.com/${id_post}/?method=delete&access_token=${token}`;
$.ajax({
url: link,
dataType: 'json'
})
.done(function(response) {
if(response=='true'){
$("#div_result").show();
$("#result").append(`<li>Đã xoá ${id_post}</li>`);
}
else{
$("#fail").html('Lỗi');
}
})
.fail(function() {
failToken();
});
}
</script>
</body>
</html>