Giter Club home page Giter Club logo

craigslist-renew's Introduction

craigslist-renew

This is a simple python script that will auto-renew all your active Craigslist posts. It can also notify you when a post expires.

Requirements

This project depends on the following python modules:

  • beautifulsoup4
  • html5lib
  • PyYAML
  • selenium

Use the python package manager to install them:

pip3 install -r requirements.txt

Usage

Create a yaml config file with the following content:

---
#
# Required parameters
#
email: <craigslist login>
password: <craigslist password>
notify: <comma separated list of emails>
#
# Optional parameters
#
# specify sender email address
from: <sender email address>
# specify smtp server settings (defaults to using sendmail command if omitted)
smtp:
  server: <host:port>
  username: <mail username>
  password: <mail password>
# set to 1 to suppress notification emails on renewal
no_success_mail: <1|0>
# set to 1 to renew all posts available for renewal
# By default, only the first expired post gets renewed on each run
renew_all: <1|0>
# specify path for logging actions taken
logfile: <path-to-logfile>
# specify selenium webdriver local path or remote url (defaults to using chromedriver in local path if omitted)
webdriver: <path-to-webdriver>
# specify the list of your current postings for expiration notifications
postings:
  - title: My post
    area: nyc
  - title: Another post
    area: nyc

Then just schedule the script in cron to run at the schedule you want. Depending on the category and location, craigslist posts can be renewed about once every few days, so running the script every few hours should be more than sufficient:

0 */2 * * * /path/to/craigslist-renew.py /path/to/config.yml

You can only renew a post so many times before it expires, so to get notified about expired posts, make sure you have configured the postings parameter in your configuration and add the following (daily) cronjob:

0 21 * * * /path/to/craigslist-renew.py --expired /path/to/config.yml

Docker Image

dockeri.co.

Supported tags

By default, the chromedriver package is included as local webdriver. If you rather use a Selenium Grid server instead, use the remote tag. If going with the latter, make sure to specify the remote url in the config file.

Tags Description
latest, local Local webdriver support
remote Remote webdriver support

Run commands

Make sure that the configuration file config.yml is in the directory you are running the commands below or specify the proper directory path in the volume parameter. The log file path should be set to /data/<logfile> in the configuration file, if specified.

Renew posts

docker run --rm -v $(pwd):/data jsetton/craigslist-renew

Check expired posts

docker run --rm -v $(pwd):/data jsetton/craigslist-renew --expired

Kubernetes CronJob

To deploy this script as a Kubernetes CronJob

Create ConfMap

kubectl create configmap craigslist-renew-config --from-file=config.yml

Apply the Job

Adjust kubernetes/cronjob.yaml cron schedule, defaults to every odd day.

kubectl apply -f kubernetes/cronjob.yaml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.