Last active
October 24, 2022 16:35
-
-
Save napcae/bb74c2dab54b8e15babc3952e7ffbd07 to your computer and use it in GitHub Desktop.
Download Media from Snapchat Backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give your files a creation date so Photos on macOS sorts them correctly | |
find -f $FILE | xargs -I {} exiftool -CreateDate={} -MediaCreateDate={} {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### | |
# Snapchat exporter | |
# | |
# You to download your memories from Snapchat with this neat little importer. | |
# All you need to do is go to https://accounts.snapchat.com/accounts/downloadmydata and request your data | |
# You will receive an email with your zipped data, copy inside json/memories_history.json to this dir | |
MEMORIES_FILE="./memories_history.json" | |
API_ENDPOINT="https://app.snapchat.com/dmd/memories" | |
NumberOfMemories=$(jq '.[] | length' "$MEMORIES_FILE") | |
for (( c=0; c<"$NumberOfMemories"; c++)) | |
do | |
echo $c | |
# get date for sorting downloaded files | |
DATE=$(jq -r '.[] | .['"$c"'].Date' "$MEMORIES_FILE" | sed 's/ /_/g') | |
# get full download url from memories file | |
POST_DATA=$(jq '.[] | .['"$c"']."Download Link"' "$MEMORIES_FILE" | gsed 's/.*?//' | gsed 's/"//' ) | |
# create download link out of post data | |
DOWNLOAD_LINK=$(curl -s -d "$POST_DATA" "$API_ENDPOINT") | |
FILENAME=$(echo $DOWNLOAD_LINK | grep -Eo "(\w+-\w+-\w+-\w+-\w+)\.(\w{3})") | |
echo "DOWNLOADING: " | |
echo $DOWNLOAD_LINK | |
echo "TO: " | |
echo "$DATE"-"$FILENAME" | |
#curl -s "$DOWNLOAD_LINK" > data/"$DATE"-"$FILENAME" | |
wget -nc -O data/"$DATE"-"$FILENAME" "$DOWNLOAD_LINK" | |
done | |
#➤ find -f * | xargs -I {} exiftool -CreateDate={} {} |
Okay but like I have literally no idea what I am doing? Could you decide this for me and show me what it is before I go insane???
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[]({"Saved Media": [{"Date": "2021-09-03 00:58:24 UTC", "Media Type": "PHOTO", "Download Link": "https://app.snapchat.com/dmd/memories?uid=1e7fc466-65a4-48ff-9355-d73ebc66f165&sid=C2465C3B-498D-40A2-9E7B-C8183F2A79FE&mid=C2465C3B-498D-40A2-9E7B-C8183F2A79FE&ts=1631021805467&proxy=true&sig=e659646adbce7f9994ea7bce15c6aa0ba482ba02a398233ed1c08c45f644294b"})