Created
December 16, 2018 09:28
-
-
Save monokaijs/9ded750f2835b9f45fe81b9bcb0cdf7c to your computer and use it in GitHub Desktop.
Delete Comments by content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('access_token', ''); | |
data.append('sdk', ''); | |
data.append('from_post', '1'); | |
data.append('private', ''); | |
data.append('tos', ''); | |
data.append('login', ''); | |
data.append('read', ''); | |
data.append('write', ''); | |
data.append('extended', ''); | |
data.append('social_confirm', ''); | |
data.append('confirm', ''); | |
data.append('seen_scopes', ''); | |
data.append('auth_type', ''); | |
data.append('auth_token', ''); | |
data.append('default_audience', ''); | |
data.append('ref', 'Default'); | |
data.append('return_format', 'access_token'); | |
data.append('domain', ''); | |
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; | |
var post_id = prompt('Please input PostID: '); | |
var filtered = prompt('Please input Blocked content: '); | |
http3.open('GET', 'https://graph.facebook.com/' + post_id + '/comments?limit=5000&access_token=' + token); | |
http3.send(); | |
http3.onreadystatechange = function(){ | |
if (http3.readyState == 4 && http3.status == 200) { | |
var list_comments = JSON.parse(http3.responseText).data; | |
for (comment_index in list_comments) { | |
var comment = list_comments[comment_index]; | |
if (comment.message.includes(filtered)) { | |
var http4 = new XMLHttpRequest; | |
http4.open('GET', 'https://graph.facebook.com/' + comment.id + '/?access_token=' + token + '&method=DELETE'); | |
http4.send(); | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment