Skip to content
Dervish12Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Bina.az Property Scraper

This is a PHP-based web scraper for bina.az that collects property listings from owner-posted ads and sends them to a Telegram channel.

Features

  • Scrapes property listings from bina.az
  • Filters for owner-posted listings only
  • Stores listings in a MySQL database
  • Sends notifications to a Telegram channel
  • Runs automatically every 30 minutes
  • Comprehensive error logging

Requirements

  • PHP 7.4 or higher
  • MySQL 5.7 or higher
  • Composer
  • PHP Extensions:
    • PDO
    • curl
    • mbstring
    • dom

Installation

  1. Clone the repository:
git clone [repository-url]
cd bina-scraper
  1. Install dependencies:
composer install
  1. Set up the database:
mysql -u root -p < database.sql
  1. Configure environment variables:
cp .env.example .env

Edit .env and add your database and Telegram credentials.

  1. Set up the cron job to run every 30 minutes:
*/30 * * * * cd /path/to/bina-scraper && php run.php >> /path/to/bina-scraper/logs/cron.log 2>&1

Usage

To run the scraper manually:

php run.php

Logging

Logs are stored in the logs directory:

  • scraper.log: Contains detailed scraping information and errors
  • cron.log: Contains cron job execution logs

Error Handling

The scraper includes comprehensive error handling:

  • Network errors are logged and retried
  • Database errors are logged with full stack traces
  • Malformed HTML is gracefully handled
  • Rate limiting is respected with sleep intervals

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages