Last active
March 12, 2022 02:12
-
-
Save devrsantos/0114d467d4aa2b54fc32a42e22e67f5a to your computer and use it in GitHub Desktop.
Busca de empregos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const curl = require("curl"); | |
const jsdom = require("jsdom"); | |
const url = "https://bauruempregos.com.br/home/vagas"; | |
curl.get(url, null, (err, resp, body) => { | |
if (resp.statusCode == 200) { | |
parseData(body); | |
} | |
}); | |
function parseData(html) { | |
const { JSDOM } = jsdom; | |
const dom = new JSDOM(html); | |
const $ = (require('jquery'))(dom.window); | |
//let's start extracting the data | |
var items = $(".vaga"); | |
var arrEmprego = {}; | |
var arrEndereco = {}; | |
for (var i = 0; i < items.length; i++) { | |
var innerInfo = $(items[i]).children('.descricao-vaga'); | |
var href = $($(innerInfo).find('a')[0]).attr('href'); | |
var emprego = $($(innerInfo).find('a')[0]).html(); | |
arrEmprego[i] = emprego.slice(7,-6); | |
arrEndereco[i] = href; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment