Fixed issue where file extenions not found and auth timeout

This commit is contained in:
2025-10-24 13:43:03 +13:00
parent 7580dc3f94
commit 6d9a078656
12 changed files with 1272 additions and 15 deletions
+4 -1
View File
@@ -149,7 +149,9 @@ class RedditDownloader(RedditConnector):
logger.error(f"Site {downloader_class.__name__} failed to download submission {submission.id}: {e}")
return
files_processed = 0
logger.debug(f"Processing {len(content)} resources for submission {submission.id}")
for destination, res in self.file_name_formatter.format_resource_paths(content, self.download_directory):
logger.debug(f"Resource URL: {res.url}, Extension: {res.extension}, Destination: {destination}")
if destination.exists():
# Check if we already have this file's hash
if destination in self.master_hash_list.values():
@@ -217,9 +219,10 @@ class RedditDownloader(RedditConnector):
# Only create folder if we're actually going to write the file (not a duplicate)
destination.parent.mkdir(parents=True, exist_ok=True)
try:
logger.debug(f"Writing {len(res.content)} bytes to {destination}")
with destination.open("wb") as file:
file.write(res.content)
logger.debug(f"Written file to {destination}")
logger.debug(f"Successfully written file to {destination}")
files_processed += 1
except OSError as e:
logger.exception(e)