From 3278cb33df34bd6a1be6818aea1f078aa4a0ac1c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 26 Jun 2019 00:44:42 +0200 Subject: Check for error when parsing rss --- plugins/manganelo.py | 5 +++-- plugins/readms.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/manganelo.py b/plugins/manganelo.py index 25114fa..a37dfa7 100755 --- a/plugins/manganelo.py +++ b/plugins/manganelo.py @@ -51,9 +51,10 @@ def list_chapters(url, latest): tree = etree.HTML(response.text) chapters = [] for element in tree.xpath('//div[@class="chapter-list"]//a'): - if latest and element.text == latest: + element_text = element.text.strip() + if latest and element_text == latest: break - chapters.append({ "name": element.text.strip(), "url": element.attrib.get("href").strip() }) + chapters.append({ "name": element_text, "url": element.attrib.get("href").strip() }) print(json.dumps({ "items": chapters })) def download_chapter(url, download_dir): diff --git a/plugins/readms.py b/plugins/readms.py index 878a043..2a87b14 100755 --- a/plugins/readms.py +++ b/plugins/readms.py @@ -51,9 +51,10 @@ def list_chapters(url, latest): tree = etree.HTML(response.text) chapters = [] for element in tree.xpath('//table//tr//a'): - if latest and element.text == latest: + element_text = element.text.strip() + if latest and element_text == latest: break - chapters.append({ "name": element.text.strip(), "url": "https://readms.net" + element.attrib.get("href").strip() }) + chapters.append({ "name": element_text, "url": "https://readms.net" + element.attrib.get("href").strip() }) print(json.dumps({ "items": chapters })) def download_chapter(url, download_dir): -- cgit v1.2.3