diff --git a/controllers/linkedin.js b/controllers/linkedin.js index db09c11..0d21074 100644 --- a/controllers/linkedin.js +++ b/controllers/linkedin.js @@ -116,12 +116,34 @@ const scrapeLinkedInProfile = async (profileUrl) => { ]); console.log("Logged in"); + // Aller sur le profil et attendre le contenu + await page.goto(profileUrl, { + waitUntil: "domcontentloaded", + timeout: 60000, + }); + await page.waitForSelector("h1", { timeout: 60000 }); + + // Scroll pour charger lazy sections + await page.evaluate(() => window.scrollBy(0, window.innerHeight)); + await page.waitForTimeout(2000); + // 2. Aller sur le profil await page.goto(profileUrl, { waitUntil: "domcontentloaded", timeout: 60000, }); + // Aller sur le profil et attendre le contenu + await page.goto(profileUrl, { + waitUntil: "domcontentloaded", + timeout: 60000, + }); + await page.waitForSelector("h1", { timeout: 60000 }); + + // Scroll pour charger lazy sections + await page.evaluate(() => window.scrollBy(0, window.innerHeight)); + await page.waitForTimeout(2000); + // 3. Extraire infos const profileData = await page.evaluate(() => { const getText = (selector) =>