Automating Craiglist

Posted on

Problem :

I would like to be able to quickly respond to craigslist ads even when I am asleep or away from my computer. Basically what a site like does, but my own way of doing it without having to use their service.

Here’s what I tried so far:

Using the Watir group of Ruby libraries. Where I got stuck was how to get Ruby to recognize the links and buttons that craigslist gave on their search results page. Inspecting the links, it looks like craigslist is using JavaScript to display those links, and I cannot get the Watir web browser driver to get a handle on the links via some kind of id.

Getting craigslist to display my search results via RSS. My problem here is that the RSS feed doesn’t typically display the reply-to emails when they are there.

I would be very interested in both a specific answer in how to get this working with Watir and also learning general tools in solving these kinds of problems. Feel free to state an answer using what you think would be the best tool to solve this problem.

PS An older post: but no clear solution appeared here.

Thank you!

Solution :

looking for ‘air’ within prague page gives me the list of nice html links

one of them is

  1. open craigslist in chrome, open developer tools (shift+ctrl+i), switch to network tab.
  2. open offer page
  3. clear logs with ‘clear’ icon (2nd row, 2nd column
  4. click on ‘reply’ button on craigslist page
  5. watch what tappend in log:
  6. right click on the ‘4345787014 reply’ row and select ‘open in new tab’
  7. watch the link that was generated by javascript

it seems that the reply button on page opens url which is pretty easy to simulate in ruby.