aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-06-26 00:44:42 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:12:34 +0200
commit3278cb33df34bd6a1be6818aea1f078aa4a0ac1c (patch)
tree74535e7ea905152e9c14ea40ea627ae71dd1663f /plugins
parent5344fd1bb3d8fbb835edd6dd6d6fdeeef3884331 (diff)
Check for error when parsing rss
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/manganelo.py5
-rwxr-xr-xplugins/readms.py5
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):