Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !((groupId, dtsg) => {
- let glob = {
- dtsg: require("DTSGInitialData").token || document.querySelector('[name="fb_dtsg"]').value,
- posts: [],
- del: function() {
- this.posts.reduce((cp, post, index, arr) => {
- return cp.then((e) => {
- if (e) {
- let f = new FormData();
- f.append("group_id", groupId);
- f.append("post_id", post);
- f.append("pending", 1);
- f.append("story_dom_id", `mall_post_${post}`);
- f.append("fb_dtsg", this.dtsg);
- f.append("nctr[_mod]", "pagelet_pending_queue");
- f.append("confirmed", 1);
- return fetch("https://www.facebook.com/ajax/groups/mall/delete/?dpr=1", {method: "POST", credentials: "include", body: f}).then((e) => (String(e.status).match(/^2/g)) ? (console.log(`Deleted Post: ${post} || ${index + 1}/${arr.length}`), true) : (console.log(`Failed To Delete Post: ${post + 1} || ${index}/${arr.length}`), false));
- }
- });
- }, Promise.resolve(true)).then((e) => {console.log("Done!");});
- },
- getPost: function(groupId, cur) {
- fetch(`https://www.facebook.com/ajax/pagelet/generic.php/PendingQueuePagelet?dpr=1&data=%7B%22group_id%22%3A${groupId}%2C%22cursor%22%3A%22${cur}%22%2C%22sort_option%22%3A%22request_time%22%7D&__a=1`).then((res) => res.text()).then((e) => {
- let cur = e.match(/(?<=cursor":").*(?=","sort)/g), post = e.match(/(?<=&post_id=)\d+(?=")/g);
- this.posts = [...this.posts, ...post];
- console.log(`Added Post ID To DB: ${String(post)}`);
- (cur) ? this.getPost(groupId, cur[0]) : this.del();
- });
- }
- };
- glob.getPost(groupId);
- })(document.documentElement.outerHTML.match(/(?<=group_id=)\d+/g)[0]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement