diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-06-07 05:07:01 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:12:34 +0200 |
commit | 593c3d68dc4247f5bc56186cfb7215f1dc6d7ead (patch) | |
tree | 9b46349df7db15208caed270510cad8b1fc862ae | |
parent | 2f74400e6b4e29da7e5ebc700d9568bf179337ad (diff) |
mangatown: use correct chapter names
-rwxr-xr-x | plugins/mangatown.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/mangatown.py b/plugins/mangatown.py index 2d566e3..2ee739b 100755 --- a/plugins/mangatown.py +++ b/plugins/mangatown.py @@ -65,13 +65,21 @@ def list_chapters(url, chapter_list_input): seen_urls.add(url) tree = etree.HTML(response.text) - chapters = [] + items = [] for element in tree.xpath('//ul[@class="chapter_list"]//a'): element_text = element.text.strip() url = element.attrib.get("href").strip() if "/manga/" not in url: continue url = "https://www.mangatown.com" + url + items.append((element_text, url)) + + chapter_num = len(items) + chapters = [] + for item in items: + element_text = "Ch. " + str(chapter_num) + chapter_num -= 1 + url = item[1] if element_text.lower().replace(" ", "") in seen_titles or url in seen_urls: break chapters.append({ "name": element_text, "url": url }) |