mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
add scraping logic
This commit is contained in:
@@ -15,12 +15,22 @@ def scrape_monkrus_telegram():
|
|||||||
bubbles = soup.find_all("div", class_="tgme_widget_message_bubble")
|
bubbles = soup.find_all("div", class_="tgme_widget_message_bubble")
|
||||||
|
|
||||||
for bubble in bubbles:
|
for bubble in bubbles:
|
||||||
post_txt = bubble.find("div", class_="tgme_widget_message_text js-message_text") # this doesnt work
|
post_txt = bubble.find("div", class_="tgme_widget_message_text js-message_text")
|
||||||
if post_txt.b:
|
|
||||||
posts.append(Post(text=post_txt.get_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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,4 +23,7 @@ state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], downloa
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Post:
|
class Post:
|
||||||
text: str
|
id: int
|
||||||
|
title: str
|
||||||
|
url: str
|
||||||
|
author: str
|
||||||
|
|||||||
Reference in New Issue
Block a user