Commit daacdf85 by Vitalik

Add parser

parent adc7cb13
Pipeline #227 skipped
{
"name": "linkedin-public-profile",
"version": "1.3.4",
"version": "1.3.5",
"description": "A scraper for LinkedIn public profiles",
"main": "index.js",
"scripts": {
......
var awardsAnalysis = function ($, profile) {
// awards
profile.awards = [];
$('#awards li.award').each(function () {
var $item = $(this);
var awards = [];
$item.find('li.course').each(function(k, el) {
awards.push($(el).text());
});
profile.awards.push({
title : $item.find('.item-title').text(),
subtitle : $item.find('.item-subtitle').text(),
date : $item.find('.date-range').text(),
description : $item.find('.description').text()
});
});
return profile;
};
module.exports = awardsAnalysis;
......@@ -10,7 +10,7 @@ var baseAnalysis = function ($, profile) {
// Picture
try {
profile.picture = $('.profile-picture img')[0].attributes['data-delayed-url']._nodeValue;
profile.picture = $('.profile-picture img:first').data('delayed-url');
} catch (err) {
profile.picture = '';
}
......
var languagesAnalysis = function ($, profile) {
// Education
profile.languages = {};
$('#languages .language').each(function () {
var $item = $(this);
var name = $item.find('.name').text();
var proficiency = $item.find('.proficiency').text();
profile.languages[name] = proficiency;
});
return profile;
};
module.exports = languagesAnalysis;
......@@ -6,14 +6,16 @@ var analyse = function (window, url) {
try {
var $ = window.$;
var profile = new Profile($)
.base()
.featured()
.positions()
.skills()
.educations()
.certifications()
.courses()
.clean();
.base()
.featured()
.positions()
.skills()
.educations()
.certifications()
.courses()
.awards()
.languages()
.clean();
links = linkedPeople($);
......
......@@ -7,6 +7,8 @@ var skillsAnalysis = require('./analyse-parts/skills');
var educationsAnalysis = require('./analyse-parts/educations');
var certificationsAnalysis = require('./analyse-parts/certifications');
var coursesAnalysis = require('./analyse-parts/courses');
var awardsAnalysis = require('./analyse-parts/awards');
var languagesAnalysis = require('./analyse-parts/languages');
class Profile {
constructor($) {
......@@ -41,6 +43,14 @@ class Profile {
return coursesAnalysis(this.$, this);
}
awards() {
return awardsAnalysis(this.$, this);
}
languages() {
return languagesAnalysis(this.$, this);
}
clean() {
delete this.$;
return this;
......
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