Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knox #35

Merged
merged 4 commits into from
Jul 24, 2023
Merged

Knox #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ dist
.tern-port

test.js
exclude/
exclude/

node_modules
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"axios": "^1.4.0",
"jssoup": "^0.0.15",
"peviitor_jsscraper": "^0.1.3",
"peviitor_jsscraper": "^0.1.4",
"querystring": "^0.2.1",
"uuid": "^9.0.0"
}
Expand Down
49 changes: 49 additions & 0 deletions sites/pirelli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const { Scraper, postApiPeViitor } = require("peviitor_jsscraper");

const generateJob = (job_title, job_link, city) => ({
job_title,
job_link,
country: "Romania",
city,
});

const getJobs = async () => {
const url = "https://corporate.pirelli.com/corporate/en-ww/careers/work-with-us?region=europe&country=romania&function=all";
const scraper = new Scraper(url);
const type = "HTML";
const soup = await scraper.get_soup(type);
const jobElements = soup.findAll('div', { 'data-country': "0c7d5ae44b2a0be9ebd7d6b9f7d60f20" });
const jobs = [];
jobElements.forEach((el) => {
const job_title = el.find('span').text.trim();
const city = el.find('span', { 'class': "loc" }).text.trim();
const jumpTo = "#:~:text=";
const job_link = url + jumpTo + job_title;
const job = generateJob(job_title, job_link, city);
jobs.push(job);
});
return jobs;
};

const getParams = () => {
const company = "Pirelli";
const logo =
"https://d2snyq93qb0udd.cloudfront.net/corporate/logo-pirelli2x.jpg";
const apikey = process.env.KNOX;
const params = {
company,
logo,
apikey,
};
return params
};

const run = async () => {
const jobs = await getJobs();
const params = getParams();
await postApiPeViitor(jobs, params);
};

run(); // this will be called by our main.js job

module.exports = { getJobs, getParams }; // this is needed for our unit test job
Loading