An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

![snapchat-logo](./docs/snapchat-logo.jpeg)

# 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.json

Usage:

```
usage: snapchat_chat_parser.py [-h] -i INPUT_CHAT_HISTORY_JSON -y YEAR -o OUTPUT_DIR

options:
-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:

![folium map screenshot](./docs/snapchat-map-screenshot.png)

## 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:

![gpx studio screenshot](./docs/gpx_viewer_screenshot.png)

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
```