add scraping logic

This commit is contained in:
Vxrtrauter
2025-10-18 01:22:11 +02:00
parent 1cab671a13
commit 7e5e3033e6
2 changed files with 18 additions and 5 deletions
+14 -4
View File
@@ -15,12 +15,22 @@ def scrape_monkrus_telegram():
bubbles = soup.find_all("div", class_="tgme_widget_message_bubble")
for bubble in bubbles:
post_txt = bubble.find("div", class_="tgme_widget_message_text js-message_text") # this doesnt work
if post_txt.b:
posts.append(Post(text=post_txt.get_text()))
post_txt = bubble.find("div", class_="tgme_widget_message_text js-message_text")
title = post_txt.b.text
url = bubble.find("a", href=lambda x: x and x.startswith("https://uztracker.net"))
print(post_txt.b.text)
posts.append(Post(
id = len(posts) + 1,
title = title,
url = url,
author = "m0nkrus"
))
print(posts)
+4 -1
View File
@@ -23,4 +23,7 @@ state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], downloa
@dataclass
class Post:
text: str
id: int
title: str
url: str
author: str