-
-
Notifications
You must be signed in to change notification settings - Fork 227
/
delete_comment.html
58 lines (57 loc) · 1.47 KB
/
delete_comment.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
<!DOCTYPE html>
<html>
<head>
<title>Delete Comment</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
</head>
<body>
<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</a>
</h3>
<input type="text" id="token" placeholder="EAAA..." value=""><br>
<h3>Nhập id bài đăng</h3>
<input type="number" id="id_post" value="">
<br>
<button>OK</button>
<h1>Danh sách đã xoá</h1>
<ol id="result">
</ol>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
let token, id_post, patt;
$(document).ready(function(){
$("button").click(function(e){
e.stopPropagation();
token = $("#token").val();
id_post = $("#id_post").val();
patt = /\*/;
getComment(id_post);
});
});
function getComment(id_post){
link = `https://graph.facebook.com/${id_post}/comments?fields=message&limit=5000&access_token=${token}`;
$.ajax({
url: link,
dataType: 'json',
})
.success(function(response) {
$(response.data).each(function(){
if(patt.test(this.message)){
deleteComment(this.id);
}
})
})
}
function deleteComment(id_comment){
link = `https://graph.facebook.com/${id_comment}?method=delete&access_token=${token}`;
$.ajax({
url: link,
dataType: 'json',
})
.success(function() {
$("#result").append(`<li>Đã xoá ${id_comment}</li>`);
})
}
</script>
</body>
</html>