Skip to content

Commit

Permalink
fix bangumi title
Browse files Browse the repository at this point in the history
  • Loading branch information
j1g5awi authored Dec 7, 2024
1 parent a1461ec commit fb876fb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions catalog/sites/bangumi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from collections import OrderedDict

from catalog.book.utils import detect_isbn_asin
from catalog.common import *
Expand Down Expand Up @@ -125,10 +126,14 @@ def scrape(self):
raw_img, ext = BasicImageDownloader.download_image(
img_url, None, headers={}
)
titles = set(
titles = OrderedDict.fromkeys(
[title] + (other_title or []) + ([orig_title] if orig_title else [])
)
localized_title = [{"lang": detect_language(t), "text": t} for t in titles]
if o.get("name_cn"):
titles[o.get("name_cn")] = "zh-cn"
localized_title = [
{"lang": l or detect_language(t), "text": t} for t, l in titles.items()
]
localized_desc = (
[{"lang": detect_language(brief), "text": brief}] if brief else []
)
Expand Down

0 comments on commit fb876fb

Please sign in to comment.