ToTheMax / Snapchat-All-Memories-Downloader

Script to download all your Snapchat memories
358 stars 72 forks source link

Script overwrites memories that already exist if photo/video is saved at the exact same timestamp #8

Closed jvillarruz closed 4 years ago

jvillarruz commented 4 years ago

Hey there, noticed a glaring issue with the code after running it with my own snapchat data.

If two (or more) files have the same timestamp, example:

2016-11-26 12:46:18 UTC | PHOTO | download 2016-11-26 12:46:18 UTC | PHOTO | download 2016-11-26 12:46:18 UTC | VIDEO | download 2016-11-26 12:46:18 UTC | VIDEO | download 2016-11-26 12:46:18 UTC | VIDEO | download 2016-11-26 12:46:18 UTC | VIDEO | download

then I've noticed this script only saves the most recent one of all, because it does not take into account the fact that some photos/videos have the same timestamps (i.e., memories uploaded at exact same second, for whatever reason due to snapchat servers being that way).

Thus even after downloading with the script and seeing:

CDN-LINKS: [====================] 1586/1586 Failed: 0 DOWNLOADS: [====================] 1586/1586 Failed: 0

My final Downloads folder output only contains 1,263 items due to the script overwriting stuff with the same timestamps, though the videos/photos at these exact same timestamps are actually different.

Glad that I got 1263/1586 of my memories, but not gonna figure out which exact 323 items I didn't get to download, lol.

(Can confirm 1586 items exist btw, as simple as using ctrl+f on the .html page and summing up amount of "PHOTO" and "VIDEO" references on the memories_history.html)

Code needs an exception handler for "if file (name) exists....", then instead of overwriting, save the file as "datetime(1)", "datetime(2)", "datetime(3)".... and so on.

Will reuse the script again if you can fix this, thanks lol.

ToTheMax commented 4 years ago

Ah good find! Kind of wondering how you manage to take/save multiple pictures at the same exact second? I'll have a look at it tonight, should be an easy fix!

ToTheMax commented 4 years ago

Fixed! https://github.com/ToTheMax/Snapchat-All-Memories-Downloader/commit/7108846391fb92df919d79789514faedb4461098

jvillarruz commented 4 years ago

Re-ran the script, works perfectly and got all my memories; thanks for the fix, code should be basically foolproof now!

And about taking/saving pics at the same second, either has something to do with a setting of uploading memories to servers all at once when connected to Wi-Fi instead of LTE (thus registering as all taken at the same timestamp), or something weird with my old phone (guessing its not snapchat server-side, since no one else has pointed out this issue?)

Thanks again for the extremely useful code!

ToTheMax commented 4 years ago

Awesome!

I ran the script myself and saw some duplicates on my own memories as well, thanks for mentioning!