craigslist-cli-tool
v1.0.6
Published
tool to search craigslist
Downloads
4
Readme
Craigslist Searcher
Description
Duration: 4 days
This is a simple tool for searching Craigslist, designed to be run from the command line. The tool is currently set up to search 'free stuff' section of Minneapolis craigslist for 'dirt' and email the search results to my personal email, every day at 7 am and 1 pm.
Screenshot
Prerequisites
- Node.js
- Gmail with 2 factor authentication
- Selenium WebDriver for Chrome
Installation
- Install the latest version of Selenium Webdriver for Chrome
- Set up an app-specific password in your google account
- Clone the GitHub repository to your computer.
- Create a .env file in the repository, and set up the following environment variables:
- NODE_MAILER_USER="your Gmail username"
- NODE_MAILER_USER_KEY="app-specific password created in step 2"
- MY_EMAIL="your email address"
- Open the code in your editor of choice and run an
npm install
. - In your terminal, navigate to the repository directory, then run
npm start
.
Usage
- To search for a different item, update searchQuery variable
- To search a different city, update the URL in scrapeSelenium.js file.
- To receive a text of results, update the code in index.js file from:
searchCraigslist(searchQuery).then(results => sendEmailorText(results));
to:
searchCraigslist(searchQuery).then(results => sendEmailorText(results, 'PHONE NUMBER'));
- To change the times when you receive emails, update the cron.schedule line. For example, to receive an email at 12:00 pm and 6:00 pm every day, update the code to
cron.schedule('0 12,18 * * *', () => {
- Run app in background with PM2:
- In terminal, navigate to the repository directory.
- Run
npm install pm2 -g
- Run
pm2 start index.js --name 'OPTIONAL_APP_NAME'
. PM2 will start the app, daemonize it, and run it in background. - To stop the tool, run
pm2 stop OPTIONAL_APP_NAME
.
Built With
- JavaScript
- Express
- Selenium Webdriver
- Nodemailer(https://nodemailer.com/about/)
- node-cron
Link to Code on GitHub:
https://github.com/AlinaTrukhina/craigslist-cli-tool