digitalashes / olx-parser

Looks for new flats in Odessa and notify in the telegram through the bot
53 stars 14 forks source link
flats odessa olx parser python script telegram telegram-bot

OLX flat parser.

Simple python script which can be running by crontab every 30 minutes for instance, looking up about new flats in Odessa and notifying in the telegram through the bot. The script is looking for apartments that were added yesterday and today only.

Prerequisites

  1. python 3.6 or higher
  2. pipenv
  3. sqlite3

Getting Started

  1. Clone project to your own local machine - git clone https://github.com/digitalashes/olx-parser.git
  2. Go to the script directory - cd olx-parser
  3. Copy file env.example to config directory and rename it to .env - cp env.example ./config/.env
  4. Fill in TELEGRAM_BOT_KEY and TELEGRAM_CHAT_IDS in config/.env also if you want, you can uncomment and change others constants.
  5. Create new pipenv environment - pipenv install
  6. Run pipenv shell main.py and waiting messages.

Settings description:

Crontab rule (every 30 minutes) - 0/30 * * * * <path to python interpritator> <path to file main.py>

  1. BASE_URL - Base url of olx with protocol. - https://www.olx.ua/
  2. PHONE_URL - Url for fetching seller telephone numbers.
  3. CATEGORY - nedvizhimost
  4. SUB_CATEGORY - arenda-kvartir
  5. SUB_SUB_CATEGORY - dolgosrochnaya-arenda-kvartir
  6. CITY - odessa
  7. DISTRICT_ID - 85 (Киевский), 199 (Коминтерновский), 87 (Малиновский), 89 (Приморский), 91 (Суворовский)
  8. MIN_PRICE - Min price of flat rent (not set less 1000). 2500
  9. MAX_PRICE - Max price of flat rent. 5000
  10. MIN_ROOMS - Min rooms amount in flat. 1
  11. MAX_ROOMS - Max rooms amount in flat. 1
  12. WITH_PHOTOS - Search ads with photos only or not. True
  13. WITH_PROMOTED - Include promoted ads. False
  14. PUBLICATION_DATE - List of values with information when ad was published. ['сегодня', 'вчера']
  15. TELEGRAM_BOT_API_URL - Telegram api url.
  16. TELEGRAM_BOT_KEY - Api key of telegram bot which will be sending messages.
  17. TELEGRAM_CHAT_IDS - List of conversations ids when messages will be sending.
  18. LOG_FILENAME - Name of logfile.