1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 04:32:51 +01:00

merge #5094: [webtoons] fix extracting comic and episode name with commas

This commit is contained in:
Mike Fährmann 2024-01-21 00:47:26 +01:00
commit 5bf156f0b1
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 41 additions and 4 deletions

View File

@ -88,10 +88,20 @@ class WebtoonsEpisodeExtractor(WebtoonsBase, GalleryExtractor):
def metadata(self, page):
extr = text.extract_from(page)
keywords = extr('<meta name="keywords" content="', '"').split(", ")
title = extr('<meta property="og:title" content="', '"')
descr = extr('<meta property="og:description" content="', '"')
if extr('<div class="subj_info"', '\n'):
comic_name = extr('>', '<')
episode_name = extr('<h1 class="subj_episode" title="', '"')
else:
comic_name = episode_name = ""
if extr('<span class="tx _btnOpenEpisodeList ', '"'):
episode = extr('>#', '<')
else:
episode = ""
if extr('<div class="author_area"', '\n'):
username = extr('/creator/', '"')
author_name = extr('<span>', '</span>')
@ -104,9 +114,9 @@ class WebtoonsEpisodeExtractor(WebtoonsBase, GalleryExtractor):
"title_no" : self.title_no,
"episode_no" : self.episode_no,
"title" : text.unescape(title),
"episode" : keywords[1],
"comic_name" : text.unescape(keywords[0]),
"episode_name": text.unescape(keywords[2]),
"episode" : episode,
"comic_name" : text.unescape(comic_name),
"episode_name": text.unescape(episode_name),
"username" : username,
"author_name" : text.unescape(author_name),
"description" : text.unescape(descr),

View File

@ -61,10 +61,37 @@ __tests__ = (
"comic_name" : "I want to be a cute anime girl",
"episode_name": "209 - The story's story",
"episode" : "214",
"username" : "m9huj",
"author_name" : "Azul Crescent",
},
{
"#url" : "https://www.webtoons.com/en/canvas/i-want-to-be-a-cute-anime-girl/174-not-194-it-was-a-typo-later/viewer?title_no=349416&episode_no=179",
"#category": ("", "webtoons", "episode"),
"#class" : webtoons.WebtoonsEpisodeExtractor,
"#count" : 4,
"comic_name" : "I want to be a cute anime girl",
"episode_name": "174 (not 194, it was a typo) - Later",
"episode" : "179",
"username" : "m9huj",
"author_name" : "Azul Crescent",
},
{
"#url" : "https://www.webtoons.com/en/canvas/us-over-here/1-the-wheel/viewer?title_no=919536&episode_no=1",
"#category": ("", "webtoons", "episode"),
"#class" : webtoons.WebtoonsEpisodeExtractor,
"#count" : 59,
"comic_name" : "Us, over here",
"episode_name": "1. The Wheel",
"episode" : "1",
"username" : "i94q8",
"author_name" : "spin.ani",
},
{
"#url" : "https://www.webtoons.com/en/comedy/live-with-yourself/list?title_no=919",
"#comment" : "english",