This commit is contained in:
AMAICDAX 2025-09-09 16:14:05 +02:00
parent cb32993d5b
commit 1071ef012d

View file

@ -2,7 +2,7 @@
const axios = require("axios"); const axios = require("axios");
const querystring = require("querystring"); const querystring = require("querystring");
import puppeteer from "puppeteer"; const puppeteer = require("puppeteer");
const clientId = "780w7gsy8eysmj"; const clientId = "780w7gsy8eysmj";
const clientSecret = "WPL_AP1.w6OTTkAndAdT3PYF.UZEcwQ=="; const clientSecret = "WPL_AP1.w6OTTkAndAdT3PYF.UZEcwQ==";
@ -92,14 +92,19 @@ const getUserProfile = async (req, res) => {
}; };
const scrapeLinkedInProfile = async (profileUrl) => { const scrapeLinkedInProfile = async (profileUrl) => {
console.log("Scraping LinkedIn profile:", profileUrl);
const browser = await puppeteer.launch({ headless: false }); // headless: true si tu veux sans UI const browser = await puppeteer.launch({ headless: false }); // headless: true si tu veux sans UI
const page = await browser.newPage(); const page = await browser.newPage();
console.log("Using email:", email);
// 1. Aller sur la page de login // 1. Aller sur la page de login
await page.goto("https://www.linkedin.com/login", { await page.goto("https://www.linkedin.com/login", {
waitUntil: "networkidle2", waitUntil: "networkidle2",
}); });
console.log("Login page loaded");
// 2. Connexion avec identifiants // 2. Connexion avec identifiants
await page.type("#username", email, { delay: 50 }); await page.type("#username", email, { delay: 50 });
await page.type("#password", password, { delay: 50 }); await page.type("#password", password, { delay: 50 });