Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Facebook Group Members Extractor. Download Facebook group members in CSV.

NotificationsYou must be signed in to change notification settings

floriandiud/facebook-group-members-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

How to run the Facebook Group Extractor script

  1. Go to a Facebook group page
  2. Open Chrome Developer Console
  3. Copy Paste the following code into the console. It will add a "Download 0 members" button.Important: Copy/Paste before moving to the "People/Members" tab
  4. Click on the "People" tab of the group page
  5. Scroll to load new members that will get scraped by the script. The button counter increases with new members scraped.
    • If you have a lot of members, you can use this script to load them all
    • setInterval(() => window.scrollTo(0, document.body.scrollHeight), 100);
  6. Once done, click on the "Download X members" button to download the generated CSV file
  7. The profiles are kept in a cache until you click the "Reset" button. Thanks to this cache, the extracted profiles are still available if your browser "crashes"

Read our step-by-stepguide to extract Facebook group members and find their LinkedIn profile

dist/main.min.js

varG=Object.defineProperty,Q=(e,t,n)=>tine?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t,n)=>(Q(e,"symbol"!=typeoft?t+"":t,n),n);functionee(e,t){for(varn="",r=0;r<t.length;r++)n+=function(e){for(vart="",n=0;n<e.length;n++){varr=null===e[n]||"u"<typeofe[n]?"":e[n].toString(),r=(r=e[n]instanceofDate?e[n].toLocaleString():r).replace(/"/g,'""');0<n&&(t+=","),t+=r=0<=r.search(/("|,|\n)/g)?'"'+r+'"':r}returnt+``}(t[r]);vari=newBlob([n],{type:"text/csv;charset=utf-8;"}),o=document.createElement("a");void0!==o.download&&(i=URL.createObjectURL(i),o.setAttribute("href",i),o.setAttribute("download",e),document.body.appendChild(o),o.click(),document.body.removeChild(o))}const_=(t,e)=>e.some(e=>tinstanceofe);letP,j;functionte(){returnP=P||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]}functionne(){returnj=j||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]}constD=newWeakMap,E=newWeakMap,b=newWeakMap;functionre(o){vare=newPromise((e,t)=>{constn=()=>{o.removeEventListener("success",r),o.removeEventListener("error",i)},r=()=>{e(h(o.result)),n()},i=()=>{t(o.error),n()};o.addEventListener("success",r),o.addEventListener("error",i)});returnb.set(e,o),e}functionie(o){vare;D.has(o)||(e=newPromise((e,t)=>{constn=()=>{o.removeEventListener("complete",r),o.removeEventListener("error",i),o.removeEventListener("abort",i)},r=()=>{e(),n()},i=()=>{t(o.error||newDOMException("AbortError","AbortError")),n()};o.addEventListener("complete",r),o.addEventListener("error",i),o.addEventListener("abort",i)}),D.set(o,e))}letC={get(e,t,n){if(einstanceofIDBTransaction){if("done"===t)returnD.get(e);if("store"===t)returnn.objectStoreNames[1]?void0:n.objectStore(n.objectStoreNames[0])}returnh(e[t])},set(e,t,n){returne[t]=n,!0},has(e,t){returneinstanceofIDBTransaction&&("done"===t||"store"===t)||tine}};functionK(e){C=e(C)}functionoe(t){returnne().includes(t)?function(...e){returnt.apply(S(this),e),h(this.request)}:function(...e){returnh(t.apply(S(this),e))}}functionse(e){return"function"==typeofe?oe(e):(einstanceofIDBTransaction&&ie(e),_(e,te())?newProxy(e,C):e)}functionh(e){if(einstanceofIDBRequest)returnre(e);if(E.has(e))returnE.get(e);vart=se(e);returnt!==e&&(E.set(e,t),b.set(t,e)),t}constS=e=>b.get(e);functionae(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){consts=indexedDB.open(e,t),a=h(s);returnr&&s.addEventListener("upgradeneeded",e=>{r(h(s.result),e.oldVersion,e.newVersion,h(s.transaction),e)}),n&&s.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}constce=["get","getKey","getAll","getAllKeys","count"],de=["put","add","delete","clear"],I=newMap;functionR(e,t){if(einstanceofIDBDatabase&&!(tine)&&"string"==typeoft){if(I.get(t))returnI.get(t);constr=t.replace(/FromIndex$/,""),i=t!==r,o=de.includes(r);returnrin(i?IDBIndex:IDBObjectStore).prototype&&(o||ce.includes(r))?(e=asyncfunction(e,...t){e=this.transaction(e,o?"readwrite":"readonly");letn=e.store;returni&&(n=n.index(t.shift())),(awaitPromise.all([n[r](...t),o&&e.done]))[0]},I.set(t,e),e):void0}}K(r=>({...r,get:(e,t,n)=>R(e,t)||r.get(e,t,n),has:(e,t)=>!!R(e,t)||r.has(e,t)}));constle=["continue","continuePrimaryKey","advance"],V={},B=newWeakMap,U=newWeakMap,ue={get(e,t){if(!le.includes(t))returne[t];letn=V[t];returnn=n||(V[t]=function(...e){B.set(this,U.get(this)[t](...e))})}};asyncfunction*fe(...e){lett=this;if(t=tinstanceofIDBCursor?t:awaitt.openCursor(...e)){t=t;varn=newProxy(t,ue);for(U.set(n,t),b.set(n,S(t));t;)yieldn,t=await(B.get(n)||t.continue()),B.delete(n)}}functionF(e,t){returnt===Symbol.asyncIterator&&_(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&_(e,[IDBIndex,IDBObjectStore])}K(r=>({...r,get(e,t,n){returnF(e,t)?fe:r.get(e,t,n)},has(e,t){returnF(e,t)||r.has(e,t)}}));varH,f=function(e,s,a,d){returnnew(a=a||Promise)(function(n,t){functionr(e){try{o(d.next(e))}catch(e){t(e)}}functioni(e){try{o(d.throw(e))}catch(e){t(e)}}functiono(e){vart;e.done?n(e.value):((t=e.value)instanceofa?t:newa(function(e){e(t)})).then(r,i)}o((d=d.apply(e,s||[])).next())})},he=function(e,t){varn={};for(iine)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeofObject.getOwnPropertySymbols)for(varr=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);returnn};classpe{constructor(e){this.name="scrape-storage",this.persistent=!0,this.data=newMap,null!=e&&e.name&&(this.name=e.name),null!=e&&e.persistent&&(this.persistent=e.persistent),this.initDB().then(()=>{}).catch(()=>{this.persistent=!1})}getstorageKey(){return"storage-"+this.name}initDB(){returnf(this,void0,void0,function*(){this.db=yieldae(this.storageKey,6,{upgrade(e,t,n,r){leti;if(t<5)try{e.deleteObjectStore("data")}catch{}(i=e.objectStoreNames.contains("data")?r.objectStore("data"):e.createObjectStore("data",{keyPath:"_id",autoIncrement:!0}))&&!i.indexNames.contains("_createdAt")&&i.createIndex("_createdAt","_createdAt"),i&&!i.indexNames.contains("_groupId")&&i.createIndex("_groupId","_groupId"),i&&!i.indexNames.contains("_pk")&&i.createIndex("_pk","_pk",{unique:!0})}})})}_dbGetElem(e,t){returnf(this,void0,void0,function*(){if(this.persistent&&this.db)returnyield(t=t||this.db.transaction("data","readonly")).store.index("_pk").get(e);thrownewError("DB doesnt exist")})}getElem(e){returnf(this,void0,void0,function*(){if(this.persistent&&this.db)try{returnyieldthis._dbGetElem(e)}catch(e){console.error(e)}elsethis.data.get(e)})}_dbSetElem(i,o,s=!1,a,d){returnf(this,void0,void0,function*(){if(this.persistent&&this.db){lete=!1;constt=(d=d||this.db.transaction("data","readwrite")).store,n=yieldt.index("_pk").get(i);if(n)s&&(yieldt.put(Object.assign(Object.assign({},n),o)),e=!0);else{constr=Object.assign({_pk:i,_createdAt:newDate},o);a&&(r._groupId=a),yieldt.put(r),e=!0}returne}thrownewError("DB doesnt exist")})}addElem(e,t,n=!1,r){returnf(this,void0,void0,function*(){if(this.persistent&&this.db)try{returnyieldthis._dbSetElem(e,t,n,r)}catch(e){console.error(e)}elsethis.data.set(e,t);return!0})}addElems(t,o=!1,s){returnf(this,void0,void0,function*(){if(this.persistent&&this.db){constn=[],r=this.db.transaction("data","readwrite"),i=[];if(t.forEach(([e,t])=>{-1===i.indexOf(e)&&(i.push(e),n.push(this._dbSetElem(e,t,o,s,r)))}),0<n.length){n.push(r.done);conste=yieldPromise.all(n);lett=0;returne.forEach(e=>{"boolean"==typeofe&&e&&(t+=1)}),t}return0}returnt.forEach(([e,t])=>{this.addElem(e,t)}),t.length})}deleteFromGroupId(n){returnf(this,void0,void0,function*(){if(this.persistent&&this.db){lete=0,t=yieldthis.db.transaction("data","readwrite").store.index("_groupId").openCursor(IDBKeyRange.only(n));for(;t;)t.delete(),t=yieldt.continue(),e+=1;returne}thrownewError("Not Implemented Error")})}clear(){returnf(this,void0,void0,function*(){this.persistent&&this.db?yieldthis.db.clear("data"):this.data.clear()})}getCount(){returnf(this,void0,void0,function*(){returnthis.persistent&&this.db?yieldthis.db.count("data"):this.data.size})}getAll(){returnf(this,void0,void0,function*(){if(this.persistent&&this.db){constn=newMap,e=yieldthis.db.getAll("data");returne&&e.forEach(e=>{vart=e["_id"],e=he(e,["_id"]);n.set(t,e)}),n}returnthis.data})}toCsvData(){returnf(this,void0,void0,function*(){constt=[];returnt.push(this.headers),(yieldthis.getAll()).forEach(e=>{try{t.push(this.itemToRow(e))}catch(e){console.error(e)}}),t})}}constye=["display: block;","padding: 0px 4px;","cursor: pointer;","text-align: center;"];functionW(e){constt=document.createElement("div"),n=[...ye];returne&&n.push("flex-grow: 1;"),t.setAttribute("style",n.join("")),t}constge=["margin-left: 4px;","margin-right: 4px;","border-left: 1px solid #2e2e2e;"];functionX(){conste=document.createElement("div");returne.innerHTML="&nbsp;",e.setAttribute("style",ge.join("")),e}functiong(e,t){varn,t=t||{};letr;consti=document.createElement("span");return(r=t.bold?(n=document.createElement("strong"),i.append(n),n):i).textContent=e,t.idAttribute&&r.setAttribute("id",t.idAttribute),i}constme=["position: fixed;","top: 0;","left: 0;","z-index: 10000;","width: 100%;","height: 100%;","pointer-events: none;"],be=["position: absolute;","bottom: 30px;","right: 30px;","width: auto;","pointer-events: auto;"],we=["align-items: center;","appearance: none;","background-color: #EEE;","border-radius: 4px;","border-width: 0;","box-shadow: rgba(45, 35, 66, 0.4) 0 2px 4px,rgba(45, 35, 66, 0.3) 0 7px 13px -3px,#D6D6E7 0 -3px 0 inset;","box-sizing: border-box;","color: #36395A;","display: flex;","font-family: monospace;","height: 38px;","justify-content: space-between;","line-height: 1;","list-style: none;","overflow: hidden;","padding-left: 16px;","padding-right: 16px;","position: relative;","text-align: left;","text-decoration: none;","user-select: none;","white-space: nowrap;","font-size: 18px;"];classve{constructor(){this.ctas=[],this.canva=document.createElement("div"),this.canva.setAttribute("style",me.join("")),this.inner=document.createElement("div"),this.inner.setAttribute("style",be.join("")),this.canva.appendChild(this.inner),this.history=document.createElement("div"),this.inner.appendChild(this.history),this.container=document.createElement("div"),this.container.setAttribute("style",we.join("")),this.inner.appendChild(this.container)}makeItDraggable(){lett=0,n=0,r=0,i=0;consto=e=>{r=e.clientX-t,i=e.clientY-n,this.inner.style.right=window.innerWidth-r-this.inner.offsetWidth+"px",this.inner.style.bottom=window.innerHeight-i-this.inner.offsetHeight+"px"},e=(this.inner.addEventListener("mousedown",e=>{e.preventDefault(),t=e.clientX-this.inner.offsetLeft,n=e.clientY-this.inner.offsetTop,window.addEventListener("mousemove",o,!1)},!1),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",o,!1)},!1),document.createElement("div"));e.style.cursor="move",e.innerHTML='<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height="18px" width="18px" xmlns="http://www.w3.org/2000/svg"><polyline points="5 9 2 12 5 15"></polyline><polyline points="9 5 12 2 15 5"></polyline><polyline points="15 19 12 22 9 19"></polyline><polyline points="19 9 22 12 19 15"></polyline><line x1="2" y1="12" x2="22" y2="12"></line><line x1="12" y1="2" x2="12" y2="22"></line></svg>',this.addCta(X()),this.addCta(e)}render(){document.body.appendChild(this.canva)}addCta(e,t){"u"<typeoft?this.ctas.push(e):this.ctas.splice(t,0,e),this.container.innerHTML="",this.ctas.forEach(e=>{this.container.appendChild(e)})}}!function(e){e.ADD="add",e.LOG="log"}(H=H||{});classxeextendspe{constructor(){super(...arguments),M(this,"name","fb-scrape-storage")}getheaders(){return["Profile Id","Full Name","Profile Link","Bio","ImageSrc","GroupId","Group Joining Text","Profile Type"]}itemToRow(e){return[e.profileId,e.fullName,e.profileLink,e.bio,e.imageSrc,e.groupId,e.groupJoiningText,e.profileType]}}constm=newxe,J="fb-group-scraper-number-tracker",Ee="groupMemberExport";asyncfunctionA(){conste=document.getElementById(J);if(e){constt=awaitm.getCount();e.textContent=t.toString()}}consty=newve;functionIe(){conste=W(),t=(e.appendChild(g("Download ")),e.appendChild(g("0",{bold:!0,idAttribute:J})),e.appendChild(g(" users")),e.addEventListener("click",asyncfunction(){vare=(newDate).toISOString(),t=awaitm.toCsvData();try{ee(Ee+`-${e}.csv`,t)}catch(e){console.error("Error while generating export"),console.log(e.stack)}}),y.addCta(e),y.addCta(X()),W());t.appendChild(g("Reset")),t.addEventListener("click",asyncfunction(){awaitm.clear(),awaitA()}),y.addCta(t),y.makeItDraggable(),y.render(),window.setTimeout(()=>{A()},1e3)}function_e(e){vart;letn;if(null!=(t=null==e?void0:e.data)&&t.group)n=e.data.group;else{if("Group"!==(null==(t=null==(t=null==e?void0:e.data)?void0:t.node)?void0:t.__typename))return;n=e.data.node}letr;if(null!=(t=null==n?void0:n.new_members)&&t.edges)r=n.new_members.edges;elseif(null!=(e=null==n?void0:n.new_forum_members)&&e.edges)r=n.new_forum_members.edges;else{if(null==(t=null==n?void0:n.search_results)||!t.edges)return;r=n.search_results.edges}consti=r.map(e=>{vart="GroupUserInvite"===e.node.__isEntity?e.node.invitee_profile:e.node;if(!t)returnnull;var{id:n,name:r,bio_text:i,url:o,profile_picture:s,__isProfile:a}=t,d=(null==(d=null==e?void0:e.join_status_text)?void0:d.text)||(null==(e=null==(d=null==e?void0:e.membership)?void0:d.join_status_text)?void0:e.text),t=null==(e=t.group_membership)?void0:e.associated_group.id;return{profileId:n,fullName:r,profileLink:o,bio:(null==i?void0:i.text)||"",imageSrc:(null==s?void0:s.uri)||"",groupId:t,groupJoiningText:d||"",profileType:a}}),o=[];i.forEach(e=>{e&&o.push([e.profileId,e])}),m.addElems(o).then(()=>{A()})}functionDe(e){letn=[];try{n.push(JSON.parse(e))}catch(t){varr=e.split(``);if(r.length<=1)returnvoidconsole.error("Fail to parse API response",t);for(lete=0;e<r.length;e++){vari=r[e];try{n.push(JSON.parse(i))}catch{console.error("Fail to parse API response",t)}}}for(lete=0;e<n.length;e++)_e(n[e])}functionCe(){Ie();lete=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){this.addEventListener("readystatechange",function(){this.responseURL.includes("/api/graphql/")&&4===this.readyState&&De(this.responseText)},!1),e.apply(this,arguments)}}Ce();

Scrapped Fields

  • Profile Id: Unique facebook identifier. Multi-digit number.
  • Full Name: First name and last name concatenated.
  • Profile Link: Profile URI in the formathttps://www.facebook.com/{{username}}. When not available, default tohttps://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 shortcutCtrl + Shift + I (on Windows) orCmd + Option + I (on Mac).

Developer Tools

Copy Paste the script

Select the "Console" tab and copy-paste the script from above. Facebook shows a warning message in the "Console" asking not to paste a script from a non-trustworthy source. It's true! And if you don't trust this script, stop here.Read the source code to understand what this script does.

Paste the script

Click on the "People" tab and scroll to load new members

In the Group Page, go to "People" and scroll to the bottom of the page. If the counter in the button text increases as your scroll, it's working!

Scroll

Export members in CSV format

Once finished, or to perform "export checkpoints", click the button "Download X members". A Download window will prompt asking where to save your CSV file.

Download CSV

Edit and view your CSV file

To load and view the CSV file, useDatablist.com or any spreadsheet tools.

Manage your Facebook leads and enrich them with LinkedIn Profile

Use Facebook members profiles to build a leads database. Filter and segment leads to find the most relevant leads to contact. Then, enrich Facebook members with LinkedIn profile and email address.Follow this step-by-step tutorial toscrape Facebook members and find their LinkedIn profiles.

Find the email address for Facebook Group members

To be clear:there is no direct way to get the email address from Facebook.But we can use the name, the company name, or the LinkedIn Profile URL to find an email address! Read ourguide to scrape Facebook Group Members and find their email address.

FAQ

  • How to remove the "Download" button?
    • Just reload your Facebook page. Any javascript code added in Chrome Developer Console will be removed.
  • How many members can be extracted for one group?
  • Can I extract members from different groups at one time?
    • Yes. The exported CSV contains a "Group Id" attribute. Load members from one Facebook group, go to another group page (without reloading your page), load members, and click "Download". Members extracted from both groups will be in a single CSV file with different "Group Id" values.
  • What is the "Reset" button?
    • The profiles are stored in a cache in your browser. The cache is kept if your browser restarts the page (intentionally or after a crash). When you copy/paste the script, it loads the previous profiles from the cache. The "Reset" button clears the cache.
  • Is it free?

How to build it locally

yarn installyarn build

The generated script is located indist/main.min.js.

Other scrapers

About

Facebook Group Members Extractor. Download Facebook group members in CSV.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp