Craigslist Monitor using Ruby

Overview

To add to my ever expanding knowledge base of languages, I decided to spend the last day and a half teaching myself Ruby and this was the result. A script to watch Craigslist for relevant posts so you don’t have to. My first ever Ruby program.

Watching Craigslist can be a time-consuming task. The script automates searching for housing, sales, services, jobs, and gigs, and emails you when it find something that matches your search criteria. It also works across multiple cities, since it’s controlled by the RSS feeds you configure it with.

Approach

Instead of sending Craigslist a server-side query, I decided to just get the RSS feed and filter the results on the client-side. There are two advantages of this — server changes don’t break the code and you can watch other feeds in a similar way (e.g. eBay).

Configuration

Edit the monitor.yml file to your liking. It should look something like this:

---
feeds:
  - http://sfbay.craigslist.org/wri/index.rss
  - http://sandiego.craigslist.org/wri/index.rss
include: software, developer, computer, programmer
exclude: freelance, internship, supplement, contract
email_to: someone@gmail.com
email_from:
  address: smtp.gmail.com
  port: 587
  user_name: 'a_username'
  password: 'a_password'

Running

clockwork monitor.rb

That’s it. if you want to log the output:

clockwork monitor.rb > monitor.log

Press CTRL+C to exit

Downloads

CLMonitor.zip 19 Sep 2014 3 KB

Leave a Reply

Your email address will not be published.