Skip to content

Commit

Permalink
Merge pull request #392 from lalalaurentiu/main
Browse files Browse the repository at this point in the history
Refactor Globant job scraper and add to repository
  • Loading branch information
lalalaurentiu authored Dec 4, 2024
2 parents eefd19b + ff179e8 commit 3b999a7
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 91 deletions.
76 changes: 76 additions & 0 deletions sites/globant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const { translate_city, get_jobtype } = require("../utils.js");
const {
Scraper,
postApiPeViitor,
generateJob,
getParams,
} = require("peviitor_jsscraper");
const { Counties } = require("../getTownAndCounty.js");

const _counties = new Counties();

const getJobs = async () => {
const url =
"https://career.globant.com/search/?createNewAlert=false&q=&optionsFacetsDD_department=&optionsFacetsDD_country=RO";
const scraper = new Scraper(url);

const res = await scraper.get_soup("HTML");
const items = res.findAll("li", { class: "job-tile" });

const jobs = [];

for (const item of items) {
const job_title = item.find("span", { class: "title" }).text.trim();
const job_link = "https://career.globant.com" + item.attrs["data-url"];
const country = "Romania";
const citys_obj = item
.find("div", { class: "location" })
.find("div")
.text.split(",");

const remote = get_jobtype(
item.find("div", { class: "location" }).find("div").text.toLowerCase()
);

let cities = [];
let counties = [];

for (const city_obj of citys_obj) {
const city_Name = city_obj.split(",")[0].trim();
const { city: c, county: co } = await _counties.getCounties(
translate_city(city_Name)
);

if (c) {
cities.push(c);
counties = [...new Set([...counties, ...co])];
}
}

const job = generateJob(
job_title,
job_link,
country,
cities,
counties,
remote
);
jobs.push(job);
}
return jobs;
};

const run = async () => {
const company = "Globant";
const logo =
"https://seekvectorlogo.com/wp-content/uploads/2019/06/globant-vector-logo.png";
const jobs = await getJobs();
const params = getParams(company, logo);
postApiPeViitor(jobs, params);
};

if (require.main === module) {
run();
}

module.exports = { run, getJobs, getParams }; // this is needed for our unit test job
91 changes: 0 additions & 91 deletions sites/pentalog.js

This file was deleted.

0 comments on commit 3b999a7

Please sign in to comment.