Last active
February 22, 2021 13:59
-
-
Save leosoto/476c4b31be35b01b677212c92383bbe3 to your computer and use it in GitHub Desktop.
Mini-scraper for linkedin followers
This file contains 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
function scrapeData() { | |
let links = $$('.org-view-page-followers-modal__table-cell a') | |
let nameDivs = $$('.org-view-page-followers-modal__table-cell a .artdeco-entity-lockup__title') | |
let dateSpans = $$('.org-view-page-followers-modal__table-cell span span[aria-hidden]') | |
let captionDivs = $$('.org-view-page-followers-modal__table-cell a .artdeco-entity-lockup__caption') | |
let data = []; | |
for (let i = 0; i < links.length; i++) { | |
data.push([ | |
nameDivs[i].innerText, | |
captionDivs[i].innerText, | |
dateSpans[i].innerText, | |
links[i].href | |
]) | |
} | |
return data | |
} | |
function exportDataInTextArea(data) { | |
let dataAsTabSeparatedColumns = data.map( row => row.join("\t")).join("\n") | |
let textArea = document.createElement("textarea") | |
textArea.appendChild(document.createTextNode(dataAsTabSeparatedColumns)) | |
let header = $('#artdeco-modal-outlet .artdeco-modal__header') | |
header.appendChild(textArea) | |
} | |
exportDataInTextArea(scrapeData()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment