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.
python 3.6 or higher
pipenv
sqlite3
- Clone project to your own local machine -
git clone https://github.com/digitalashes/olx-parser.git
- Go to the script directory -
cd olx-parser
- Copy file env.example to config directory and rename it to .env -
cp env.example ./config/.env
- Fill in TELEGRAM_BOT_KEY and TELEGRAM_CHAT_IDS in
config/.env
also if you want, you can uncomment and change others constants. - Create new pipenv environment -
pipenv install
- Run
pipenv shell main.py
and waiting messages.
Crontab rule (every 30 minutes) - 0/30 * * * * <path to python interpritator> <path to file main.py>
- BASE_URL - Base url of olx with protocol. -
https://www.olx.ua/
- PHONE_URL - Url for fetching seller telephone numbers.
- CATEGORY -
nedvizhimost
- SUB_CATEGORY -
arenda-kvartir
- SUB_SUB_CATEGORY -
dolgosrochnaya-arenda-kvartir
- CITY -
odessa
- DISTRICT_ID -
85
(Киевский),199
(Коминтерновский),87
(Малиновский),89
(Приморский),91
(Суворовский) - MIN_PRICE - Min price of flat rent (not set less 1000).
2500
- MAX_PRICE - Max price of flat rent.
5000
- MIN_ROOMS - Min rooms amount in flat.
1
- MAX_ROOMS - Max rooms amount in flat.
1
- WITH_PHOTOS - Search ads with photos only or not.
True
- WITH_PROMOTED - Include promoted ads.
False
- PUBLICATION_DATE - List of values with information when ad was published.
['сегодня', 'вчера']
- TELEGRAM_BOT_API_URL - Telegram api url.
- TELEGRAM_BOT_KEY - Api key of telegram bot which will be sending messages.
- TELEGRAM_CHAT_IDS - List of conversations ids when messages will be sending.
- LOG_FILENAME - Name of logfile.