INAPI / app.py
lelafav502's picture
Create app.py
b55c84b verified
raw
history blame
970 Bytes
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
// Navigate to a URL
await page.goto('https://www.linkedin.com/in/iamyashchouhan/');
// Wait for the content to load
await page.waitForSelector('h1.text-heading-xlarge');
// Extract data
const name = await page.$eval('h1.text-heading-xlarge', el => el.innerText);
const jobTitle = await page.$eval('div.text-body-medium.break-words', el => el.innerText);
const companyName = await page.$eval('span.text-body-small.t-black', el => el.innerText);
const location = await page.$eval('span.text-body-small.inline.t-black--light.break-words', el => el.innerText);
const profilePicture = await page.$eval('img.pv-top-card-profile-picture__image', el => el.src);
console.log({
name,
jobTitle,
companyName,
location,
profilePicture,
});
await browser.close();
})();