Repository: ToTheMax/Snapchat-All-Memories-Downloader
Title: BUG: Duplicate timestamps silently drop files (122k→69k, 347→297)
text
Bug Description
Expected: All parsed JSON entries → matching files
Actual:
- Main export: 122,188 parsed → 69,228 files (43% loss)
- Test case: 347 entries → 297 files (14% loss)
Fresh empty folder + --no-skip-existing still produces fewer files.
Latest run:
Downloaded: 297 (X.X MB @ Y.YY MB/s) | Skipped: 0 | Failed: 0
text
Folder count: 297 files (50 entries vanished).
Root Cause Analysis
Filename collision - second-precision only:
@Property
def filename(self) -> str:
return self.date.strftime("%Y-%m-%d_%H-%M-%S") # No milliseconds!
text
Snapchat behavior: Rapid clips (stories, bursts) share identical timestamps:
Clip 1: "2025-06-01 14:32:10 UTC" → 2025-06-01_14-32-10.mp4 ✓
Clip 2: "2025-06-01 14:32:10 UTC" → sees file → DROPPED silently
text
Even --no-skip-existing fails - first clip overwrites prior run.
Reproduction Steps
- Export Snapchat data →
html/memories_history.html (or JSON)
- Delete output folder completely
python main.py input.json -o ./test --no-skip-existing
dir /s /b ./test\*.* | find /c /v "" → < parsed count
Tested: 347→297, 122188→69228 consistently.
SUSPECTED Fix (Untested)
Add timestamp counter in download_all() ~line 128:
name_counts = {}
for memory in memories:
count = name_counts.get(memory.filename, 0)
name_counts[memory.filename] = count + 1
unique_name = f"{memory.filename}_{count}" if count else memory.filename
memory._unique_name = unique_name # Temp attr for download_memory()
text
jpg_path = output_dir / f"{unique_name}.jpg"
mp4_path = output_dir / f"{unique_name}.mp4"
... rest unchanged
text
In download_memory() ~line 90:
name = getattr(memory, '_unique_name', memory.filename)
output_path = output_dir / f"{name}{ext}"
text
Expected result: 2025-06-01_14-32-10.mp4, _1.mp4, _2.mp4 → 347 files.
Request
- Confirm bug - does maintainer see same 347→297 loss?
- Validate fix - test above patch on sample data
- Better solution - use
Date milliseconds if available in JSON? [web:38]
Environment
- Windows 11, Python 3.12+
- Multiple fresh exports tested
- Both HTML/JSON formats affected [memory:21]
Repository: ToTheMax/Snapchat-All-Memories-Downloader
Title: BUG: Duplicate timestamps silently drop files (122k→69k, 347→297)
text
Bug Description
Expected: All parsed JSON entries → matching files
Actual:
Fresh empty folder +
--no-skip-existingstill produces fewer files.Latest run:
Downloaded: 297 (X.X MB @ Y.YY MB/s) | Skipped: 0 | Failed: 0
text
Folder count: 297 files (50 entries vanished).
Root Cause Analysis
Filename collision - second-precision only:
@Property
def filename(self) -> str:
return self.date.strftime("%Y-%m-%d_%H-%M-%S") # No milliseconds!
text
Snapchat behavior: Rapid clips (stories, bursts) share identical timestamps:
Clip 1: "2025-06-01 14:32:10 UTC" → 2025-06-01_14-32-10.mp4 ✓
Clip 2: "2025-06-01 14:32:10 UTC" → sees file → DROPPED silently
text
Even
--no-skip-existingfails - first clip overwrites prior run.Reproduction Steps
html/memories_history.html(or JSON)python main.py input.json -o ./test --no-skip-existingdir /s /b ./test\*.* | find /c /v ""→ < parsed countTested: 347→297, 122188→69228 consistently.
SUSPECTED Fix (Untested)
Add timestamp counter in
download_all()~line 128:name_counts = {}
for memory in memories:
count = name_counts.get(memory.filename, 0)
name_counts[memory.filename] = count + 1
unique_name = f"{memory.filename}_{count}" if count else memory.filename
memory._unique_name = unique_name # Temp attr for download_memory()
text
jpg_path = output_dir / f"{unique_name}.jpg"
mp4_path = output_dir / f"{unique_name}.mp4"
... rest unchanged
text
In
download_memory()~line 90:name = getattr(memory, '_unique_name', memory.filename)
output_path = output_dir / f"{name}{ext}"
text
Expected result:
2025-06-01_14-32-10.mp4,_1.mp4,_2.mp4→ 347 files.Request
Datemilliseconds if available in JSON? [web:38]Environment