This commit is contained in:
AMAICDAX 2025-09-10 14:40:21 +02:00
parent 0b3de762d8
commit f7e1e618a4
2 changed files with 13 additions and 6 deletions

View file

@ -91,7 +91,11 @@ const getUserProfile = async (req, res) => {
} }
}; };
const scrapeLinkedInProfile = async (profileUrl) => { const scrapeLinkedInProfile = async (user) => {
const img = user.img;
const useremail = user.email;
const profileUrl = user.linkedinUrl;
console.log("Scraping LinkedIn profile:", profileUrl); console.log("Scraping LinkedIn profile:", profileUrl);
const browser = await chromium.launch({ const browser = await chromium.launch({
@ -156,16 +160,19 @@ const scrapeLinkedInProfile = async (profileUrl) => {
); );
return { return {
img: getText("img.pv-top-card-profile-picture__image--show"), img: user.img || null,
email: user.email || null,
linkedinUrl: user.linkedinUrl || null,
name: getText("h1"), name: getText("h1"),
headline: getText("div.text-body-medium.break-words"), headline: getText("div.text-body-medium.break-words"),
location: getText( location: getText(
"span.text-body-small.inline.t-black--light.break-words" "span.text-body-small.inline.t-black--light.break-words"
), ),
// about: getText(""), // about: getText(""),
// experiences: getAllText( experiences: getAllText(
// "" "div.KbuWagYZEALUPOYGtkFczhgTiHHNRLZKhdLlK > ul li"
// ), ),
// education: getAllText(""), // education: getAllText(""),
// skills: getAllText(""), // skills: getAllText(""),
}; };

View file

@ -44,7 +44,7 @@ router.get("/me", async (req, res) => {
`); `);
} }
const profile = await scrapeLinkedInProfile(user.linkedinUrl); const profile = await scrapeLinkedInProfile(user);
res.send(profile); res.send(profile);
}); });