diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-04-17 21:21:07 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-04-17 21:21:07 -0700 |
| commit | c33483b7bdef67d90c05f58319faa048d3ca12b4 (patch) | |
| tree | 3f017916c332bac30aeec8eaf4a2ecd8c9f4688f | |
| parent | 239cf3ce1a5e86ea0cb681f1eb9ff6a00b49a73c (diff) | |
| parent | ccddc4541c69dff0445edbcc56b07a7835c4e2de (diff) | |
handle taiko news data
| -rw-r--r-- | rasis.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -67,7 +67,7 @@ def generate_post_content(post_data: dict) -> str: elif "GITADORA " in post_data["identifier"]: game = "GITADORA" tags = "#gitadora #bemani" - elif "NOLSTALGIA" in post_data["identifier"]: + elif "NOSTALGIA" in post_data["identifier"]: game = "NOSTALGIA" tags = "#bemani" elif "CHUNITHM_JP" in post_data["identifier"]: @@ -93,12 +93,18 @@ def generate_post_content(post_data: dict) -> str: elif "TAIKO" in post_data["identifier"]: game = "Taiko no Tatsujin" tags = "#taikonotatsujin" + else: + return None content = f"📰 {game} - {post_data['date']}\n\n" if post_data["type"] is not None: content = content + f"[{post_data['type']}] " if post_data["headline"] is not None and post_data["headline"] != post_data["content"] : content = content + f"[{post_data['headline']}]\n\n" - content = content + post_data["content"] + "\n\n" + if len(post_data["content"]) > 3000: + truncated_content = post_data["content"][:3000] + "..." + content = content + truncated_content + "\n\n" + else: + content = content + post_data["content"] + "\n\n" if post_data["url"] is not None: content = content + f"🔗 {post_data['url']}\n" for i in range(len(post_data["images"])): @@ -131,5 +137,7 @@ if __name__ == "__main__": queued_posts = generate_queued_posts() for post in queued_posts: content = generate_post_content(post) + if content is None: + continue cleaned = content.encode("utf-8", "replace").decode("utf-8") post_on_fedi(cleaned) |
