Skip to content

Bulk asynchronous downloader for multiple file hosts

Better dupe checking

Jules-WinnfieldX664bd5289ff3
diff --git a/.gitignore b/.gitignore
index 6e9024252..5da5652dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@ Downloads/
__pycache__/
*.egg-info/
build/
-release/
\ No newline at end of file
+release/
+start_dev.py
\ No newline at end of file
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index fc92f01ee..82833272a 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "2.14.3"
+__version__ = "2.14.5"
diff --git a/cyberdrop_dl/utils/base_functions.py b/cyberdrop_dl/utils/base_functions.py
index b92192526..16e60a0e1 100644
--- a/cyberdrop_dl/utils/base_functions.py
+++ b/cyberdrop_dl/utils/base_functions.py
@@ -40,8 +40,7 @@ mapping_Pixeldrain = ["pixeldrain.com"]
mapping_Thotsbay = ["thotsbay.com"]
mapping_Anonfiles = ["anonfiles.com"]
-user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 ' \
- 'Safari/537.36'
+user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36'
ssl_context = ssl.create_default_context(cafile=certifi.where())
MAX_FILENAME_LENGTH = 100
@@ -81,10 +80,12 @@ async def sql_check_existing(cursor: sqlite3.Cursor, filename, size):
async def sql_insert_file(connection: sqlite3.Connection, cursor: sqlite3.Cursor, filename, size, completed):
cursor.execute("""INSERT OR IGNORE INTO downloads VALUES ('%s', %d, %d)""" % (filename, size, completed))
+ connection.commit()
async def sql_update_file(connection: sqlite3.Connection, cursor: sqlite3.Cursor, filename, size, completed):
cursor.execute("""INSERT OR REPLACE INTO downloads VALUES ('%s', %d, %d)""" % (filename, size, completed))
+ connection.commit()
def log(text, style=Fore.WHITE) -> None:
diff --git a/cyberdrop_dl/utils/data_classes.py b/cyberdrop_dl/utils/data_classes.py
index f7764502e..5a493efd0 100644
--- a/cyberdrop_dl/utils/data_classes.py
+++ b/cyberdrop_dl/utils/data_classes.py
@@ -90,4 +90,13 @@ class CascadeItem:
def dedupe(self):
for domain_str, domain in self.domains.items():
for album_str, album in domain.albums.items():
- album.link_pairs = unique_list(album.link_pairs)
+ check = []
+ allowed = []
+ for pair in album.link_pairs:
+ url, referrer = pair
+ if url in check:
+ continue
+ else:
+ check.append(url)
+ allowed.append(pair)
+ album.link_pairs = allowed
diff --git a/cyberdrop_dl/utils/downloaders.py b/cyberdrop_dl/utils/downloaders.py
index 88154eb60..2356c1654 100644
--- a/cyberdrop_dl/utils/downloaders.py
+++ b/cyberdrop_dl/utils/downloaders.py
@@ -209,6 +209,7 @@ class Downloader:
complete_file = (self.folder / self.title / filename)
if complete_file.exists():
await sql_update_file(self.connection, self.cursor, filename, complete_file.stat().st_size, 1)
+
logger.debug(str(complete_file) + " Already Exists")
else:
logger.debug("Working on " + str(url))