Skip to content

Instantly share code, notes, and snippets.

@leosoto
Last active February 22, 2021 13:59
Show Gist options
  • Save leosoto/476c4b31be35b01b677212c92383bbe3 to your computer and use it in GitHub Desktop.
Save leosoto/476c4b31be35b01b677212c92383bbe3 to your computer and use it in GitHub Desktop.
Mini-scraper for linkedin followers
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