-
Notifications
You must be signed in to change notification settings - Fork 3
/
search.js
64 lines (52 loc) · 1.55 KB
/
search.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const Nightmare = require('nightmare');
const jquery = require('jquery');
const fs = require('fs');
// const {csvFormat} = require('d3-dsv');
// const $ = require('cheerio');
// const Linkedin = require('./plugins/linkedin.js');
// const duck = require('./plugins/duck.js');
const itJobs = require('./plugins/itJobs');
const empregos = require('./plugins/empregos');
// const glassdoor = require('./plugins/glassdoor');
const modify = require('./helpers/modify.js');
let jobsArr = [];
let jobsArray = [];
let jobs = [];
const cred = require('./credentials.json');
console.log('cred.loc -> ', cred.loc);
nightmare = Nightmare({
openDevTools: {
mode: 'bottom'
},
// show: true,
webPreferences: {
partition: 'persist:derp'
},
electronPath: require('./node_modules/electron'),
alwaysOnTop: false,
title: 'JobSearchApp',
width: 1300,
height: 600,
});
Nightmare.action('clearCache',
function(name, options, parent, win, renderer, done) {
parent.respondTo('clearCache', function(done) {
win.webContents.session.clearCache(done);
});
done();
},
function(message, done) {
this.child.call('clearCache', done);
});
nightmare
.use(itJobs.search())
.then((itJobs) => jobs.push(itJobs))
.then(() => nightmare.use(empregos.search()))
.then(() => modify.modify(jobs))
.then(function (jobs) {
document.getElementById("results").innerHTML = jobs;
})
.then(() => nightmare.end())
.catch(function(error) {
console.log(error);
});