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

WIP create product engineer job board #9943

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

jamesefhawkins
Copy link
Contributor

@jamesefhawkins jamesefhawkins commented Nov 21, 2024

Changes

  • Creates new page
  • Scrapes (just supabase's ATS page) for now and creates job listings using ScrapingBee

todo

  • make it look nice - make sure the data from the job pages display correctly
  • share scrapingbee login details so everyone can access their UX and logs if needed
  • get multiple cool companies' listings in there
  • add some cool filtering that we apply at a company level
  • cache results from scraping so it loads instantly
  • add something to make clear (ie a listing at the top) that this IS NOT all jobs at posthog and we also have those somewhere else! suggest this is a job listing with a fancier background
  • make it so logged in users can create a company, update their fields and add their ATS (so we can send this to people in the startup scheme!)

Checklist

  • Words are spelled using American English
  • Titles are in sentence case
  • Feature names are in sentence case too
  • Use relative URLs for internal links
  • If I moved a page, I added a redirect in vercel.json
  • Remove this template if you're not going to fill it out!

Article checklist

  • I've added (at least) 3-5 internal links to this new article
  • I've added keywords for this page to the rank tracker in Ahrefs
  • I've checked the preview build of the article
  • The date on the article is today's date
  • I've added this to the relevant "Tutorials and guides" docs page (if applicable)

Useful resources

Copy link

vercel bot commented Nov 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog ✅ Ready (Inspect) Visit Preview Nov 23, 2024 8:04pm

@jamesefhawkins jamesefhawkins changed the title create product engineer job board WIP create product engineer job board Nov 21, 2024

try {
// Get jobs data
const response = await axios.get(`https://jobs.ashbyhq.com/${company}`)
Copy link
Contributor

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;
  }

Comment on lines +125 to +129
{
name: 'Greenhouse',
pattern: /greenhouse\.io/i,
boardPattern: /greenhouse\.io\/[^/]+$/i,
},
Copy link
Contributor

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',
Copy link
Contributor

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',
Copy link
Contributor

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',
          },
        },
      );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants