https://github.com/raleighlittles/snapchat-chats-and-location-analyzer
A Python script for parsing your chat history and visualizing your location history on Snapchat
https://github.com/raleighlittles/snapchat-chats-and-location-analyzer
folium gpx gpx-creator snapchat snapchat-download-my-data
Last synced: 3 days ago
JSON representation
A Python script for parsing your chat history and visualizing your location history on Snapchat
- Host: GitHub
- URL: https://github.com/raleighlittles/snapchat-chats-and-location-analyzer
- Owner: raleighlittles
- Created: 2022-02-19T22:48:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-21T19:10:19.000Z (4 months ago)
- Last Synced: 2025-06-21T20:20:52.368Z (4 months ago)
- Topics: folium, gpx, gpx-creator, snapchat, snapchat-download-my-data
- Language: Python
- Homepage:
- Size: 5.07 MB
- Stars: 19
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README

# About
This is a simple tool for analyzing/parsing data from your Snapchat backup. To start, you'll need to download your saved Snapchat data:
https://support.snapchat.com/en-US/a/download-my-data
Currently, there's two main functionalities offered by this program.
## Chat parsing
Snapchat stores your entire chat history in one file, `chat_history.json`. By using `snapchat_chat_parser.py`, you'll convert that file into a set of per-user json files, e.g. if your entire chat history contains messages between Alice, Bob, and Cody, running that script will produce the following files:
* messages-with-alice.json
* messages-with-bob.json
* messages-with-cody.jsonUsage:
```
usage: snapchat_chat_parser.py [-h] -i INPUT_CHAT_HISTORY_JSON -y YEAR -o OUTPUT_DIRoptions:
-h, --help show this help message and exit
-i INPUT_CHAT_HISTORY_JSON, --input-chat-history-json INPUT_CHAT_HISTORY_JSON
The path to the `chat_history.json` file
-y YEAR, --year YEAR The year the snapchat dump was taken. Needed to determine format.
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
The output directory to put the JSON files
```## Map generation
Snapchat stores your whole location history in a timestamped format, e.g. a timestamp and coordinate (latitude/longitude) pair; this file is called `location_history.json` in the exported data.
### Generating Folium interactive map from location history
`snapchat_location_history_analyzer.py` simply creates an interactive [Folium](http://python-visualization.github.io/folium/) map out of this data.
To use, run:
```bash
$ python3 snapchat_location_history_analyzer.py --input-file=location_history.json --output-file=
```And then open the `map.html` that is created.
You'll see something that looks like this:

## Generating GPX file from location history
`snapchat_generate_gpx_from_location_history.py` generates a [GPX](https://en.wikipedia.org/wiki/GPS_Exchange_Format) file of your location history, out of "waypoints". This allows you to use your own tools to visualize your location history.
To use, first install [lxml](https://lxml.de/), then run:
```bash
$ python3 snapchat_generate_gpx_from_location_history.py --input-file=location_history.json --output_file=
```Here's an example of what the resulting file looks like:
```
https://github.com/raleighlittles/Snapchat-Chats-And-Location-Analyzer
Measurement 0 of 13262
```Loading this into the GPX viewer of your choice:

For troubleshooting, I included the actual GPX [XSD](https://en.wikipedia.org/wiki/XML_Schema_(W3C)) that you can use to verify the generated GPX.
```bash
$ xmllint --schema gpx.xsd --noout
```