Skip to content

Instantly share code, notes, and snippets.

@programminghoch10
Last active May 21, 2024 01:34
Show Gist options
  • Save programminghoch10/fa37e0da8b2efc5cb8077e59d000771d to your computer and use it in GitHub Desktop.
Save programminghoch10/fa37e0da8b2efc5cb8077e59d000771d to your computer and use it in GitHub Desktop.
Snapchat Data Extractor
#!/bin/bash
if [[ $(id -u) -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
if [ -z $(pm list packages | grep com.snapchat.android) ]; then
echo "Snapchat not found"
exit 1
fi
SDCARD=/storage/emulated/0
EXPORTDIR=$SDCARD/snapchat_exports
SNAPDATA=$(pm dump com.snapchat.android | grep dataDir= | head -n 1 | cut -d= -f2)
echo "Export folder: $EXPORTDIR"
echo "Snapchat data folder: $SNAPDATA"
rm -r $EXPORTDIR
mkdir -v $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/chat_snap $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/story_snap $EXPORTDIR
cp $SNAPDATA/files/file_manager/snap_first_frame/* $EXPORTDIR/story_snap
cp -r $SNAPDATA/files/file_manager/snap $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/posted_story_snap $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/memories_media $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/memories_thumbnail $EXPORTDIR
#cp -r $SNAPDATA/files/file_manager/memories_overlay $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/media_package_thumb $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/external_sticker $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/non_user_bitmoji $EXPORTDIR
for folder in $EXPORTDIR/*/;
do
for file in $folder*;
do
if (file "$file" | grep text);
then mv "$file" "$file.txt";
else
if (head -n 1 "$file" | grep mp4);
then mv "$file" "$file.mp4";
else
if (head -n 1 "$file" | grep JFIF);
then mv "$file" "$file.jfif"
else
if (head -n 1 "$file" | grep WEBP);
then mv "$file" "$file.webp"
else
if (head -n 1 "$file" | grep PNG);
then mv "$file" "$file.png"
fi
fi
fi
fi
fi
done
for file in "$folder*.txt"; do rm "$file"; done
done
exit 0
@knightoflongknives
Copy link

Loving your work on this. Curl: Inaccessible or fine not found.
What's the solution?

@jenluo20
Copy link

Hi,
I couldn't replicate files saved in the folder /data/data/com.snapchat.android/files/file_manager/snap no matter how I tried to send and receive snaps. I tried this on Snapchat version 12.56.0.57 on an Android 13.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment