mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
added some more testing stuff
This commit is contained in:
@@ -1,18 +1,26 @@
|
|||||||
|
from core.utils.data.state import state, Post
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def scrape_monkrus_telegram():
|
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)
|
response = requests.get(telegram_channel)
|
||||||
print(response.status_code) # rm later
|
print(response.status_code) # rm later
|
||||||
|
|
||||||
soup = BeautifulSoup(response.text, 'html.parser')
|
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"])
|
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)
|
print(posts_txt)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
scrape_monkrus_telegram()
|
scrape_monkrus_telegram()
|
||||||
@@ -20,3 +20,10 @@ class AppState:
|
|||||||
aria2_threads: int = 4
|
aria2_threads: int = 4
|
||||||
|
|
||||||
state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], downloads=[], download_path="")
|
state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], downloads=[], download_path="")
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Post:
|
||||||
|
id: int
|
||||||
|
title: str
|
||||||
|
url: str
|
||||||
|
author: str
|
||||||
|
|||||||
Reference in New Issue
Block a user