So by no means am I a decent programmer (hire me though?) but the logic does not escape me. I wasn't sure which language to use so I Googled a few things and found that Python has some useful libraries. All in all it only took about a day to learn the syntax, and the rest I just figured out in less than a week.
You can git the code from here: https://github.com/DuncDude/Craigs_Pull
Ive made a video tutorial for how to use it and its self explanatory within it running but the basics are:
- Change the source to reflect your email/password and the craigslist page you are using. Do this by scrolling to the bottom of the source and looking for the “yourusername@gmail” etc. As for the page, near the middle change the page variable to what the URL you are using.
- Run the program you will need the following libraries “smtplib, requests, time, gc”
- You'll be prompting for the intervals of scrapes for listings (NOTE: this only looks at the last new listing, if any more than one thing is listed it will skip it. Now that I have a better understanding of python I plan to take the whole page) I suggest only doing it every 10 minutes or so, but it is measured in seconds so be carefull
- You'll then be prompted for the words you want to use, its as easy typing them in. Make sure they are separated by spaces and lowercase though.
Once its running you'll be shown the most recent item listed and if any of your word match the listing, each word will be listed followed by a yes or no. depending on if or if not it matches.
If there is a match you will receive an email with that listings details. The program will continue to run until you interrupt it.
Oh boy there were so many! But mostly I had to figure out why it would crash after a few thousand scrapes. Eventually I figured out it was probably from a memory leak which at the time I had no idea what that was, but it should run flawlessly now.
I’d like to make a menu system for changing thing such as the URL in program, also allow list to be taken from text files, and probably just spell check in general. When i get some more time after the new year I hope to do this.