in reply to Is there a better way to do this? I need to keep track of results...

On the search results page, it seems that the ads are sorted by date (newest first). If you save in a file the date and time of the latest message found in your previous check, it is easy to follow each link and check the date and time of each message. Once you hit a message equal to or older than your saved date and time you do not have to look any further.

Alternatively, it looks as if you can also check the link itself. That seems to contain a very big sequence number (http://portland.craigslist.org/mlt/rid/1042365384.html) that is larger for newer messages. So if you keep the sequence number of your latest message found, you can probably check on this number. That would save you from having to follow the link to find the date and time and from doing some date-time conversions / parsing.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

  • Comment on Re: Is there a better way to do this? I need to keep track of results...
  • Download Code