-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGoogleJobsScraper.js
38 lines (34 loc) · 1.19 KB
/
GoogleJobsScraper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const cheerio = require("cheerio");
const unirest = require("unirest");
const getJobsData = async () => {
try {
const url = "https://www.google.com/search?q=web+developer+in+mumbai&ibp=htl;jobs&hl=en";
const response = await unirest
.get(url)
.headers({
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
})
let $ = cheerio.load(response.body);
let jobs_results = [];
$(".iFjolb").each((i,el) => {
jobs_results.push({
title: $(el).find(".PUpOsf").text(),
company_name: $(el).find(".vNEEBe").text(),
location: $(el).find(".vNEEBe+ .Qk80Jf").text(),
via: $(el).find(".Qk80Jf+ .Qk80Jf").text(),
})
if($(el).find(".KKh3md").length)
{
jobs_results[i].extensions = [];
$(el).find(".KKh3md .LL4CDc").each((j,el) => {
jobs_results[i].extensions[j] = $(el).text()
})
}
})
console.log(jobs_results)
} catch (e) {
console.log(e);
}
};
getJobsData();