AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Craigslist search & sort

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
jtuttle



Joined: 06 Nov 2008
Posts: 26

PostPosted: Sun Aug 30, 2009 3:36 am    Post subject: Craigslist search & sort Reply with quote

Basic script I made to grab the free stuff ads off Craigslist and look for keywords of things I may want. Outputs an html file and opens it in your browser. Should be trivial to edit the city, section, and search items if you so choose.


Code:
FileDelete, %A_Temp%/clzip.html
FileDelete, %A_Temp%/cltemp.html
UrlDownloadToFile, http://medford.craigslist.org/zip/index.html, %A_Temp%/clzip.html

Loop, Read, %A_Temp%/clzip.html, %A_Temp%/cltemp.html
{
IfInString, A_LoopReadLine, option value=", Continue
IfInString, A_LoopReadLine, laptop, FileAppend, Matches: Laptop - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, computer, FileAppend, Matches: Computer - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, tire, FileAppend, Matches: Tire - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, plant, FileAppend, Matches: Plant - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, car, FileAppend, Matches: Car - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, truck, FileAppend, Matches: Truck - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, trampoline, FileAppend, Matches: Trampoline - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, air, FileAppend, Matches: Air - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, conditioner, FileAppend, Matches: Conditioner - %A_LoopReadLine%<br>
IfInString, A_LoopReadLine, pool, FileAppend, Matches: Pool - %A_LoopReadLine%<br>
}

FileDelete, %A_Temp%/clzip.html

FileAppend, <title>Zip!</title>, %A_Temp%/clzip.html
sleep, 100

Loop, Read, %A_Temp%/cltemp.html, %A_Temp%/clzip.html
 {       
StringReplace, dongs, A_LoopReadLine, <p><a href=", <a href="http://medford.craigslist.org, 1
StringReplace, dongs, dongs, </p>, , 1
FileAppend, %dongs%
      }

Run, %A_Temp%/clzip.html
Sleep, 1000
FileDelete, %A_Temp%/clzip.html
FileDelete, %A_Temp%/cltemp.html


It would be trivial to tweak it to sort them by keyword matched if one was so inclined, too. I prefer it to be chronological, myself.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group