Last active
December 27, 2018 19:36
-
-
Save oresh/1151945bb3ca2e0343b10d93aeccbf88 to your computer and use it in GitHub Desktop.
Get group members csv
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
// scroll down to the bottom of list of group members | |
// then insert this code | |
var wrapper = document.getElementById('groupsMemberSection_recently_joined'); | |
var csv = ''; | |
var people = wrapper.getElementsByClassName('_60rh _gse'); | |
var _csv = []; | |
var person, position, year; | |
for (var i = 0, len = people.length; i < len; i++) { | |
person = people[i].getElementsByClassName('_60ri')[0].innerText + ';'; | |
position = people[i].querySelectorAll('._60rj:last-child')[0].innerHTML; | |
link = people[i].querySelectorAll('._60ri a')[0].href.split('?')[0]; | |
if (position.indexOf(' at ') != -1) { | |
position = position.split(' at '); | |
person += position[0] + ';' + position[1]; | |
} else { | |
person += ';' + position; | |
} | |
person += ';' + link; | |
year = people[i].querySelectorAll('._60rj')[0] | |
year_text = year.innerText.split(' ').pop(); | |
if (year_text == 'ago') { | |
year_text = 2018 - year.innerText.split(' years ago')[0].split(' ').pop(); | |
} | |
person += ';' + year_text; | |
_csv.push(person); | |
} | |
csv = _csv.join('\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment