diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-05-14 16:38:03 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-05-14 16:38:03 -0700 |
| commit | 3d06969f7094054b89299482159f018b6ba3b62f (patch) | |
| tree | 1e2a983438643bb86f2de5a86e7c51570133d95d | |
| parent | a98cbc880c6e2a862ee1a1716fe522410f91ccd9 (diff) | |
wmmt: fix oce and jpn image paths
| -rw-r--r-- | bandai_namco/wmmt.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/bandai_namco/wmmt.py b/bandai_namco/wmmt.py index eaa4767..d75e0b5 100644 --- a/bandai_namco/wmmt.py +++ b/bandai_namco/wmmt.py @@ -52,7 +52,7 @@ def make_wmmt_parser(version: constants.WANGAN_MAXI_VERSION): url = url.replace(".php", ".html") results.append({ "url": url, - "title": title, + "headline": title, "date": date, "type": TYPE_MAP.get(type_name, "Unknown") }) @@ -78,7 +78,7 @@ def make_wmmt_parser(version: constants.WANGAN_MAXI_VERSION): url = url.replace(".php", ".html") results.append({ "url": url, - "title": title, + "headline": title, "date": date, "type": TYPE_MAP.get(type_name, "Unknown") }) @@ -104,7 +104,7 @@ def make_wmmt_parser(version: constants.WANGAN_MAXI_VERSION): url = url.replace(".php", ".html") results.append({ "url": url, - "title": title, + "headline": title, "date": date, "type": TYPE_MAP.get(type_name, "Unknown") }) @@ -167,9 +167,17 @@ def make_wmmt_news_extractor(identifier: str, version: constants.WANGAN_MAXI_VER content = first_p.get_text(" ", strip=True) if first_p else "" images = [] for img in container.select("img"): - src = img.get("src") + src = img.get("src").replace("./","").lstip("/") if not src: continue + if data["type"] == "EVENTS": + src = "event/online/" + src + elif data["type"] == "SPECIAL": + src = "special/" + src + elif data["type"] == "FUTURE LAB": + src = "miraiken/" + src + elif data["type"] == "UPDATE": + src = "update/" + src src = src.replace("./", "").lstrip("/") img_url = f"{image_base}/{src}" parent = img.find_parent("a") @@ -197,7 +205,17 @@ def make_wmmt_news_extractor(identifier: str, version: constants.WANGAN_MAXI_VER content = first_p.get_text(" ", strip=True) if first_p else "" images = [] for img in container.select("img"): - src = img.get("src") + src = img.get("src").replace("./","").lstip("/") + if not src: + continue + if data["type"] == "EVENTS": + src = "event/online/" + src + elif data["type"] == "SPECIAL": + src = "special/" + src + elif data["type"] == "FUTURE LAB": + src = "miraiken/" + src + elif data["type"] == "UPDATE": + src = "update/" + src if not src: continue src = src.replace("./", "").lstrip("/") |
