lelafav502 commited on
Commit
b55c84b
Β·
verified Β·
1 Parent(s): 11d7f8d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const puppeteer = require('puppeteer');
2
+
3
+ (async () => {
4
+ const browser = await puppeteer.launch({ headless: true });
5
+ const page = await browser.newPage();
6
+
7
+ // Navigate to a URL
8
+ await page.goto('https://www.linkedin.com/in/iamyashchouhan/');
9
+
10
+ // Wait for the content to load
11
+ await page.waitForSelector('h1.text-heading-xlarge');
12
+
13
+ // Extract data
14
+ const name = await page.$eval('h1.text-heading-xlarge', el => el.innerText);
15
+ const jobTitle = await page.$eval('div.text-body-medium.break-words', el => el.innerText);
16
+ const companyName = await page.$eval('span.text-body-small.t-black', el => el.innerText);
17
+ const location = await page.$eval('span.text-body-small.inline.t-black--light.break-words', el => el.innerText);
18
+ const profilePicture = await page.$eval('img.pv-top-card-profile-picture__image', el => el.src);
19
+
20
+ console.log({
21
+ name,
22
+ jobTitle,
23
+ companyName,
24
+ location,
25
+ profilePicture,
26
+ });
27
+
28
+ await browser.close();
29
+ })();