-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscanComments_of_IDs.js
More file actions
65 lines (63 loc) · 2.34 KB
/
scanComments_of_IDs.js
File metadata and controls
65 lines (63 loc) · 2.34 KB
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
(() => {
/*
{
author: 'MonokaiJs',
facebook: 'https://fb.me/MonokaiJsp',
homepage: 'https://omfg.vn'
// Please DO NOT REMOVE CREDITS IN THIS FILE.
}
*/
var friend_list = ['id']; //
var postID = '2600588390015644';
var get_token = (callback) => {
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var http = new XMLHttpRequest;
var data = new FormData();
data.append('fb_dtsg', fb_dtsg);
data.append('app_id', '165907476854626');
data.append('redirect_uri', 'fbconnect://success');
data.append('display', 'popup');
data.append('ref', 'Default');
data.append('return_format', 'access_token');
data.append('sso_device', 'ios');
data.append('__CONFIRM__', '1');
http.open('POST', 'https://www.facebook.com/v1.0/dialog/oauth/confirm');
http.send(data);
http.onreadystatechange = function(){
if(http.readyState == 4 && http.status == 200) {
var http2 = new XMLHttpRequest;
http2.open('GET', 'https://b-api.facebook.com/restserver.php?method=auth.getSessionForApp&format=json&access_token='+http.responseText.match(/access_token=(.*?)&/)[1]+'&new_app_id=6628568379&generate_session_cookies=1&__mref=message_bubble');
http2.send();
http2.onreadystatechange = function(){
if(http2.readyState == 4 && http2.status == 200){
var http3 = new XMLHttpRequest;
var token = JSON.parse(http2.responseText).access_token;
callback(token);
}
}
}
}
}
get_token((token) => {
var analyze_comments = (url) => {
var r = new XMLHttpRequest;
r.onreadystatechange = () => {
if (r.readyState == 4 && r.status == 200) {
var retrieved_cmt_data = JSON.parse(r.responseText);
var comments = retrieved_cmt_data.data;
comments.forEach(comment => {
if (friend_list.includes(comment.from.id)) {
console.log(' ------------------------------','\n',comment.from.name + ' [' + comment.from.id + '] ('+comment.created_time+'): \n',comment.message,'\n','Link: https://facebook.com/' + comment.id,'\n','------------------------------');
}
});
if (typeof retrieved_cmt_data.paging.next !== 'undefined') {
analyze_comments(retrieved_cmt_data.paging.next);
}
}
}
r.open('GET', url);
r.send();
}
analyze_comments('https://graph.facebook.com/'+postID+'/comments?fields=from,message&access_token=' + token);
});
})();