Hide native spoiler tags

This commit is contained in:
blank X 2022-03-09 20:56:39 +07:00
parent fa54d641cc
commit 3dfa3cfff7
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 2 additions and 5 deletions

View File

@ -82,9 +82,6 @@ CHARACTER_QUERY = '''query ($id: Int, $search: String) {
}
}'''
def hide_spoiler(match):
return re.sub(r'\S', '', match.group(1))
async def generate_media(anilist):
title_romaji = anilist['title']['romaji']
title_english = anilist['title']['english']
@ -96,7 +93,7 @@ async def generate_media(anilist):
format = anilist['format']
format = FORMAT_NAMES.get(format, format)
status = (anilist['status'] or 'Unknown').replace('_', ' ').title()
description = re.sub(r"<span class='markdown_spoiler'><span>(.+)</span></span>", hide_spoiler, (anilist.get('description') or '').strip())
description = re.sub(r"<span class='markdown_spoiler'>([\s\S]+?)</span>", r'<spoiler>\1</spoiler>', (anilist.get('description') or '').strip())
episodes = anilist['episodes']
duration = anilist['duration']
chapters = anilist['chapters']
@ -153,7 +150,7 @@ async def generate_character(anilist):
title_full = anilist['name']['full']
title_native = anilist['name']['native']
title_alternative = ', '.join(anilist['name']['alternative'])
description = re.sub(r"<span class='markdown_spoiler'><span>(.+)</span></span>", hide_spoiler, (anilist.get('description') or '').strip())
description = re.sub(r"<span class='markdown_spoiler'>([\s\S]+?)</span>", r'<spoiler>\1</spoiler>', (anilist.get('description') or '').strip())
site_url = anilist['siteUrl']
image = anilist['image']['large']
media = anilist['media']