From 5637e8065703f226761f80d18b33e93694a5b0fc Mon Sep 17 00:00:00 2001 From: Vxrtrauter Date: Fri, 17 Oct 2025 21:23:17 +0200 Subject: [PATCH] added some more testing stuff --- core/data/scrapers/monkrus.py | 14 +++++++++++--- core/utils/data/state.py | 7 +++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/data/scrapers/monkrus.py b/core/data/scrapers/monkrus.py index 64c25ad..3b60645 100644 --- a/core/data/scrapers/monkrus.py +++ b/core/data/scrapers/monkrus.py @@ -1,18 +1,26 @@ +from core.utils.data.state import state, Post from bs4 import BeautifulSoup import requests def scrape_monkrus_telegram(): - telegram_channel = "https://t.me/s/real_monkrus/rss" + telegram_channel = "https://t.me/s/real_monkrus/" + posts: list[Post] = [] response = requests.get(telegram_channel) print(response.status_code) # rm later - soup = BeautifulSoup(response.text, 'html.parser') - posts_txt = soup.find_all('div', class_=["tgme_widget_message_wrap js-widget_message_wrap", "tgme_widget_message_wrap js-widget_message_wrap date_visible"]) + soup = BeautifulSoup(response.text, "html.parser") + posts = soup.find_all("div", class_=["tgme_widget_message_wrap js-widget_message_wrap", "tgme_widget_message_wrap js-widget_message_wrap date_visible"]) + + for post in posts: + posts_txt = post.find("div", class_="tgme_widget_message_text js-message_text") # this doesnt work + + print(posts_txt) + scrape_monkrus_telegram() \ No newline at end of file diff --git a/core/utils/data/state.py b/core/utils/data/state.py index 633415e..deb9558 100644 --- a/core/utils/data/state.py +++ b/core/utils/data/state.py @@ -20,3 +20,10 @@ class AppState: aria2_threads: int = 4 state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], downloads=[], download_path="") + +@dataclass +class Post: + id: int + title: str + url: str + author: str