mirror of
https://github.com/ION606/linkedin-api.git
synced 2026-06-05 23:16:14 +00:00
added fetching company website
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import axios from "axios";
|
||||
import * as cheerio from 'cheerio';
|
||||
import linkedInAPIClass from "../index.js";
|
||||
import { LinkedInProfile } from "./Profile.js";
|
||||
|
||||
@@ -78,6 +80,12 @@ export class Company {
|
||||
this.url = data.navigationUrl;
|
||||
this.entityNum = data.trackingUrn.replace('urn:li:company:', '');
|
||||
|
||||
axios.get(this.url).then(r => {
|
||||
const $ = cheerio.load(r.data);
|
||||
const u = $('a[aria-describedby="websiteLinkDescription"]')?.attr('href')?.split('url=http')?.at(1)?.split('&')[0];
|
||||
if (u) this.websiteurl = `http${decodeURIComponent(u)}`;
|
||||
}).catch(_ => null);
|
||||
|
||||
if (!this.checkIfCompleted()) throw "NOT ALL NEEDED PARAMS FOUND!";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user