You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 17, 2026. It is now read-only.
while True:
try:
# Отправляем GET-запрос на форум с заголовком User-Agent (имитация браузера)
headers = {"User-Agent": "Mozilla/5.0"}
r = requests.get(URL, headers=headers)
# Проверяем код ответа сервера
if r.status_code != 200:
print(f"Ошибка HTTP: {r.status_code}")
time.sleep(30) # Пауза при ошибке
continue # Переходим к следующей итерации цикла
# Парсим HTML-страницу
soup = BeautifulSoup(r.text, "html.parser")
thread = soup.select_one(".structItem-title a") # Находим первую тему (ссылку)
if thread: # Если тема найдена
title = thread.text.strip() # Извлекаем текст заголовка
href = thread["href"] # Извлекаем ссылку на тему
# Формируем полный URL
if href.startswith("http"):
link = href
else:
link = "https://forum.matrp.ru" + href
# Отправляем сообщение в Telegram, если заголовок изменился
if title != last_title:
last_title = title
message = f"🚨 Новая жалоба\n\n{title}\n{link}"
bot.send_message(chat_id=CHAT_ID, text=message)
print(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Отправлена новость: {title}")
except Exception as e:
print(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Ошибка: {e}")
time.sleep(30) # Пауза при исключении
time.sleep(60) # Пауза между проверками (60 секунд)
while True:
try:
# Отправляем GET-запрос на форум с заголовком User-Agent (имитация браузера)
headers = {"User-Agent": "Mozilla/5.0"}
r = requests.get(URL, headers=headers)