Skip to content

Bulk asynchronous downloader for multiple file hosts

Add functinality for include_id_in_download_folder_name setting.

Jules-WinnfieldX13cabf35c16d
diff --git a/settings.py b/settings.py
index 03bd80439..318fe5287 100644
--- a/settings.py
+++ b/settings.py
@@ -3,7 +3,7 @@
# threads = 0 - (Will run all threads), **this is not the same as cores.**
# download_folder = "./Downloads/" - will download in the CyberDropDownloader folder
# download_attempts = 10 - will try and download each file 10 times before giving up.
-# include_id_in_download_folder_name = False - setting this to true will all the ID to download folder names.
+# include_id_in_download_folder_name = False - setting this to true will add the ID to download folder names.
threads = 0
download_folder = "./Downloads/"
diff --git a/utils/scrapers.py b/utils/scrapers.py
index 142d98356..fd7923c7c 100644
--- a/utils/scrapers.py
+++ b/utils/scrapers.py
@@ -16,6 +16,9 @@ import re
import settings
+title_setting = settings.include_id_in_download_folder_name
+
+
FILE_FORMATS = {
'Images': {
'.jpg', '.jpeg', '.png', '.gif',
@@ -58,6 +61,10 @@ class ShareX_Spider(Spider):
try:
title = response.css('div[class=header] h1 strong::text').get()
title = title.replace(r"\n", "").strip()
+ if title_setting:
+ titlep2 = response.url.split('/')
+ titlep2 = [s for s in titlep2 if "." in s][-1]
+ title = title + " - " + titlep2
except Exception as e:
title = response.url.split('/')
title = [s for s in title if "." in s][-1]
@@ -74,6 +81,10 @@ class ShareX_Spider(Spider):
try:
title = response.css('a[data-text=album-name]::text').get()
title = title.replace(r"\n", "").strip()
+ if title_setting:
+ titlep2 = response.url.split('/')
+ titlep2 = [s for s in titlep2 if "." in s][-1]
+ title = title + " - " + titlep2
except Exception as e:
title = response.url.split('/')
title = [s for s in title if "." in s][-1]
@@ -132,6 +143,8 @@ class ChibisafeSpider(Spider):
try:
title = response.css('h1[id=title]::text').get()
title = title.replace(r"\n", "").strip()
+ if title_setting:
+ title = title + " - " + response.url.split('/')[-1]
except Exception as e:
title = response.url.split('/')[-1]
for link in links:
@@ -164,6 +177,8 @@ class GoFileSpider(Spider):
try:
title = self.driver.find_element(By.ID, 'rowFolder-folderName').text
+ if title_setting:
+ title = title + " - " + response.url.split('/')[-1]
except Exception as e:
title = response.url.split('/')[-1]