From 1525aa15a6dd9f09d70af1e1f994ed03fb6cf5db Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Tue, 18 May 2021 22:40:28 +0200 Subject: [PATCH] Fix link template error and use indeterminate progress bar --- PFERD/crawlers/ilias.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/PFERD/crawlers/ilias.py b/PFERD/crawlers/ilias.py index 4d81976..014f231 100644 --- a/PFERD/crawlers/ilias.py +++ b/PFERD/crawlers/ilias.py @@ -634,14 +634,12 @@ class KitIliasCrawler(HttpCrawler): if not dl: return - async with self.download_bar(element_path, 2) as bar: + async with self.download_bar(element_path): export_url = element.url.replace("cmd=calldirectlink", "cmd=exportHTML") async with self.session.get(export_url) as response: html_page: BeautifulSoup = soupify(await response.read()) real_url: str = html_page.select_one("a").get("href").strip() - bar.advance(1) - async with dl as sink: content = _link_template_plain if self._link_file_use_plaintext else _link_template_rich content = content.replace("{{link}}", real_url) @@ -649,7 +647,6 @@ class KitIliasCrawler(HttpCrawler): content = content.replace("{{description}}", str(element.description)) content = content.replace("{{redirect_delay}}", str(self._link_file_redirect_delay)) sink.file.write(content.encode("utf-8")) - bar.advance(1) sink.done() @arepeat(3) @@ -842,7 +839,7 @@ _link_template_rich = """ - ILIAS - Link: {{ name}} + ILIAS - Link: {{name}}