jak wprowadzić automatyzację alertów?
- User
jak wprowadzić automatyzację alertów?
Assistant
jak wprowadzić automatyzację alertów?
Krok po kroku:
Plusy: Legalne, szybkie, darmowe
Minusy: Brak filtrowania po słowach kluczowych typu "pilnie", delay 5-15 minut
OLX udostępnia kanały RSS dla wyszukiwań:
Instrukcja:
&view=galleryWide i zmień www.olx.pl na www.olx.pl/api/v1/offersPrzykładowy RSS:
https://www.olx.pl/api/v1/offers?category_id=505&query=ipad%20pro&filter_enum_screen_diagonal[0]=11&filter_float_price%3Ato=3500&view=galleryWide
Google indeksuje OLX bardzo szybko:
site:olx.pl "iPad Pro 11" OR "iPad Pro 12.9" ("pilnie" OR "szybko" OR "gotówka") -4000zł
Bonus: Możesz dodać -intitle:"sprzedam" aby wykluczyć typowe ogłoszenia
Potężne narzędzie no-code:
// Przykładowy filtr w Make:
{
"price": "< 3500",
"title": {
"$regex": "/(pilnie|szybko|gotówka|natychmiast)/i"
}
}
Kompletne rozwiązanie z botami Telegram:
import requests
from bs4 import BeautifulSoup
import telegram
import asyncio
import re
from datetime import datetime
# Konfiguracja
TELEGRAM_TOKEN = "twój_token_z_BotFather"
CHAT_ID = "twój_chat_id"
KEYWORDS = ["pilnie", "szybko", "gotówka", "natychmiast", "dziś"]
MAX_PRICES = {"11": 3300, "12.9": 4900}
class OLXMonitor:
def __init__(self):
self.bot = telegram.Bot(token=TELEGRAM_TOKEN)
self.seen_offers = set()
async def check_offers(self):
urls = [
"https://www.olx.pl/elektronika/tablety/q-ipad-pro-11/?search%5Border%5D=created_at%3Adesc",
"https://www.olx.pl/elektronika/tablety/q-ipad-pro-12.9/?search%5Border%5D=created_at%3Adesc"
]
for url in urls:
response = requests.get(url, headers={"User-Agent": "Mozilla/5.0"})
soup = BeautifulSoup(response.text, 'html.parser')
for offer in soup.select('div[data-cy="l-card"]'):
offer_id = offer.get('id')
if offer_id in self.seen_offers:
continue
title = offer.select_one('h6').text.strip()
price_text = offer.select_one('[data-testid="ad-price"]').text
price = int(re.sub(r'\D', '', price_text))
link = "https://www.olx.pl" + offer.select_one('a')['href']
# Sprawdź kryteria
has_keyword = any(kw in title.lower() for kw in KEYWORDS)
size = "11" if "11" in title else "12.9" if "12" in title else None
if size and price <= MAX_PRICES.get(size, 99999):
if has_keyword:
priority = "🚨 PILNE"
else:
priority = "✅ OKAZJA"
message = f"""
{priority} iPad Pro {size}"
📱 {title}
💰 {price} zł
🔗 {link}
⏰ {datetime.now().strftime('%H:%M')}
"""
await self.bot.send_message(chat_id=CHAT_ID, text=message)
self.seen_offers.add(offer_id)
async def run(self):
while True:
try:
await self.check_offers()
except Exception as e:
print(f"Błąd: {e}")
await asyncio.sleep(180) # sprawdzaj co 3 minuty
# Uruchomienie
monitor = OLXMonitor()
asyncio.run(monitor.run())
Instrukcja Telegram:
/newbot i postępuj zgodnie z instrukcjamihttps://api.telegram.org/bot<TOKEN>/getUpdates i znajdź swój chat_idDarmowe opcje:
GitHub Actions przykład (.github/workflows/olx-monitor.yml):
name: OLX Monitor
on:
schedule:
- cron: '*/5 * * * *' # co 5 minut
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install requests beautifulsoup4 python-telegram-bot
- run: python monitor.py
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.CHAT_ID }}
Pro-tip: Łącz metody! Np. oficjalne alerty OLX dla ogólnego monitoringu + Python bot dla super-okazji z keywords.
Masz pytania do któregoś rozwiązania? Mogę rozwinąć konkretną metodę.