aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-04-23 07:38:30 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:12:34 +0200
commit930bbe78546adb464cc5a4be274b04497f1fb1fb (patch)
tree94a4f026babc11b9452128de0663737463d1f685
parent16f257a85a40a8da50cef1fa6ffce4e2da6da8b8 (diff)
Remove duplicate chapter numbers when there are multiple translators
-rwxr-xr-xplugins/mangadex.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/mangadex.py b/plugins/mangadex.py
index be0e2ce..238a264 100755
--- a/plugins/mangadex.py
+++ b/plugins/mangadex.py
@@ -75,6 +75,7 @@ def list_chapters(url, chapter_list_input):
tree = etree.HTML(response.text)
chapters = []
+ prev_chapter_number = None
for element in tree.xpath("//div[@data-manga-id='%s']" % manga_id):
chapter_lang = element.attrib.get("data-lang")
if chapter_lang != lang:
@@ -83,6 +84,9 @@ def list_chapters(url, chapter_list_input):
chapter_url = "https://mangadex.org/chapter/%s" % chapter_id
chapter_title = element.attrib.get("data-title") # optional
chapter_number = element.attrib.get("data-chapter")
+ if prev_chapter_number and chapter_number == prev_chapter_number:
+ continue
+ prev_chapter_number = chapter_number
chapter_name = "Ch. %s" % chapter_number
if chapter_title:
chapter_name += " - %s" % chapter_title