π¦ Simple C# command-line application for periodic watching of selected Real estate advertisement portals and sending notifications on new ads. π Supports watching adverts for sells as well as leases.
Frameworks: .NET 10, Node.js 22.12 or later (for the web scraping script)
Supported OS: Windows, macOS, Linux
Run the app by executing the following command
dotnet RealEstatesWatcher.UI.Console.dll --config config.ini
--help optionPerform following steps and commands either from the root folder (where the solution file is placed) or from the UI Console project in RealEstatesWatcher.UI.Console folder in order to prepare the application from execution:
Restore dependencies
dotnet restore
Build
dotnet build --configuration Release
Publish the UI Console project for desired platform
dotnet publish ./RealEstatesWatcher.UI.Console/RealEstatesWatcher.UI.Console.csproj -c Release
You can use your own publish parameters or use predefined profiles for Windows and Linux in RealEstatesWatcher.UI.Console/Properties/PublishProfiles/ folder
Copy Web scraper files from Tools/scraper folder to ~/publish/scraper directory.
Copy config.template.ini to RealEstatesWatcher.UI.Console/config.ini and edit it for your searches before building or publishing. The configured file is copied to publish/config.ini. If configuring after publishing, copy the template directly into publish/ as config.ini.
Deploy the whole publish directory to server or run locally.
On the target machine, enter scraper folder and install the locked Node.js dependencies with command
npm ci
##### * Itβs important to do this on the target platform as the dependencies are platform-specific
βCHANGEβ(since v1.4.3) π
If an Ad portal requires specific cookies to be set during web scraping in order to reach the final ads page (to pass through GDPR consent page, etc.), fill all the cookies to cookies.json file as shown in the template. Remember to copy this file to the same ~/publish/scraper directory as stated above.
There is a Dockerfile and a docker-compose.yml in the root of the repository to build and run the application in a containerized environment.
Before running the container:
[nodejs], leave path_to_node_executable= empty (so the container uses /usr/local/bin/node), and set path_to_script=./scraper/index.js and path_to_cookies_file=./scraper/cookies.json.Runtime configs and cookies.json are excluded from the Docker build context by .dockerignore, so they must be mounted at runtime.
Place cookies.json in the repository root (./cookies.json), then build and start the container:
docker compose up -d --build
Useful commands:
docker compose logs -fconfig.ini or cookies.json changes without rebuilding: docker compose restartdocker compose downIf you enable [file] output in config.ini, uncomment the ./output:/app/output volume in docker-compose.yml and set main_path / new_posts_path under /app/output/.
If you enable [storage] in config.ini, uncomment the ./data:/app/data volume in docker-compose.yml and set path under /app/data/ (e.g. /app/data/ad-posts.db).
docker build and docker runBuild the image and mount your configuration and cookies into the container (replace /absolute/path/to/... with the absolute paths on your host):
docker build -t real-estates-watcher:latest .
docker run -d \
--mount type=bind,source=/absolute/path/to/config.ini,target=/app/config.ini,readonly \
--mount type=bind,source=/absolute/path/to/cookies.json,target=/app/scraper/cookies.json,readonly \
real-estates-watcher:latest
If you enable file output or persistent storage, set their paths to a writable directory or mounted volume.
All watcher settings are read once from a single INI file. Pass its path with --config (or -c):
dotnet RealEstatesWatcher.UI.Console.dll --config config.ini
Start from the unified template. Relative file paths resolve from the current working directory. The Node.js executable path must be absolute when specified. NLog.config remains the logging configuration, and scraper cookies remain in their JSON data file.
engine.ini, handlers.ini, filters.ini and scraper.ini into config.ini without changing their setting names.portals.ini to uniquely numbered entries under [portals], as shown below. Change // comments to INI ; comments.--config config.ini.[basic] or [nodejs] section, including its keys, to disable filtering or the scraper respectively. A dynamic portal still requires the Node.js scraper.[general] and [gcloud] - configuration of the watching engine and Google Cloud logging
βCHANGEβ(since v1.6) π
[settings] to [general].[general]
check_interval_minutes= # <number> | required | periodic checking interval, minimum 1 minute
start_periodic_check_at= # <time> | optional | exact time of day to start periodic checks (format: HH:mm:ss)
perform_check_on_startup= # <bool> | optional | switch to indicate whether to perform the initial check of all portals on application startup when exact time of day for periodic checks is set (see 'start_periodic_check_at' setting below).
enable_multiple_portal_instances= # <bool> | optional | enable/disable multiple instances of the same portal (in case of watching multiple URLs of the same portal)
[gcloud]
enable_cloud_logging= # <bool> | optional | switch to enable sending logs to Google Cloud Logging service
application_id= # <string> | optional | identifier of the application instance in Google Cloud Logging service (defaults to randomly generated GUID)
project_id= # <string> | optional | identifier of the Google Cloud project (required when running outside of Google Cloud environment, applicable only in DEBUG mode).
service_name= # <string> | optional | name of the service to be used in Google Cloud Logging service (required when running outside of Google Cloud environment, applicable only in DEBUG mode).
[portals] - all search URLs to watch
Use a unique numeric key for each URL. INI comments (;) disable entries; blank values are ignored. URLs can contain query parameters and equals signs.
[portals]
0=https://reality.idnes.cz/s/prodej/domy/cena-do-7000000/
1=https://reality.idnes.cz/s/prodej/pozemky/
; 2=https://www.sreality.cz/hledani/prodej/domy/
3=https://reality.bazos.cz/prodam/dum/
[email] and [file] - configuration of the classes handling the received Ad posts
βCHANGEβ(since v1.4.7)
[email]
enabled= # <bool> | required | enable/disable this handler
from= # <string> | required | email address for outgoing notifications
to= # <strings> | required | list of email addresses where to send notifications (separated by comma)
cc= # <strings> | optional | list of email CC addresses where to send notifications (separated by comma)
bcc= # <strings> | optional | list of email BCC addresses where to send notifications (separated by comma)
sender_name= # <string> | required | name of the sending entity for the email_address_from
username= # <string> | required | login username of sending email account
password= # <string> | required | login password of sending email account
smtp_server_host= # <string> | required | URL of the SMTP server that handles sending notification emails
smtp_server_port= # <string> | required | port of the SMTP server that handles sending notification emails
use_secure_connection= # <bool> | required | switch for using TLS connection to the SMTP server
skip_initial_notification= # <bool> | required | switch to disable sending the initial list of current Real estate offers
[file]
enabled= # <bool> | required | enable/disable this handler
main_path= # <string> | required | path to the file where to save initial and new Ad posts
separate_new_posts= # <bool> | optional | set 'true' if you want to save new Ad posts in separate file from the initial list
new_posts_path= # <string> | optional | path to the file where to save new Ad posts (required when separate_new_posts=true)
print_format= # <strings> | optional | format of printing parsed Ads to file, (allowed enum values below) (defaults to 'PlainText')
[basic] - optional configuration of the Ads filter (omit the section to disable filtering)
[basic]
price_min= # <number> | optional | minimal price of Real estate
price_max= # <number> | optional | maximal price of Real estate
layouts= # <strings> | optional | layouts of Real estate (allowed enum values below)(separated by comma)
floor_area_min= # <number> | optional | minimal floor area of Real estate
floor_area_max= # <number> | optional | maximal floor area of Real estate
1+1, 1+kk, 2+1, 2+kk, 3+1, 3+kk, 4+1, 4+kk, 5+1, 5+kkPlainText, Html (case-insensitive)βADDEDβ(since v1.4.6) π
[nodejs] - optional configuration of the Web scraper for dynamic portal pages requiring JavaScript (omit the section when no scraper is needed)
[nodejs]
path_to_node_executable= # <string> | optional | absolute path to Node.js (defaults to the standard platform install path)
path_to_script= # <string> | required | path to web scraping script
page_scraping_timeout_seconds= # <number> | required | maximum timeout for scraping a single webpage (when set to 0 waits indefinitely)
path_to_cookies_file= # <string> | optional | path to file with cookies that may be needed with some Ad portals (see README)
[storage] - optional persistent storage of seen Ad posts across restarts (omit the section or set enabled=false to disable)
[storage]
enabled= # <bool> | optional | enable/disable persistent storage (defaults to 'false')
provider= # <string> | required | storage backend when enabled: 'Json' or 'Sqlite' (case-insensitive)
path= # <string> | required | file path to the JSON file or SQLite database (relative to working directory)