Decode HTML entities in Gelbooru tags

Fixes ' showing instead of apostrophes in tag names.
This commit is contained in:
pax 2026-04-04 21:52:20 -05:00
parent 708d177801
commit 50d22932fa

View File

@ -62,7 +62,7 @@ class GelbooruClient(BooruClient):
id=item["id"], id=item["id"],
file_url=file_url, file_url=file_url,
preview_url=item.get("preview_url"), preview_url=item.get("preview_url"),
tags=item.get("tags", ""), tags=self._decode_tags(item.get("tags", "")),
score=item.get("score", 0), score=item.get("score", 0),
rating=item.get("rating"), rating=item.get("rating"),
source=item.get("source"), source=item.get("source"),
@ -72,6 +72,11 @@ class GelbooruClient(BooruClient):
) )
return posts return posts
@staticmethod
def _decode_tags(tags: str) -> str:
from html import unescape
return unescape(tags)
async def get_post(self, post_id: int) -> Post | None: async def get_post(self, post_id: int) -> Post | None:
params: dict = { params: dict = {
"page": "dapi", "page": "dapi",