-
Notifications
You must be signed in to change notification settings - Fork 446
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
WIP create product engineer job board #9943
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
try { | ||
// Get jobs data | ||
const response = await axios.get(`https://jobs.ashbyhq.com/${company}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ashby has an api you can use, which just returns a JSON. Could be simpler:
try {
const response = await axios.post(
'https://jobs.ashbyhq.com/api/non-user-graphql?op=ApiJobBoardWithTeams',
{
operationName: 'ApiJobBoardWithTeams',
variables: { organizationHostedJobsPageName: ashbyURL.replace('https://jobs.ashbyhq.com/', '') },
query: `query ApiJobBoardWithTeams($organizationHostedJobsPageName: String!) {
jobBoard: jobBoardWithTeams(
organizationHostedJobsPageName: $organizationHostedJobsPageName
) {
teams {
id
name
parentTeamId
__typename
}
jobPostings {
id
title
teamId
locationId
locationName
employmentType
secondaryLocations {
...JobPostingSecondaryLocationParts
__typename
}
compensationTierSummary
__typename
}
__typename
}
}
fragment JobPostingSecondaryLocationParts on JobPostingSecondaryLocation {
locationId
locationName
__typename
}`,
},
{
headers: {
authority: 'jobs.ashbyhq.com',
accept: '*/*',
'accept-language': 'en-GB,en;q=0.9,nl;q=0.8',
'apollographql-client-name': 'frontend_non_user',
'apollographql-client-version': '0.1.0',
'content-type': 'application/json',
origin: 'https://jobs.ashbyhq.com',
'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36',
},
},
);
console.log('Received response from Ashby API');
data = response.data;
} catch (error) {
if (axios.isAxiosError(error) && error.response?.status === 404) {
// uploadBadURL(ashbyURL, BadURLReason.CareersPage404);
}
console.log(`Error fetching ashby link: ${JSON.stringify(error)}`);
return null;
}
{ | ||
name: 'Greenhouse', | ||
pattern: /greenhouse\.io/i, | ||
boardPattern: /greenhouse\.io\/[^/]+$/i, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greenhouse API:
try {
const response = await axios.get(
`${greenhouseURL.replaceAll('https://boards.greenhouse.io/', 'https://boards-api.greenhouse.io/v1/boards/')}/jobs`,
);
console.log('Retrieved response from Greenhouse API');
data = response.data;
} catch (error) {
if (axios.isAxiosError(error) && error.response?.status === 404) {
// uploadBadURL(greenhouseURL, BadURLReason.CareersPage404);
}
console.log(`Error fetching greenhouse link: ${JSON.stringify(error)}`);
return null;
}
boardPattern: /greenhouse\.io\/[^/]+$/i, | ||
}, | ||
{ | ||
name: 'Lever', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lever API
try {
console.log(leverURL);
const response = await axios.get(
`${leverURL.replace('https://jobs.lever.co/', 'https://api.lever.co/v0/postings/')}?mode=json`,
);
console.log('Retrieved response from Lever API');
data = response.data;
} catch (error) {
if (axios.isAxiosError(error) && error.response?.status === 404) {
// uploadBadURL(leverURL, BadURLReason.CareersPage404);
}
console.log(`Error fetching lever link: ${JSON.stringify(error)}`);
return null;
}
boardPattern: /lever\.co\/[^/]+$/i, | ||
}, | ||
{ | ||
name: 'Workday', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workday is slightly trickier since there are so many jobs.
try {
// Modify the URL format
const urlParts = myWorkDayURL.split('/');
const subdomain = urlParts[2].split('.')[0]; // e.g., 'crowdstrike' or 'disney'
const lastPath = urlParts[urlParts.length - 1];
const modifiedURL = `${myWorkDayURL.replace(`.com/${lastPath}`, `.com/wday/cxs/${subdomain}/${lastPath}/jobs`)}`;
while (totalJobs === null || allJobs.length < totalJobs) {
const response = await axios.post(
modifiedURL,
{
appliedFacets: {},
limit,
offset,
searchText: '',
},
{
headers: {
accept: 'application/json',
'accept-language': 'en-US',
'content-type': 'application/json',
origin: new URL(myWorkDayURL).origin,
priority: 'u=1, i',
referer: myWorkDayURL,
'sec-ch-ua': '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
'x-calypso-csrf-token': '1d23cde2-8ccb-4b22-baef-42bff17d22bf',
},
},
);
Changes
todo
Checklist
vercel.json
Article checklist
Useful resources