Skip to content

Instantly share code, notes, and snippets.

@chrishunt
Last active December 16, 2015 16:19
Show Gist options
  • Save chrishunt/5462643 to your computer and use it in GitHub Desktop.
Save chrishunt/5462643 to your computer and use it in GitHub Desktop.
Be notified when a new house matching your criteria is posted to Craigslist
# Be notified when a new house matching your criteria is posted to Craigslist
require 'snoop'
MAX_RENT = 1900
BEDROOMS = 2
CITY = 'portland'
CATS = true
DOGS = true
snoop = Snoop::HttpNotifier.new url: begin
url = [
"http://#{CITY}.craigslist.org/search",
"/apa?zoomToPosting=&query=&srchType=A",
"&maxAsk=#{RENT}",
"&bedrooms=#{BEDROOMS}"
].join
url += "&addTwo=purrr" if CATS
url += "&addThree=wooof" if DOGS
end
snoop.notify while: -> { true }, delay: 300 do
`terminal-notifier -message "New listing!"`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment