Decode HTML entities in Gelbooru tags
Fixes ' showing instead of apostrophes in tag names.
This commit is contained in:
parent
708d177801
commit
50d22932fa
@ -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",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user