jtuttle
Joined: 06 Nov 2008 Posts: 26
|
Posted: Sun Aug 30, 2009 3:36 am Post subject: Craigslist search & sort |
|
|
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. |
|