Created
March 8, 2023 00:44
-
-
Save clod81/9f7ae66de313b0212432c8df8096b587 to your computer and use it in GitHub Desktop.
LinkedIn JS scrape company employees and position
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
// 1. Access a company page on LinkedIn and click on the company employees | |
// 2. Open the browser dev console | |
// 3. Import jQuery first (copy and paste jQuery into browser dev console will do) | |
// 4. Copy and paste the below in the console | |
// 5. Wait until the last page (10 people per page are displayed) | |
// 6. Enjoy the list in console output | |
function scrape(){ | |
jQuery.each(jQuery('span.entity-result__title-line span a span span[aria-hidden="true"]'), function(i,v){ | |
console.log((v.innerHTML.replace(/<!---->/g, "").replace(/ /g, " "))); | |
console.log($(v).parentsUntil('div.t-roman').last().parent().next().find('div.entity-result__primary-subtitle').last().text()) | |
}); | |
} | |
function next(){ | |
jQuery(document).scrollTop(1200); | |
jQuery('div.artdeco-pagination span.artdeco-button__text').last().click() | |
} | |
setInterval(function(){scrape();next()}, 1500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment