diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-06-26 00:44:42 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:12:34 +0200 |
commit | 3278cb33df34bd6a1be6818aea1f078aa4a0ac1c (patch) | |
tree | 74535e7ea905152e9c14ea40ea627ae71dd1663f /plugins | |
parent | 5344fd1bb3d8fbb835edd6dd6d6fdeeef3884331 (diff) |
Check for error when parsing rss
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/manganelo.py | 5 | ||||
-rwxr-xr-x | plugins/readms.py | 5 |
2 files changed, 6 insertions, 4 deletions
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): |