diff options
| -rw-r--r-- | community/rbdx.py | 29 | ||||
| -rw-r--r-- | constants.py | 1 | ||||
| -rw-r--r-- | generate.py | 4 | ||||
| -rw-r--r-- | news_feed.py | 5 | ||||
| -rw-r--r-- | site/src/components/TitleBar.tsx | 1 | ||||
| -rw-r--r-- | site/src/utils.ts | 1 |
6 files changed, 41 insertions, 0 deletions
diff --git a/community/rbdx.py b/community/rbdx.py new file mode 100644 index 0000000..d5044e0 --- /dev/null +++ b/community/rbdx.py @@ -0,0 +1,29 @@ +from bs4 import BeautifulSoup +from urllib.parse import urljoin +from datetime import datetime +import time + +def get_carousel_posts(html: str): + soup = BeautifulSoup(html, 'html.parser') + base_url = "https://dxplus.chilundui.com/" + carousel = soup.find('div', class_='carousel-inner') + if not carousel: + return [] + + news_posts = [] + current_date_string = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + current_unix_time = int(time.time()) + for item in carousel.find_all('div', class_='carousel-item'): + img_tag = item.find('img') + if img_tag and img_tag.get('src'): + news_posts.append({ + "date": current_date_string, + "identifier": "REFLEC_BEAT_DELUXE_PLUS", + "type": None, + "timestamp": current_unix_time, + "url": None, + "headline": None, + "content": "[お知らせ] ANNOUNCEMENT FROM REFLECT BEAT DELUXE PLUS", + "images": urljoin(base_url, img_tag['src']) + }) + return news_posts diff --git a/constants.py b/constants.py index 2e7d436..ba725f0 100644 --- a/constants.py +++ b/constants.py @@ -30,6 +30,7 @@ CHUNI_RECURSIVE_IMAGE=True # Scrape the individual post pages and get all images WACCA_PLUS_MAGIC_STRING="1206017527864369262" MUSECA_PLUS_NEWS_SITE="https://museca.plus/" +RB_DELUXE_PLUS_NEWS="https://dxplus.chilundui.com/" class CHUNITHM_VERSION(Enum): LUMINOUS_PLUS = 1 diff --git a/generate.py b/generate.py index 9ace165..194b909 100644 --- a/generate.py +++ b/generate.py @@ -115,6 +115,9 @@ def generate_wacca_plus_news_file(): def generate_museca_plus_news_file(): return generate_news_file("museca_plus_news", constants.MUSECA_PLUS_NEWS_SITE) +def generate_rbdx_plus_news_file(): + return generate_news_file("rb_deluxe_plus_news", constants.RB_DELUXE_PLUS_NEWS) + if __name__ == "__main__": log_output("JOB START", "TASK") if not os.path.exists(OUTPUT_DIR): @@ -136,6 +139,7 @@ if __name__ == "__main__": taiko_news_data = generate_taiko_news_file() wacca_plus_news = generate_wacca_plus_news_file() museca_plus_news = generate_museca_plus_news_file() + generate_rbdx_plus_news_file() news = create_merged_feed( diff --git a/news_feed.py b/news_feed.py index 766d77b..c6df924 100644 --- a/news_feed.py +++ b/news_feed.py @@ -33,6 +33,7 @@ import bandai_namco.taiko as taiko import community.disc as disc import community.wacca_plus.wacca_plus as wac_plus import community.museca_plus as mus_plus +import community.rbdx as rbdx import constants import translate @@ -149,6 +150,10 @@ def get_news(news_url: str, version=None) -> list: site_data = download_site_as_html(news_url) news_posts = sorted(mus_plus.parse_museca_plus_news_site(site_data), key=lambda x: x['timestamp'], reverse=True) + elif news_url == constants.RB_DELUXE_PLUS_NEWS: + site_data = download_site_as_html(news_url) + news_posts = rbdx.get_carousel_posts(site_data) + else: news_posts = [] return news_posts diff --git a/site/src/components/TitleBar.tsx b/site/src/components/TitleBar.tsx index 937fcf7..728060a 100644 --- a/site/src/components/TitleBar.tsx +++ b/site/src/components/TitleBar.tsx @@ -89,6 +89,7 @@ const TitleBar: React.FC = () => { games: [ { id: "wacca_plus", title: "WACCA PLUS" }, { id: "museca_plus", title: "MÚSECA PLUS" }, + { id: "rb_deluxe_plus", title: "RB DELUXE PLUS" }, ], }, ]; diff --git a/site/src/utils.ts b/site/src/utils.ts index 4fe3493..6e71c9c 100644 --- a/site/src/utils.ts +++ b/site/src/utils.ts @@ -19,6 +19,7 @@ export const getGameTitle = (gameId: string) => { if (lowerCaseGameId.startsWith("taiko")) return "Taiko no Tatsujin"; if (lowerCaseGameId.startsWith("wacca")) return "WACCA PLUS"; if (lowerCaseGameId.startsWith("museca")) return "MÚSECA PLUS"; + if (lowerCaseGameId.startsWith("rb_deluxe")) return "REFLEC BEAT DELUXE PLUS"; return gameId.toUpperCase(); |
