From f7e1e618a40f8283612255f30b2558642dc2f6f6 Mon Sep 17 00:00:00 2001 From: AMAICDAX Date: Wed, 10 Sep 2025 14:40:21 +0200 Subject: [PATCH] modif --- controllers/linkedin.js | 17 ++++++++++++----- routes/front.routes.js | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/controllers/linkedin.js b/controllers/linkedin.js index 560678f..816bcfa 100644 --- a/controllers/linkedin.js +++ b/controllers/linkedin.js @@ -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); const browser = await chromium.launch({ @@ -156,16 +160,19 @@ const scrapeLinkedInProfile = async (profileUrl) => { ); 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"), headline: getText("div.text-body-medium.break-words"), location: getText( "span.text-body-small.inline.t-black--light.break-words" ), // about: getText(""), - // experiences: getAllText( - // "" - // ), + experiences: getAllText( + "div.KbuWagYZEALUPOYGtkFczhgTiHHNRLZKhdLlK > ul li" + ), // education: getAllText(""), // skills: getAllText(""), }; diff --git a/routes/front.routes.js b/routes/front.routes.js index 89bae80..1db5ff7 100644 --- a/routes/front.routes.js +++ b/routes/front.routes.js @@ -44,7 +44,7 @@ router.get("/me", async (req, res) => { `); } - const profile = await scrapeLinkedInProfile(user.linkedinUrl); + const profile = await scrapeLinkedInProfile(user); res.send(profile); });