aboutsummaryrefslogtreecommitdiffstats
path: root/sega/maimaidx_intl.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-03-12 13:56:30 -0700
committerPinapelz <yukais@pinapelz.com>2026-03-12 13:56:50 -0700
commitcaa3cf245186ab0f6fb33e63a7dd838d834da12e (patch)
treebc5742a134ecabf0b9d35cc12b1d6f67defd5da7 /sega/maimaidx_intl.py
parent5658441ab9b703c95a48e654d41e45cc3a55ffd3 (diff)
refactor: move to common NewsSource interface
cleanup imports by defining initaliazers modules and decorator remove legacy scrapers remove single factory for sega games (sites don't change that much)
Diffstat (limited to 'sega/maimaidx_intl.py')
-rw-r--r--sega/maimaidx_intl.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/sega/maimaidx_intl.py b/sega/maimaidx_intl.py
index 3e26a37..8182117 100644
--- a/sega/maimaidx_intl.py
+++ b/sega/maimaidx_intl.py
@@ -1,53 +1,7 @@
from bs4 import BeautifulSoup
from datetime import datetime, timezone, timedelta
-from enum import Enum
import json
-class ParserVersion(Enum):
- ALPHA=1
-
-def make_maimaidx_intl_parser(identifier: str, parser: ParserVersion):
- """
- Parses the download page of maimai dx intl site. API route method below is preferred as information is the same
- """
- def alpha_parser(html: str):
- """
- Confirmed on:
- PRISM
- """
- soup = BeautifulSoup(html, "html.parser")
- items = soup.select(".dl--pop__item")
-
- entries = []
- for item in items:
- date_text = item.select_one(".dl--pop__head").text.strip().replace(" UP", "")
- dt = datetime.strptime(date_text, "%Y.%m.%d").replace(tzinfo=timezone(timedelta(hours=9)))
- timestamp = int(dt.timestamp())
-
- img_tag = item.select_one("a.dl--pop__thumb img")
- image_url = img_tag["srcset"] if img_tag else None
- full_image_url = image_url.replace("../", "https://maimai.sega.com/") if image_url else None
-
- entry = {
- "date": date_text,
- "identifier": identifier,
- "type": None,
- "timestamp": timestamp,
- "headline": None,
- "content": f"New maimai DX International News / maimai DX International の新しいお知らせ\n\n{full_image_url}",
- "url": None,
- "images": [
- {
- "image": full_image_url,
- "link": None
- }
- ],
- 'is_ai_summary': False
- }
- entries.append(entry)
- return entries
- if parser == ParserVersion.ALPHA:
- return alpha_parser
def parse_maimaidx_intl_api_route(raw_api_data: str, identifier: str, limit: int):
route_data = json.loads(raw_api_data)
@@ -84,6 +38,3 @@ def parse_maimaidx_intl_api_route(raw_api_data: str, identifier: str, limit: int
}
entries.append(entry)
return entries
-
-
-parse_maimaidx_intl_news_site = make_maimaidx_intl_parser("MAIMAIDX_INTL", ParserVersion.ALPHA)
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage