Commit 685cd17e by Julian Beisenkötter

initial commit

parents
The MIT License (MIT)
Copyright (c) 2015 Aaditya Sriram
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[![npm version](https://badge.fury.io/js/linkedin-public-profile.svg)](https://badge.fury.io/js/linkedin-public-profile)
[![npm](https://img.shields.io/npm/dt/linkedin-public-profile.svg)](https://www.npmjs.com/package/linkedin-public-profile)
[![NPM](https://nodei.co/npm/linkedin-public-profile.png?compact=true)](https://nodei.co/npm/linkedin-public-profile/)
# linkedin-public-profile
Tiny LinkedIn profile scraper for public profiles.
## Installation
in console:
```
npm install linkedin-public-profile
```
and in file:
```javascript
var LinkedInProfile = require('linkedin-public-profile');
```
## Usage
just call the module with a public linkedin profile url. It returns a promise which resolves to the profile.
```javascript
var LinkedInProfile = require('linkedin-public-profile');
var url = 'https://de.linkedin.com/in/julian-beisenk%C3%B6tter-77038939';
LinkedInProfile(url)
.then(function(profile){
console.log(profile);
});
```
The result looks like:
```json
{
"url": "https://de.linkedin.com/in/julian-beisenk%C3%B6tter-77038939",
"name": "Julian Beisenkötter",
"headline": "Tech Developer bei HitFox Group",
"location": "Berlin und Umgebung, Deutschland",
"industry": "Computer-Software",
"featured_current": "HitFox Group",
"featured_past": "HitFox Group",
"featured_education": "DHBW Ravensburg",
"contacts": "185",
"positions": [
{
"position": "Tech Developer",
"companyName": "HitFox Group",
"dates": {
"from": "Oktober 2015",
"to": ""
},
"locality": "",
"description": "Product Management, Business Model Innovation, Business Development, Project Management, Prototyping, Technical Feasibility Analysis, Big Data, Financial Services, AdTech, ",
"current": true
},
{
"position": "CEO",
"companyName": "eXalted IT UG (haftungsbeschränkt)",
"dates": {
"from": "Februar 2011",
"to": ""
},
"locality": "Münster und Umgebung, Deutschland",
"description": "Business Development, Startup Consultant, Software EvangelistEntrepreneur, Geschäftsführer",
"current": true
},
{
"position": "Consultant",
"companyName": "Accenture",
"dates": {
"from": "Oktober 2012",
"to": "September 2015"
},
"locality": "",
"description": "Software Architect; Infrastructure Architect;",
"current": false
},
{
"position": "Studentische Hilfskraft",
"companyName": "Duale Hochschule Baden-Württemberg (DHBW)",
"dates": {
"from": "Oktober 2012",
"to": "Dezember 2012"
},
"locality": "",
"description": "Grundlagen der Programmierung",
"current": false
},
{
"position": "IT-Abteilung",
"companyName": "Max-Planck Institute for molecular Biomedicine",
"dates": {
"from": "Juli 2010",
"to": "Mai 2012"
},
"locality": "",
"description": "Infrastructure Management",
"current": false
},
{
"position": "Oracle PL/SQL Consultant",
"companyName": "Biss Consulting",
"dates": {
"from": "Juli 2011",
"to": "November 2011"
},
"locality": "",
"description": "Database Developer",
"current": false
}
],
"skills": [
"Consulting",
"Entrepreneurship",
"Business Model Innovation",
"Design Thinking",
"Software Prototyping",
"Ruby",
"AngularJS",
"Ruby on Rails",
"Mobile Applications",
"Lean Startup",
"Web Development",
"Responsive Web Design",
"Rapid Prototyping",
"Linux",
"Python",
"Bash",
"Git",
"MySQL",
"PHP",
"CSS",
"HTML5",
"Automobilindustrie",
"Microservices",
"Projektmanagement",
"Datenbanken",
"SQL",
"Java",
"JavaScript",
"IT-Strategie",
"Softwareentwicklung",
"Start-ups",
"Agile Methoden",
"Business-Intelligence",
"Geschäftsprozesse",
"Veränderungsmanagement",
"Unternehmensführung",
"Unternehmensstrategie"
],
"educations": [
{
"school": "DHBW Ravensburg",
"course": "Bachelor of Science (BSc), Economics and Computer science, Business Engineering, ECTS Grade A",
"dates": {
"from": "2012",
"to": "2015"
},
"description": "Business Engineering, Consulting, SAP, Java, Projektmanagement, Software-engineering, Requirements-engineering, IT-Management, ERP, CRM, SCMAktivitäten und Verbände: Tutor: Software Entwicklung"
},
{
"school": "Durban University of Technology",
"course": "Exchange, International Management, Project Management",
"dates": {
"from": "2014",
"to": "2014"
},
"description": "Project Management, IT-Management, Financial Accounting, International Management, Contract Management"
},
{
"school": "Fachhochschule Münster",
"course": "Bachelor of Applied Science (BASc), Wirtschaftsinformatik",
"dates": {
"from": "2011",
"to": "2012"
},
"description": "Webentwicklung,Softwareentwicklung, IT-Management, Projektmanagement, IT-Infrastruktur"
},
{
"school": "Hans Böckler Berufskolleg Münster",
"course": "Abitur, Mathematik und Datenverarbeitungstechnik",
"dates": {
"from": "2008",
"to": "2011"
},
"description": "Aktivitäten und Verbände: Schülersprecher"
},
{
"school": "Hans Böckler Berufskolleg Münster",
"course": "Informationstechnischer Assistent, Elektrotechnik Informatik Wirtschaft",
"dates": {
"from": "2008",
"to": "2011"
},
"description": "Netzwerktechnik, Technische Informatik, Datenbanken, Wirtschaft, Projektentmanagement, Grundlagen Softwareentwicklung, Philosophie"
},
{
"school": "Waldorfschule Münster",
"course": "FOR, Fachoberschulreife",
"dates": {
"from": "1997",
"to": "2008"
},
"description": ""
}
]
}
```
## License
The MIT License (MIT)
Copyright (c) 2015 Aaditya Sriram
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
var analyse = function (window, url) {
return new Promise(function(resolve, reject){
try {
var links = [];
var profile = {};
var $ = window.$;
profile.url = $("link[rel='canonical']").attr("href");
// Header Info
profile.name = $("h1#name").text();
profile.headline = $("p.headline.title").text();
profile.location = $("dl#demographics .descriptor.adr span.locality").text();
profile.industry = $("dl#demographics dd:nth-child(4)").text();
// Picture
profile.picture = $("profile-picture img").attr('src');
// Featured Info
profile.featured_current = $(".extra-info span.org").text();
profile.featured_past = $(".extra-info span.org").text();
profile.featured_education = $(".extra-info [data-section='educations'] td ol li").text();
profile.contacts = $(".member-connections strong").text();
// Experiences
profile.positions = [];
$("#experience .positions .position").each(function() {
var positionItem = $(this);
var position = {
position: positionItem.find(".item-title").text(),
companyName: positionItem.find(".item-subtitle").text(),
dates: {
from: positionItem.find(".meta .date-range time:nth-child(1)").text(),
to: positionItem.find(".meta .date-range time:nth-child(2)").text()
},
locality: positionItem.find(".meta .location").text(),
description: positionItem.find(".description").text(),
current: (positionItem.attr('data-section') == "currentPositions")
};
profile.positions.push(position);
});
// Skills
profile.skills = [];
$("#skills .pills li").each(function(){
var skill = $(this);
var more = skill.hasClass('see-more');
var less = skill.hasClass('see-less');
if(!more && !less){
profile.skills.push(skill.text());
}
});
// Education
profile.educations = [];
$("#education .schools .school").each(function() {
var schoolItem = $(this);
var school = {
school: schoolItem.find(".item-title").text(),
course: schoolItem.find(".item-subtitle").text(),
dates: {
from: schoolItem.find(".meta .date-range time:nth-child(1)").text(),
to: schoolItem.find(".meta .date-range time:nth-child(2)").text()
},
description: schoolItem.find(".description p").text()
};
profile.educations.push(school);
});
$('.browse-map .profile-card a').each(function(){
var link = $(this).attr('href');
links.push(link);
});
resolve({profile: profile, links: links})
} catch (err) {
reject(err)
}
});
};
module.exports = analyse;
var LinkedInProfile = require('./index');
var url = 'https://de.linkedin.com/in/julian-beisenk%C3%B6tter-77038939';
// standard usage
LinkedInProfile(url)
.then(function(profile){ // chain your logic
console.log(profile);
});
// With links to similar profiles
LinkedInProfile(url, true)
.then(function(result){
console.log(result.profile); // the requested profile
console.log(result.links); // the featured profiles on the page
});
// usage with HTML
var request = require('request-promise');
request(url) // request with html output
.then(function(html){ // promise chain
return LinkedInProfile(html)// return the LinkedInProfile promise
})
.then(function(profile){ // chain your logic
console.log(profile);
});
// Scrape a linkedin profile for the public contents
var Promise = require("bluebird");
var analyser = require("./analyser");
var retrieve = require("./retrieve");
function getProfile(param, withlinks) {
return new Promise(function(resolve, reject){
retrieve(param) // retrieve Profile
.then(function(window){
return analyser(window); // Analyse Page
})
.then(function(result){
if(withlinks){
resolve(result); // resolve to obj: {profile, links}
}else{
resolve(result.profile);// resolve to profile
}
}).catch(function(err){
reject(err);
});
});
}
module.exports = getProfile;
{
"name": "linkedin-public-profile",
"version": "1.0.0",
"description": "A scraper for LinkedIn public profiles",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "julianbei",
"license": "MIT",
"dependencies": {
"bluebird": "^3.3.1",
"jquery": "^2.1.3",
"jsdom": "5.6.1"
}
}
var jsdom = require("jsdom");
var retrieve = function (param) {
return new Promise(function(resolve, reject){
try {
var pattern = "^((https|http|ftp|rtsp|mms)?://)"
+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?"
+ "(([0-9]{1,3}\.){3}[0-9]{1,3}"
+ "|"
+ "([0-9a-z_!~*'()-]+\.)*"
+ "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\."
+ "[a-z]{2,6})"
+ "(:[0-9]{1,4})?"
+ "((/?)|"
+ "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
var regex = new RegExp(pattern);
var isURL = regex.test(param);
var callback = function(errors, window){
if(errors){
reject(errors);
}else{
resolve(window)
}
};
if(!isURL){
jsdom.env(param,
["http://code.jquery.com/jquery.js"],
callback
);
}else{
jsdom.env({ url: param,
scripts: ["http://code.jquery.com/jquery.js"],
done: callback
});
}
} catch (err) {
reject(err)
}
});
};
module.exports = retrieve;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment