- Notifications
You must be signed in to change notification settings - Fork4
Facebook Group Members Extractor. Download Facebook group members in CSV.
License
NotificationsYou must be signed in to change notification settings
Tanmay-Tiwaricyber/facebook-group-members-scraper
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Script to scrape Facebook group members and export them into a CSV file. This Facebook Group members extractor works in the browser, without installing an extension or using a proxy. Just copy-paste the script into your Chrome console.
- Go to a Facebook group page
- Open Chrome Developer Console
- Copy Paste the following code into the console. It will add a "Download 0 members" button
- Click on the "People" tab of the group page
- Scroll to load new members that will get caught by the script. The button counter increases with new members scraped.
- Once done, click on the "Download X members" button to download the generated CSV file
Read our step-by-stepguide to extract Facebook group members and find their LinkedIn profile
functionexportToCsv(e,t){for(varn="",o=0;o<t.length;o++)n+=function(e){for(vart="",n=0;n<e.length;n++){varo=null===e[n]||void0===e[n]?"":e[n].toString(),o=(o=e[n]instanceofDate?e[n].toLocaleString():o).replace(/"/g,'""');0<n&&(t+=","),t+=o=0<=o.search(/("|,|\n)/g)?'"'+o+'"':o}returnt+"\n"}(t[o]);varr=newBlob([n],{type:"text/csv;charset=utf-8;"}),i=document.createElement("a");void0!==i.download&&(r=URL.createObjectURL(r),i.setAttribute("href",r),i.setAttribute("download",e),document.body.appendChild(i),i.click(),document.body.removeChild(i))}functionbuildCTABtn(){vare=document.createElement("div"),t=(e.setAttribute("style",["position: fixed;","top: 0;","left: 0;","z-index: 10;","width: 100%;","height: 100%;","pointer-events: none;"].join("")),document.createElement("div")),n=(t.setAttribute("style",["position: absolute;","bottom: 30px;","right: 130px;","color: white;","min-width: 150px;","background: var(--primary-button-background);","border-radius: var(--button-corner-radius);","padding: 0px 12px;","cursor: pointer;","font-weight:600;","font-size:15px;","display: inline-flex;","pointer-events: auto;","height: 36px;","align-items: center;","justify-content: center;"].join("")),document.createTextNode("Download ")),o=document.createElement("span"),r=(o.setAttribute("id","fb-group-scraper-number-tracker"),o.textContent="0",document.createTextNode(" members"));returnt.appendChild(n),t.appendChild(o),t.appendChild(r),t.addEventListener("click",function(){vare=(newDate).toISOString();exportToCsv("groupMemberExport-".concat(e,".csv"),window.members_list)}),e.appendChild(t),document.body.appendChild(e),e}functionprocessResponse(e){vart;if(null!==(n=null==e?void0:e.data)&&void0!==n&&n.group)o=e.data.group;else{if("Group"!==(null===(n=null===(n=null==e?void0:e.data)||void0===n?void0:n.node)||void0===n?void0:n.__typename))return;o=e.data.node}if(null!==(n=null==o?void0:o.new_members)&&void0!==n&&n.edges)t=o.new_members.edges;else{if(null===(e=null==o?void0:o.new_forum_members)||void0===e||!e.edges)return;t=o.new_forum_members.edges}varn=t.map(function(e){vart=e.node,n=t.id,o=t.name,r=t.bio_text,i=t.url,d=t.profile_picture,t=t.__isProfile,s=(null===(s=null==e?void0:e.join_status_text)||void0===s?void0:s.text)||(null===(s=null===(s=null==e?void0:e.membership)||void0===s?void0:s.join_status_text)||void0===s?void0:s.text),e=null===(e=e.node.group_membership)||void0===e?void0:e.associated_group.id;return[n,o,i,(null==r?void0:r.text)||"",(null==d?void0:d.uri)||"",e,s||"",t]}),o=((e=window.members_list).push.apply(e,n),document.getElementById("fb-group-scraper-number-tracker"));o&&(o.textContent=window.members_list.length.toString())}functionparseResponse(e){varn=[];try{n.push(JSON.parse(e))}catch(t){varo=e.split("\n");if(o.length<=1)returnvoidconsole.error("Fail to parse API response",t);for(varr=0;r<o.length;r++){vari=o[r];try{n.push(JSON.parse(i))}catch(e){console.error("Fail to parse API response",t)}}}for(vart=0;t<n.length;t++)processResponse(n[t])}functionmain(){buildCTABtn();vare=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){this.addEventListener("readystatechange",function(){this.responseURL.includes("/api/graphql/")&&4===this.readyState&&parseResponse(this.responseText)},!1),e.apply(this,arguments)}}window.members_list=window.members_list||[["Profile Id","Full Name","ProfileLink","Bio","Image Src","Groupe Id","Group Joining Text","Profile Type"]],main();```## Exported Fields- **Profile Id**: Unique facebook identifier. Multi-digit number.- **Full Name**: First name and last name concatenated.- **Profile Link**: Profile URI in the format https://www.facebook.com/{{username}}. When not available, default to https://www.facebook.com/profile.php?id={{profile_id}}- **Bio**: Profile bio text.- **Image Src**: Profile picture URI.- **Group Id**: Facebook group identifier. Multi-digit number.- **Group Joining Text**: Relative time since user joined the group. In the format: "Member since XX".- **Profile Type**: Facebook profile type. "User" or "Page".## Group Members Extractor tutorial with screenshots**Open Chrome Developer Console**To open the Chrome Developer console on Chrome, use the keyboard shortcut `Ctrl+Shift+I` (on Windows) or `Cmd+Option+I`(onMac).**CopyPastethescript**Selectthe"Console"tabandcopy-pastethescriptfromabove.Facebookshowsawarningmessageinthe"Console"askingnottopasteascriptfromanon-trustworthysource.It's true! And if you don'ttrustthisscript,stophere.[Readthesourcecode](main.ts)tounderstandwhatthisscriptdoes.**Clickonthe"People"tabandscrolltoloadnewmembers**IntheGroupPage,goto"People"andscrolltothebottomofthepage.Ifthecounterinthebuttontextincreasesasyourscroll,it's working!**ExportmembersinCSVformat**Oncefinished,ortoperform"export checkpoints",clickthebutton"Download X members".ADownloadwindowwillpromptaskingwheretosaveyourCSVfile.**EditandviewyourCSVfile**[ToloadandviewtheCSVfile](https://www.datablist.com/csv-editor),use[Datablist.com](https://www.datablist.com/)oranyspreadsheettools.**ManageyourFacebookleadsandenrichthemwithLinkedInProfile**UseFacebookmembersprofilestobuildaleadsdatabase.Filterandsegmentleadstofindthemostrelevantleadstocontact.Then,enrichFacebookmemberswithLinkedInprofileandemailaddress.Followthisstep-by-steptutorialto[scrapeFacebookmembersandfindtheirLinkedInprofiles](https://www.datablist.com/how-to/scrape-facebook-group-members-linkedin)##FAQ-**Howtoremovethe"Download"button?**-JustreloadyourFacebookpage.AnyjavascriptcodeaddedinChromeDeveloperConsolewillberemoved.-**Howmanymemberscanbeextractedforonegroup?**-Facebookloadsamaximumof10kprofilesinthe"People"tab.Werecommendextractingnewmembersonaregularbasis.Andthen,[consolidateallyourFacebookprofilesinasinglelistusingDatablist.com](https://www.datablist.com/how-to/scrape-facebook-group-members-linkedin).-**CanIextractmembersfromdifferentgroupsatonetime?**-Yes.TheexportedCSVcontainsa"Group Id"attribute.LoadmembersfromoneFacebookgroup,gotoanothergrouppage(withoutreloadingyourpage),loadmembers,andclick"Download".MembersextractedfrombothgroupswillbeinasingleCSVfilewithdifferent"Group Id"values.##Howtobuilditlocally
yarn installyarn build
The generated script is located in `dist/main.min.js`.About
Facebook Group Members Extractor. Download Facebook group members in CSV.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.