Skip to content
Adam Manuel’s “Dev Blog”Speed Up Your Job Hunt With This LinkedIn Scraper and Your System Notifications

Find your next rabbit hole

A topic, a tool, a tiny curiosity. Start anywhere.

Speed Up Your Job Hunt With This LinkedIn Scraper and Your System Notifications

On this page7

https://github.com/AdamManuel-dev/LinkedInNotifications

In the fast-paced world of job hunting, staying ahead of the competition means being the first to know about new opportunities. With the power of automation, you can have a system that scrapes LinkedIn for job postings and notifies you in real-time. This blog post dives into a JavaScript script using Puppeteer, Node-Notifier, and Node-Cron to make your job search more efficient.

Setting the Stage: The Components

The script integrates several key components:

  1. Puppeteer: A Node library that provides a high-level API to control Chrome or Chromium over the DevTools Protocol. It allows us to navigate the web programmatically.
  2. Node-Notifier: A Node.js module for sending notifications on native systems (Windows, Mac, Linux).
  3. Node-Cron: A task scheduler in pure JavaScript for running scheduled jobs.
  4. CSV File: Stores the job search configurations.
  5. Cache File: Maintains a log of previously seen job postings to avoid duplicate notifications.

Step-by-Step Breakdown

1. Reading Configurations

The script begins by reading configurations from a CSV file, searches.csv, which contains search terms, intervals, and LinkedIn URLs:

javascriptCopy code
const configCSV = fs.readFileSync('./searches.csv', {
  encoding: 'utf-8',
})

const configArr = configCSV.split('\n').map((line) => line.split(','));

configArr.shift()

const input = configArr.filter((x) => x.length === 3).map(([title, minuteLapse, url]) => ({
  url,
  title,
  minuteLapse: Number.parseInt(minuteLapse)
}))

This code reads the CSV file, splits it into lines, and maps each line to an object containing the job title, time interval, and LinkedIn search URL.

2. Caching Previous Job Postings

To avoid notifying about the same job postings multiple times, the script reads a cache file that stores previously seen URLs:

javascriptCopy code
const _cachedUrls = fs.readFileSync('./cache', {
  encoding: 'utf-8',
})

const cachedUrls = ((_cachedUrls.includes('\n')) ? _cachedUrls.split('\n') : []).filter((x) => x.length !== 0)

3. Scraping LinkedIn

This function:

  1. Sends a system notification if new job postings are found.

4. Scheduling the Job Scraper

To continuously check for new job postings, the script uses Node-Cron to schedule the grabLinks function at specified intervals:

javascriptCopy code
(function run() {
  input.forEach(({minuteLapse, title, url}, i) => {
    grabLinks({title, url, minuteLapse})
    cron.schedule(`*/${minuteLapse} * * * *`, () => {
      grabLinks({title, url, minuteLapse})
    });
  })
})()

This self-executing function loops through each job search configuration and sets up the scraper to run at the defined intervals.

Conclusion

This script automates the process of finding and notifying about new job opportunities on LinkedIn. By leveraging Puppeteer for web scraping, Node-Notifier for system notifications, and Node-Cron for scheduling tasks, it ensures you stay on top of new job postings with minimal effort. Whether you're an active job seeker or just keeping an eye out for the next big opportunity, this automated solution can give you the edge in your job search.

You made it. Thanks for reading.