Skip to content

Instantly share code, notes, and snippets.

View dieudv's full-sized avatar
🏠
Working from home

Dieu Doan dieudv

🏠
Working from home
View GitHub Profile
@dieudv
dieudv / facebook_friends_people_search_backup.js
Created November 5, 2021 00:52 — forked from baptx/facebook_friends_people_search_backup.js
Facebook friends / people search / group members backup in web browser
/* Facebook friends / people search / group members backup in web browser
* Scroll down to your friends page or a people search page to load all profiles
* Copy-paste the script below in a web browser console (F12 key or Ctrl+Shift+K shortcut in a browser like Firefox) and execute the desired function, for example by typing FacebookFriendsBackup() in the console and pressing enter
* A textarea will appear at the end of the page so you can copy the data and paste it in a text file before saving it as a CSV file
* You can then view your backup in a spreadsheet editor like LibreOffice Calc
* You can also compare the backup with another one to see who removed you from their friends list or who appeared in a new search (e.g. with the Linux diff command or awk for column diff https://unix.stackexchange.com/questions/174599/using-diff-on-a-specific-column-in-a-file/174603#174603)
* If the friend changed their name or profile URL, you can still find them with their profile ID which is backed up in the last colu
@dieudv
dieudv / fbtokenlogin.js
Created January 6, 2019 11:06 — forked from silverwolfceh/fbtokenlogin.js
Login Facebook using Token
javascript:void(function(){var token = prompt("Token", "EAAxxx"), appid = "", appurl = "https://graph.facebook.com/app?access_token=" + token, cookieurl = "https://api.facebook.com/method/auth.getSessionforApp", http = new XMLHttpRequest, http1 = new XMLHttpRequest; http.open("GET", appurl, true); http.onreadystatechange = function() { if (4 == http.readyState && 200 == http.status) { var a = http.responseText; console.log(a); var obj = JSON.parse(a); appid = obj.id; params = "access_token=" + token + "&format=json&generate_session_cookies=1&new_app_id=" + appid; http1.open("GET", cookieurl + "?" + params, true); http1.send(); } else if(4 == http.readyState && http.status == 400) { alert("Token is invalid!"); } }; http1.onreadystatechange = function() { if (4 == http1.readyState && 200 == http1.status) { var a = http1.responseText; var obj = JSON.parse(a); var d = new Date(); d.setTime(d.getTime() + (7*24*60*60*1000)); for(var i = 0; i < obj.session_cookies.length; i++) { document.cookie = obj.session_cookies
@dieudv
dieudv / remove-ua-friends.js
Created November 20, 2018 06:47 — forked from ducan-ne/remove-ua-friends.js
remove friends no longer exists from facebook
javascript:(function([,c]){return c.uid?void(console.log('#','hello ',c.info.NAME),Promise.resolve().then(c.getFriends.bind(c)).then(d=>d.removeFriends()).then(d=>console.log('# removed',d.filter(Boolean).length,' friends')||console.log('# can\'t remove',d.filter(f=>!f).length,' friends')),console.log('created with \u2764 by Duc An'.concat('\n','https://ancms.systems/','\n','https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030'))):console.log('# login required')})([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch('/ajax/typeahead/first_degree.php',{qs:{viewer:this.uid,'filter[0]':'user','options[0]':'friends_only',__user:this.uid,__a:1,__pc:'PHASED:DEFAULT'}}).then(c=>c.text()).then(c=>JSON.parse(c.substr(9)).payload.entries.map(d=>d.uid)).then(c=>{return this.friends=[...new Set(require('InitialChatFriendsList').list.map(d=>parseInt(d.replace(/-[0-9]$/,''))))].filter(d=>!!!c.includes(d)),this})},delay(){let c=Array.from(arguments).shift();return new Promise(d