Giter Site home page Giter Site logo

craigscraper's Introduction

Craiscraper

Description

Scan (and monitor) Craigslist for new apartments within the defined parameters.

Features

  • sends notifications (after first run) for any new apartment
  • extract features like gym, pool, availability and apartment size from the description
  • calculate distance from a location (i.e.: your work place)
  • stores everything conveniently in a sqlite database

Requirements

  • Python 3.10+

Usage

Docker

  1. create a folder for the app and change your workdir: mkdir craigscraper; cd craigscraper
  2. create a notification file using the instructions below vi notifications.yaml
  3. prepare a .env file using the .env_template as model. Remember to uncomment the last two lines to allow data persistance
  4. run docker: docker run --env-file ./craigscraper/.env -v ./craigscraper:/persist ghcr.io/porelli/craigscraper:main

if you want to examinate the database

  • docker run -it --rm -p 8080:8080 -v ./craigscraper:/data -e SQLITE_DATABASE=rents.db coleifer/sqlite-web

Local or dev

  1. clone the package
  2. copy .env_template to .env
  3. replace values in .env
  4. create venv: python3 -m venv .venv
  5. activate venv: source .venv/bin/activate
  6. install dependencies: pip3 install -r requirements.txt
  7. profit: scrapy crawl rent

Periodic scan

  • suppress the notification test in the .env file using SUPPRESS_TEST_NOTIFICATION='True'
  • specify the scan interval in the .env file using MINUTES_INTERVAL
  • run: python3 main.py

Caveats (PRs are welcome!)

  • currently it works only for Vancouver, BC
  • code is not very organized and does not follow all the scrapy best practices

Notifications

By default, the script will try to send a desktop notification. A first notification is sent at the beginning as a test. Subsequent notifications are sent when new apartments appear in the search on there is a price change.

You can override the default behavior specifying your own notification provider(s) with an apprise compatible configuration file and using the -a notifications_file=<NOTIFICATION_FILE> CLI option or via ENV NOTIFICATION_FILE.

Please note, that for notifications to work on Mac or Windows, you may need to install additional packages. If you experience any errors with this, please refer to the apprise wiki.

MacOS

brew install terminal-notifier

Windows

pip install pywin32

craigscraper's People

Contributors

porelli avatar

Watchers

 avatar  avatar  avatar

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.