Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shiqiyue-linkedin-private-api

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shiqiyue-linkedin-private-api - npm Package Compare versions

Comparing version 1.1.9 to 1.1.10

6

dist/src/core/login.d.ts

@@ -0,1 +1,2 @@

import { AuthCookies } from '../types/auth-cookies';
import { Client } from './client';

@@ -17,8 +18,5 @@ export declare class Login {

username?: string;
cookies: {
JSESSIONID: string;
li_at?: string;
};
cookies: AuthCookies;
useCache?: boolean;
}): Promise<Client>;
}

@@ -21,2 +21,15 @@ "use strict";

});
this.request.interceptors.request.use(function (config) {
console.log('请求参数:', config);
return config;
}, error => {
return Promise.reject(error);
});
this.request.interceptors.response.use(function (response) {
console.log('返回结果', response);
return response;
}, error => {
console.log('返回错误:', error);
return Promise.reject(error);
});
this.request.defaults.adapter = require('axios/lib/adapters/http');

@@ -23,0 +36,0 @@ }

@@ -10,8 +10,8 @@ import { Client } from '../core/client';

getSentInvitations({ skip, limit }?: {
skip?: number | undefined;
limit?: number | undefined;
skip?: number;
limit?: number;
}): InvitationScroller;
getReceivedInvitations({ skip, limit }?: {
skip?: number | undefined;
limit?: number | undefined;
skip?: number;
limit?: number;
}): InvitationScroller;

@@ -18,0 +18,0 @@ sendInvitation({ profileId, trackingId, message, }: {

@@ -19,2 +19,5 @@ import { Client } from '../core/client';

getOwnProfile(): Promise<Profile | null>;
getFullProfile({ publicIdentifier }: {
publicIdentifier: string;
}): Promise<any>;
}

@@ -45,4 +45,7 @@ "use strict";

}
async getFullProfile({ publicIdentifier }) {
return this.client.request.profile.getFullProfile({ account: publicIdentifier });
}
}
exports.ProfileRepository = ProfileRepository;
//# sourceMappingURL=profile.repository.js.map

@@ -18,9 +18,9 @@ import { LinkedInRequest } from '../core/linkedin-request';

getReceivedInvitations({ skip, limit }?: {
skip?: number | undefined;
limit?: number | undefined;
skip?: number;
limit?: number;
}): Promise<GetReceivedInvitationResponse>;
getSentInvitations({ skip, limit }?: {
skip?: number | undefined;
limit?: number | undefined;
skip?: number;
limit?: number;
}): Promise<GetSentInvitationResponse>;
}

@@ -13,2 +13,26 @@ import { LinkedInRequest } from '../core/linkedin-request';

getOwnProfile(): Promise<GetOwnProfileResponse>;
getFullProfile({ account }: {
account: string;
}): Promise<any>;
_fetchProfileResource({ account, resource }: {
account: string;
resource: string;
}): Promise<any>;
_scrubFullProfileResponse({ profile }: {
profile: any;
}): any;
_scrubEducationInfo(education: any): any;
_scrubPathToResource(resource: any): any;
_scrubPositionInfo(position: any): any;
_scrubWebsiteInfo(website: any): any;
_scrubPublicationInfo(publication: any): any;
_scrubMemberInfo(member: any): any;
_scrubIdFromUrn(urn: any): any;
_scrubPatentInfo(patent: any): any;
_scrubProjectInfo(project: any): {
description: any;
timePeriod: any;
title: any;
url: any;
};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfileRequest = void 0;
const LI_CDN = 'https://media-exp2.licdn.com/media';
class ProfileRequest {

@@ -21,4 +22,234 @@ constructor({ request }) {

}
getFullProfile({ account }) {
if (!account) {
throw new Error('a public account is required');
}
const resources = ['profileView', 'profileContactInfo', 'highlights'];
return Promise.all(resources.map(resource => this._fetchProfileResource({ account, resource })))
.then((responses) => {
const fullProfile = { account };
responses.map(res => Object.assign(fullProfile, res));
console.log(fullProfile);
return Promise.resolve(this._scrubFullProfileResponse({ profile: fullProfile }));
});
}
_fetchProfileResource({ account, resource }) {
let url = `/voyager/api/identity/profiles/${account}/`;
if (!resource) {
url += 'profileView';
}
else {
url += resource;
}
const headers = Object.assign(this.request.request.defaults.headers, {
accept: "*/*"
});
delete headers["x-restli-protocol-version"];
delete headers["x-li-page-instance"];
delete headers["x-li-track"];
return this.request.get(url, { headers: headers });
}
_scrubFullProfileResponse({ profile }) {
const socialProfile = {
source: 'LinkedIn',
firstname: undefined,
lastname: undefined,
headline: undefined,
industryName: undefined,
summary: undefined,
emailAddress: undefined,
location: undefined,
publicIdentifier: undefined,
occupation: undefined,
address: undefined,
birthdate: undefined,
phoneNumbers: undefined,
twitterHandles: undefined,
picture: undefined,
education: undefined,
patents: undefined,
publications: undefined,
projects: undefined,
positions: undefined,
languages: undefined,
skills: undefined,
websites: undefined
};
socialProfile.firstname = profile.profile.firstName || '';
socialProfile.lastname = profile.profile.lastName || '';
socialProfile.headline = profile.profile.headline || '';
socialProfile.industryName = profile.profile.industryName || '';
socialProfile.summary = profile.profile.summary || '';
socialProfile.location = profile.profile.locationName || '';
socialProfile.emailAddress = profile.emailAddress || '';
socialProfile.publicIdentifier = profile.publicIdentifier;
socialProfile.occupation = profile.profile.miniProfile.occupation || '';
socialProfile.address = profile.profile.address || '';
socialProfile.birthdate = profile.birthDateOn || {};
socialProfile.phoneNumbers = [];
socialProfile.twitterHandles = [];
socialProfile.picture = '';
if (profile.hasOwnProperty('phoneNumbers')) {
socialProfile.phoneNumbers = profile.phoneNumbers;
}
if (profile.hasOwnProperty('twitterHandles')) {
socialProfile.twitterHandles = profile.twitterHandles.map(twitter => twitter.name) || [];
}
if (profile.profile.hasOwnProperty('pictureInfo') &&
profile.profile.pictureInfo.hasOwnProperty('masterImage')) {
socialProfile.picture = `${LI_CDN}${profile.profile.pictureInfo.masterImage}`;
}
socialProfile.education = profile.educationView.elements.map(e => this._scrubEducationInfo(e)) || [];
socialProfile.patents = profile.patentView.elements.map(p => this._scrubPatentInfo(p)) || [];
socialProfile.publications = profile.publicationView.elements.map(p => this._scrubPublicationInfo(p)) || [];
socialProfile.projects = profile.projectView.elements.map(p => this._scrubProjectInfo(p)) || [];
socialProfile.positions = profile.positionView.elements.map(p => this._scrubPositionInfo(p)) || [];
socialProfile.languages = profile.languageView.elements.map(language => language.name) || [];
socialProfile.skills = profile.skillView.elements.map(skill => skill.name) || [];
if (profile.hasOwnProperty('websites') && profile.websites.length > 0) {
socialProfile.websites = profile.websites.map(w => this._scrubWebsiteInfo(w)) || [];
}
if (socialProfile.headline === socialProfile.occupation) {
const currentPositions = profile.positionView.elements
.filter(p => p.hasOwnProperty('timePeriod') && p.timePeriod.hasOwnProperty('startDate') && !p.timePeriod.hasOwnProperty('endDate')) || [];
const currentPosition = currentPositions[0] || {};
socialProfile.occupation = currentPosition.title || '';
}
return socialProfile;
}
_scrubEducationInfo(education) {
const educationInfo = {
activities: education.activities || '',
degreeName: education.degreeName || '',
fieldOfStudy: education.fieldOfStudy || '',
timePeriod: education.timePeriod || {},
schoolName: education.schoolName || '',
school: undefined
};
if (education.hasOwnProperty('school')) {
educationInfo.school = {
active: education.school.active || false,
name: education.school.schoolName || ''
};
if (education.school.hasOwnProperty('logo')) {
educationInfo.school.logo = this._scrubPathToResource(education.school.logo);
}
}
return educationInfo;
}
_scrubPathToResource(resource) {
if (resource.constructor !== Object) {
return '';
}
const key = Object.keys(resource)[0];
let resourcePath = resource[key].id || '';
if (resourcePath) {
resourcePath = `${LI_CDN}${resourcePath}`;
}
return resourcePath;
}
_scrubPositionInfo(position) {
let linkedInCompanyId = '';
if (position.companyUrn) {
const pieces = position.companyUrn.split(':');
linkedInCompanyId = parseInt(pieces[pieces.length - 1], 10) + '';
}
const positionInfo = {
locationName: position.locationName || '',
companyName: position.companyName || '',
linkedInCompanyId: linkedInCompanyId,
description: position.description || '',
timePeriod: position.timePeriod || {},
title: position.title || '',
company: undefined
};
if (position.hasOwnProperty('company')) {
positionInfo.company = {
employeeCountRange: position.company.employeeCountRange || {},
industries: position.company.industries || []
};
if (position.company.hasOwnProperty('miniCompany') &&
position.company.miniCompany.hasOwnProperty('logo')) {
positionInfo.company.logo = this._scrubPathToResource(position.company.miniCompany.logo);
}
}
return positionInfo;
}
_scrubWebsiteInfo(website) {
const categoryType = Object.keys(website.type)[0];
return {
website: website.url,
type: website.type[categoryType].category || 'Portfolio'
};
}
_scrubPublicationInfo(publication) {
const publicationInfo = {
date: publication.date || {},
description: publication.description || '',
name: publication.name || '',
publisher: publication.publisher || '',
url: publication.url || '',
authors: undefined
};
if (publication.hasOwnProperty('authors') && publication.authors.length > 0) {
publicationInfo.authors = publication.authors.map(author => this._scrubMemberInfo(author));
}
return publicationInfo;
}
_scrubMemberInfo(member) {
if (!member) {
return { firstname: '', lastname: '', occupation: '', publicIdentifier: '' };
}
const memberInfo = {
firstname: (member.member && member.member.firstName) ? member.member.firstName : '',
lastname: (member.member && member.member.lastName) ? member.member.lastName : '',
occupation: (member.member && member.member.occupation) ? member.member.occupation : '',
publicIdentifier: (member.member && member.member.publicIdentifier) ? member.member.publicIdentifier : '',
picture: undefined
};
if (member.member && member.member.hasOwnProperty('picture')) {
memberInfo.picture = this._scrubPathToResource(member.member.picture);
}
return memberInfo;
}
_scrubIdFromUrn(urn) {
if (!urn) {
return '';
}
const pieces = urn.split(':');
return parseInt(pieces[pieces.length - 1], 10);
}
_scrubPatentInfo(patent) {
const patentInfo = {
applicationNumber: patent.applicationNumber || '',
description: patent.description || '',
filingDate: patent.filingDate || {},
issueDate: patent.issueDate || {},
number: patent.number || '',
pending: patent.pending,
title: patent.title || '',
url: patent.url || '',
inventors: undefined
};
if (patent.hasOwnProperty('inventors') && patent.inventors.length > 0) {
patentInfo.inventors = patent.inventors
.filter(inventor => inventor.hasOwnProperty('member'))
.map(inventor => this._scrubMemberInfo(inventor.member));
}
return patentInfo;
}
_scrubProjectInfo(project) {
const projectInfo = {
description: project.description || '',
timePeriod: project.timePeriod || {},
title: project.title || '',
url: project.url || ''
};
if (project.hasOwnProperty('members') && project.members.length > 0) {
project.members = project.members.map(member => this._scrubMemberInfo(member));
}
return projectInfo;
}
}
exports.ProfileRequest = ProfileRequest;
//# sourceMappingURL=profile.request.js.map
{
"name": "shiqiyue-linkedin-private-api",
"version": "1.1.9",
"version": "1.1.10",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc