mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Fix link template error and use indeterminate progress bar
This commit is contained in:
parent
db1219d4a9
commit
1525aa15a6
@ -634,14 +634,12 @@ class KitIliasCrawler(HttpCrawler):
|
|||||||
if not dl:
|
if not dl:
|
||||||
return
|
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")
|
export_url = element.url.replace("cmd=calldirectlink", "cmd=exportHTML")
|
||||||
async with self.session.get(export_url) as response:
|
async with self.session.get(export_url) as response:
|
||||||
html_page: BeautifulSoup = soupify(await response.read())
|
html_page: BeautifulSoup = soupify(await response.read())
|
||||||
real_url: str = html_page.select_one("a").get("href").strip()
|
real_url: str = html_page.select_one("a").get("href").strip()
|
||||||
|
|
||||||
bar.advance(1)
|
|
||||||
|
|
||||||
async with dl as sink:
|
async with dl as sink:
|
||||||
content = _link_template_plain if self._link_file_use_plaintext else _link_template_rich
|
content = _link_template_plain if self._link_file_use_plaintext else _link_template_rich
|
||||||
content = content.replace("{{link}}", real_url)
|
content = content.replace("{{link}}", real_url)
|
||||||
@ -649,7 +647,6 @@ class KitIliasCrawler(HttpCrawler):
|
|||||||
content = content.replace("{{description}}", str(element.description))
|
content = content.replace("{{description}}", str(element.description))
|
||||||
content = content.replace("{{redirect_delay}}", str(self._link_file_redirect_delay))
|
content = content.replace("{{redirect_delay}}", str(self._link_file_redirect_delay))
|
||||||
sink.file.write(content.encode("utf-8"))
|
sink.file.write(content.encode("utf-8"))
|
||||||
bar.advance(1)
|
|
||||||
sink.done()
|
sink.done()
|
||||||
|
|
||||||
@arepeat(3)
|
@arepeat(3)
|
||||||
@ -842,7 +839,7 @@ _link_template_rich = """
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>ILIAS - Link: {{ name}}</title>
|
<title>ILIAS - Link: {{name}}</title>
|
||||||
<meta http-equiv = "refresh" content = "{{redirect_delay}}; url = {{link}}" />
|
<meta http-equiv = "refresh" content = "{{redirect_delay}}; url = {{link}}" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user