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.
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).
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: email@example.com email_from: address: smtp.gmail.com port: 587 user_name: 'a_username' password: 'a_password'
That’s it. if you want to log the output:
clockwork monitor.rb > monitor.log
Press CTRL+C to exit
|CLMonitor.zip||19 Sep 2014||3 KB|