From b6cf34865898f55634169f20cfa074bd71522a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 8 Nov 2024 14:16:54 +0100 Subject: [PATCH] [webtoons] extract 'episode_no' for comic results (#6439) --- gallery_dl/extractor/webtoons.py | 7 ++++++- test/results/webtoons.py | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/webtoons.py b/gallery_dl/extractor/webtoons.py index 949c7cb7..70ab259d 100644 --- a/gallery_dl/extractor/webtoons.py +++ b/gallery_dl/extractor/webtoons.py @@ -155,7 +155,10 @@ class WebtoonsComicExtractor(WebtoonsBase, Extractor): def items(self): page = None - data = {"_extractor": WebtoonsEpisodeExtractor} + data = { + "_extractor": WebtoonsEpisodeExtractor, + "title_no" : text.parse_int(self.title_no), + } while True: path = "/{}/list?title_no={}&page={}".format( @@ -173,6 +176,8 @@ class WebtoonsComicExtractor(WebtoonsBase, Extractor): data["page"] = self.page_no for url in self.get_episode_urls(page): + params = text.parse_query(url.rpartition("?")[2]) + data["episode_no"] = text.parse_int(params.get("episode_no")) yield Message.Queue, url, data self.page_no += 1 diff --git a/test/results/webtoons.py b/test/results/webtoons.py index 36958716..4574fd48 100644 --- a/test/results/webtoons.py +++ b/test/results/webtoons.py @@ -99,15 +99,23 @@ __tests__ = ( "#class" : webtoons.WebtoonsComicExtractor, "#pattern" : webtoons.WebtoonsEpisodeExtractor.pattern, "#range" : "1-15", - "#count" : ">= 15", + "#count" : ">= 14", + + "page" : range(1, 2), + "title_no" : 919, + "episode_no": range(1, 14), }, { - "#url" : "https://www.webtoons.com/fr/romance/subzero/list?title_no=1845&page=3", + "#url" : "https://www.webtoons.com/fr/romance/subzero/list?title_no=1845&page=7", "#comment" : "french", "#category": ("", "webtoons", "comic"), "#class" : webtoons.WebtoonsComicExtractor, "#count" : ">= 15", + + "page" : range(7, 25), + "title_no" : 1845, + "episode_no": int, }, { @@ -116,6 +124,10 @@ __tests__ = ( "#category": ("", "webtoons", "comic"), "#class" : webtoons.WebtoonsComicExtractor, "#count" : ">= 18", + + "page" : int, + "title_no" : 210827, + "episode_no": int, }, {