Skip to content

Bulk asynchronous downloader for multiple file hosts

Change path (title) to match download folder, fix references to updated globals

Julesa760ec2e089e
diff --git a/main.py b/main.py
index 3c979fddb..a73cd30e1 100644
--- a/main.py
+++ b/main.py
@@ -34,6 +34,7 @@ FILE_FORMATS = {
CPU_COUNT = settings.threads if settings.threads != 0 else multiprocessing.cpu_count()
DOWNLOAD_FOLDER = settings.download_folder
+
def log(text, style):
# Log function for printing to command line
print(style + str(text) + Style.RESET_ALL)
@@ -90,7 +91,7 @@ async def main():
scrapper = get_scrapper(url)
with scrapper:
- title = sanitize_filename(scrapper.get_soup().select_one('title').text)
+ title = DOWNLOAD_FOLDER + sanitize_filename(scrapper.get_soup().select_one('title').text)
links = scrapper.result_links()
if not links:
@@ -98,7 +99,7 @@ async def main():
raise ValueError('No links found, check the URL.')
downloaders = get_downloaders(links, folder=Path(
- title), max_workers=cpu_count)
+ title), max_workers=CPU_COUNT)
for downloader in downloaders:
await downloader.download_content()