Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
linkedin-public-profile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mbas
linkedin-public-profile
Commits
7b814655
Commit
7b814655
authored
Mar 29, 2016
by
julianbei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfixes
parent
351bee8a
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
96 additions
and
90 deletions
+96
-90
home.js
home.js
+5
-6
base.js
src/analyse-parts/base.js
+10
-9
educations.js
src/analyse-parts/educations.js
+9
-8
featured.js
src/analyse-parts/featured.js
+5
-4
linkedPeople.js
src/analyse-parts/linkedPeople.js
+3
-2
positions.js
src/analyse-parts/positions.js
+11
-10
skills.js
src/analyse-parts/skills.js
+10
-8
analyser.js
src/analyser.js
+3
-3
index.js
src/index.js
+9
-9
profile.js
src/profile.js
+12
-12
retrieve.js
src/retrieve.js
+19
-19
No files found.
home.js
View file @
7b814655
...
...
@@ -3,14 +3,13 @@ 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
LinkedInProfile
(
url
).
then
(
function
(
profile
)
{
// chain your logic
console
.
log
(
profile
);
});
// With links to similar profiles
LinkedInProfile
(
url
,
true
)
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
console
.
log
(
result
.
profile
);
// the requested profile
console
.
log
(
result
.
links
);
// the featured profiles on the page
});
...
...
@@ -19,9 +18,9 @@ LinkedInProfile(url, true)
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
(
html
)
{
// promise chain
return
LinkedInProfile
(
html
);
// return the LinkedInProfile promise
})
.
then
(
function
(
profile
)
{
// chain your logic
.
then
(
function
(
profile
)
{
// chain your logic
console
.
log
(
profile
);
});
src/analyse-parts/base.js
View file @
7b814655
var
baseAnalysis
=
function
(
$
,
profile
)
{
profile
.
url
=
$
(
"link[rel='canonical']"
).
attr
(
"href"
);
profile
.
contacts
=
$
(
".member-connections strong"
).
text
();
var
baseAnalysis
=
function
(
$
,
profile
)
{
profile
.
url
=
$
(
"link[rel='canonical']"
).
attr
(
'href'
);
profile
.
contacts
=
$
(
'.member-connections strong'
).
text
();
// 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
();
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
try
{
profile
.
picture
=
$
(
".profile-picture img"
)[
0
].
attributes
[
'data-delayed-url'
].
_nodeValue
;
profile
.
picture
=
$
(
'.profile-picture img'
)[
0
].
attributes
[
'data-delayed-url'
].
_nodeValue
;
}
catch
(
err
)
{
profile
.
picture
=
''
;
}
return
profile
;
}
};
module
.
exports
=
baseAnalysis
;
src/analyse-parts/educations.js
View file @
7b814655
var
educationsAnalysis
=
function
(
$
,
profile
)
{
var
educationsAnalysis
=
function
(
$
,
profile
)
{
// Education
profile
.
educations
=
[];
$
(
"#education .schools .school"
).
each
(
function
()
{
var
schoolItem
=
$
(
this
);
$
(
'#education .schools .school'
).
each
(
function
()
{
var
$
schoolItem
=
$
(
this
);
var
school
=
{
school
:
schoolItem
.
find
(
".item-title"
).
text
(),
course
:
schoolItem
.
find
(
".item-subtitle"
).
text
(),
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
()
school
:
$schoolItem
.
find
(
'.item-title'
).
text
(),
course
:
$schoolItem
.
find
(
'.item-subtitle'
).
text
(),
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
);
});
return
profile
;
};
...
...
src/analyse-parts/featured.js
View file @
7b814655
var
featuredAnalysis
=
function
(
$
,
profile
)
{
var
featuredAnalysis
=
function
(
$
,
profile
)
{
// Featured Info
profile
.
featured_current
=
$
(
".extra-info span.org"
).
text
();
profile
.
featured_past
=
$
(
".extra-info span.org"
).
text
();
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
();
return
profile
;
}
};
module
.
exports
=
featuredAnalysis
;
src/analyse-parts/linkedPeople.js
View file @
7b814655
var
linkedPeople
=
function
(
$
,
links
)
{
var
linkedPeople
=
function
(
$
,
links
)
{
var
links
=
[];
$
(
'.browse-map .profile-card a'
).
each
(
function
()
{
$
(
'.browse-map .profile-card a'
).
each
(
function
()
{
var
link
=
$
(
this
).
attr
(
'href'
);
links
.
push
(
link
);
});
return
links
;
};
...
...
src/analyse-parts/positions.js
View file @
7b814655
var
positionsAnalysis
=
function
(
$
,
profile
)
{
var
positionsAnalysis
=
function
(
$
,
profile
)
{
// Experiences
profile
.
positions
=
[];
$
(
"#experience .positions .position"
).
each
(
function
()
{
var
positionItem
=
$
(
this
);
$
(
'#experience .positions .position'
).
each
(
function
()
{
var
$
positionItem
=
$
(
this
);
var
position
=
{
position
:
positionItem
.
find
(
".item-title"
).
text
(),
companyName
:
positionItem
.
find
(
".item-subtitle"
).
text
(),
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"
)
position
:
$positionItem
.
find
(
'.item-title'
).
text
(),
companyName
:
$positionItem
.
find
(
'.item-subtitle'
).
text
(),
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'
)
==
'currentPositionsDetails'
),
};
profile
.
positions
.
push
(
position
);
});
return
profile
;
};
...
...
src/analyse-parts/skills.js
View file @
7b814655
var
skillsAnalysis
=
function
(
$
,
profile
)
{
var
skillsAnalysis
=
function
(
$
,
profile
)
{
// Skills
profile
.
skills
=
[];
$
(
"#skills .pills li"
).
each
(
function
()
{
var
skill
=
$
(
this
);
var
more
=
skill
.
hasClass
(
'see-more'
);
var
less
=
skill
.
hasClass
(
'see-less'
);
$
(
'#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
({
name
:
skill
.
text
()
});
if
(
!
more
&&
!
less
)
{
profile
.
skills
.
push
({
name
:
$skill
.
text
()
});
}
});
return
profile
;
}
};
module
.
exports
=
skillsAnalysis
;
src/analyser.js
View file @
7b814655
...
...
@@ -2,7 +2,7 @@ var Profile = require('./profile');
var
linkedPeople
=
require
(
'./analyse-parts/linkedPeople'
);
var
analyse
=
function
(
window
,
url
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
try
{
var
$
=
window
.
$
;
var
profile
=
new
Profile
(
$
)
...
...
@@ -15,9 +15,9 @@ var analyse = function (window, url) {
links
=
linkedPeople
(
$
);
resolve
({
profile
:
profile
,
links
:
links
})
resolve
({
profile
:
profile
,
links
:
links
});
}
catch
(
err
)
{
reject
(
err
)
reject
(
err
)
;
}
});
};
...
...
src/index.js
View file @
7b814655
// Scrape a linkedin profile for the public contents
var
Promise
=
require
(
"bluebird"
);
var
analyser
=
require
(
"./analyser"
);
var
retrieve
=
require
(
"./retrieve"
);
var
Promise
=
require
(
'bluebird'
);
var
analyser
=
require
(
'./analyser'
);
var
retrieve
=
require
(
'./retrieve'
);
function
getProfile
(
param
,
withlinks
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
retrieve
(
param
)
// retrieve Profile
.
then
(
function
(
window
)
{
.
then
(
function
(
window
)
{
return
analyser
(
window
);
// Analyse Page
})
.
then
(
function
(
result
)
{
if
(
withlinks
)
{
.
then
(
function
(
result
)
{
if
(
withlinks
)
{
resolve
(
result
);
// resolve to obj: {profile, links}
}
else
{
}
else
{
resolve
(
result
.
profile
);
// resolve to profile
}
}).
catch
(
function
(
err
)
{
}).
catch
(
function
(
err
)
{
reject
(
err
);
});
...
...
src/profile.js
View file @
7b814655
"use strict"
;
'use strict'
;
var
baseAnalysis
=
require
(
'./analyse-parts/base'
);
var
featuredAnalysis
=
require
(
'./analyse-parts/featured'
);
...
...
@@ -11,28 +11,28 @@ class Profile {
this
.
$
=
$
;
}
base
(){
base
()
{
return
baseAnalysis
(
this
.
$
,
this
);
}
featured
(){
return
featuredAnalysis
(
this
.
$
,
this
)
featured
()
{
return
featuredAnalysis
(
this
.
$
,
this
)
;
}
positions
(){
return
positionsAnalysis
(
this
.
$
,
this
)
positions
()
{
return
positionsAnalysis
(
this
.
$
,
this
)
;
}
skills
(){
return
skillsAnalysis
(
this
.
$
,
this
)
skills
()
{
return
skillsAnalysis
(
this
.
$
,
this
)
;
}
educations
(){
return
educationsAnalysis
(
this
.
$
,
this
)
educations
()
{
return
educationsAnalysis
(
this
.
$
,
this
)
;
}
clean
(){
delete
this
.
$
clean
()
{
delete
this
.
$
;
return
this
;
}
...
...
src/retrieve.js
View file @
7b814655
var
jsdom
=
require
(
"jsdom"
);
var
jsdom
=
require
(
'jsdom'
);
var
retrieve
=
function
(
param
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
try
{
var
pattern
=
"^((https|http|ftp|rtsp|mms)?://)"
var
pattern
=
'^((https|http|ftp|rtsp|mms)?://)'
+
"?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?"
+
"(([0-9]{1,3}
\
.){3}[0-9]{1,3}"
+
"|"
+
'(([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][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
)
{
var
callback
=
function
(
errors
,
window
)
{
if
(
errors
)
{
reject
(
errors
);
}
else
{
resolve
(
window
)
}
else
{
resolve
(
window
)
;
}
};
if
(
!
isURL
)
{
if
(
!
isURL
)
{
jsdom
.
env
(
param
,
[
"http://code.jquery.com/jquery.js"
],
[
'http://code.jquery.com/jquery.js'
],
callback
);
}
else
{
}
else
{
jsdom
.
env
({
url
:
param
,
scripts
:
[
"http://code.jquery.com/jquery.js"
],
done
:
callback
scripts
:
[
'http://code.jquery.com/jquery.js'
],
done
:
callback
,
});
}
}
catch
(
err
)
{
reject
(
err
)
reject
(
err
)
;
}
});
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment