Skip to content

Instantly share code, notes, and snippets.

@saamerm
Last active March 3, 2025 17:44
Show Gist options
  • Save saamerm/e14223eaf02ca7929025ac0008c89189 to your computer and use it in GitHub Desktop.
Save saamerm/e14223eaf02ca7929025ac0008c89189 to your computer and use it in GitHub Desktop.
You can use this code to extract & filter the upper limits of the salaries on the ycombinator jobs https://youtu.be/MlbEel7bB8o
// YouTube Video link : https://youtu.be/MlbEel7bB8o
// Pre-reqs: Scrape the Data from the YCombinator job board (https://www.workatastartup.com/. Clean (Lint) the data to ensure it's ready for analysis.
// Code to display job listings and their corresponding salaries.
const fs = require('fs').promises;
async function printFileContents() {
const filePath = 'yc-jobs.json';
try {
const data = await fs.readFile(filePath, 'utf8');
return JSON.parse(data);
} catch (err) {
console.error('Error reading file:', err);
return null;
}
}
// Extract & Filter the jobs based on the highest salary range.
async function processJobs() {
const jobs = await printFileContents();
if (!jobs) return;
jobs.companies.forEach(company => {
company.jobs.forEach(job => {
const salaryRange = job.pretty_salary_range || "N/A";
const upperLimitMatch = salaryRange.match(/- \$(\d+)K/); // Extract upper limit after hyphen
if (upperLimitMatch) {
const upperLimit = parseInt(upperLimitMatch[1]) * 1000; // Convert to number
if (upperLimit >= 300000) {
console.log(`Company: ${company.name}, Title: ${job.title}, Salary Range: ${salaryRange}`);
}
}
});
});
}
// Call the function
processJobs();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment