Skip to content

A Slack bot that notifies you whenever new apartments shows up on Blocket within your criteria

Notifications You must be signed in to change notification settings

Bridouille/blocket-alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔔 Blocket alert

This repo contains the code of a Blocket scrapper that sends Slack messages whenever it find an ad that suits your needs, in real-time. The idea comes from this repo that does the same for Craigslist. The main advantages are :

  • 🕖 It can send you a message directly when a new ad is added on Blocket, which can increase your chances to get a response from a landlord since you will be in the first persons contacting them. No need to check 3 times a day anymore.
  • 👍 It can filter ads for you based on some criteria. Instead of filtering yourself everytime (price, location...) this program does it for you and don't alert you when an ad doesn't suit your needs.

This is how the messages looks like:

A screenshot of the aspect of the received messages

This scrapper only works with the renting part in the housing section of Blocket. The buying market or anything else are not a part of it. Feel free to submit a PR to include them as well!

📬 Configuration

You can easily configure the scrapper with the fields present in the settings.py file. Here are the most important variable to look at when using this scrapper:

SEARCH_OPTIONS = {
    'minPrice' : 9000, # minimum price in SEK
    'maxPrice' : 12000, # maximum price in SEK
    'minRooms' : 1, # minimum number of rooms
    'maxRooms' : 3, # maximum number of rooms
    'minBedrooms' : 1, # minimum number of bedrooms
    'minSize' : 20, # minimum size in square meters
    'maxSize' : 80 # maximum size in square meters
}

CITY = "stockholm"

PREFERED_NEIGHBOORHOODS = [ ]

EXCLUDED_NEIGHBOORHOODS = [
   'Täby',
   'Sollentuna'
]

SLACK_CHANNEL = '@nicolas' # can also be a channel '#housing' for example

💾 Installation

Slack Integration

  1. For the scrapper to post on Slack you need to create an "App" for Slack here and associate it to the team you want the scrapper to post on.
  2. Once you have created your app, go to the "Basic Information" tab and click on "Add features and functionality" and under "Permissions" add the "Send message as User" and "Send message as [App Name]" in the "Permission Scopes"
  3. Under the "OAuth & Permissions" tab copy the OAuth access Token to your clipboard.
  4. Set it in the appropriate environment variable export SLACK_API_TOKEN="Your OAuth token here"

Python requirements

  1. Install Python3 and Python3 pip
  2. Install all the Python3 necessary packages pip3 install -r requirements.txt
  3. Grant execution permission on the scrapper chmod +x scrapper.py
  4. Run it and your good to go ./scrapper.py

It is recommended to create a virtual environment using virtualenv for this.

Tips to launch the script

You can use forever to run this script.

forever start -c python3 ./scrapper.py

📈 Todos

  1. Add other part of Blocket, not only the rentals

About

A Slack bot that notifies you whenever new apartments shows up on Blocket within your criteria

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages