This Python script automates the downloading of Snapchat Memories from a locally saved HTML file. It simulates clicking on <a>
tags within the HTML file to download all media files listed.
To use this script, you must first request your Snapchat Memories data from Snapchat's official website. This data will include the memories_history.html
file needed for the script to work.
You will need:
- Python 3.x installed on your computer.
- Google Chrome installed on your computer.
- ChromeDriver compatible with your Chrome version.
-
Log in to Snapchat's Account Portal:
- Open your browser and go to https://accounts.snapchat.com/v2/download-my-data.
- Log in with your Snapchat credentials.
-
Select Data Types:
- Scroll down and ensure the checkbox that is selected is for "Memories and Other Media" .
-
Request Data:
- Follow the next steps on the page (e.g. selecting date range, confirming email etc.), until you can click the Submit Request/Export button. Snapchat will notify you that your request is being processed.
-
Wait for the Email:
- Snapchat will email you a link to download your data. This can take anywhere from minutes to several hours or even days, depending on the size of your data.
-
Download the Data:
- When you receive the email, click the link to download the ZIP file containing your data.
-
Extract the ZIP File:
- Extract the ZIP file. Inside, you'll find a folder named something like
mydata ~ [date]
.
- Extract the ZIP file. Inside, you'll find a folder named something like
-
Locate the HTML File:
- Navigate to the
html
folder within the extracted data. - Inside the
html
folder, find the file namedmemories_history.html
.
- Navigate to the
- Download and install Python from https://www.python.org/downloads/.
- During installation, check the box to "Add Python to PATH".
Open a terminal and run the following command:
pip install selenium
- Visit the ChromeDriver download page.
- Download the version of ChromeDriver that matches your version of Google Chrome.
- Extract the
chromedriver.exe
file and note its location.
-
Download the Script:
- Download the Python script provided in this repository, or copy it into a file on your computer named
snapchat-memories-download-script.py
.
- Download the Python script provided in this repository, or copy it into a file on your computer named
-
Prepare Your Paths:
- Locate the following:
- The Google Chrome executable (usually
C:\Program Files\Google\Chrome\Application\chrome.exe
). - The ChromeDriver executable (where you saved
chromedriver.exe
). - The
memories_history.html
file (inside thehtml
folder extracted from your Snapchat data).
- The Google Chrome executable (usually
- Locate the following:
-
Run the Script: Open a terminal and navigate to the folder where you saved the script. For example:
cd C:\Users\YourUsername\Documents
Run the script:
python snapchat-memories-download-script.py
-
Provide the Paths: The script will ask you for the following:
- The full path to your Google Chrome executable:
Enter the full path to your Chrome browser executable (e.g., C:\Program Files\Google\Chrome\Application\chrome.exe):
- The full path to your ChromeDriver executable:
Enter the full path to your ChromeDriver executable (e.g., C:\path\to\chromedriver.exe):
- The full path to your
memories_history.html
file:Enter the full path to the HTML file you want to open (e.g., C:\path\to\file.html):
- The full path to your Google Chrome executable:
-
Let the Script Run:
- The script will open Google Chrome, load the
memories_history.html
file, and begin clicking on the download links for all media files. - Do not close the browser or the terminal while the script is running.
- The downloads will continue until all links have been processed.
- The script will open Google Chrome, load the
Once the script has finished running:
- All downloaded media files will be in your browser’s default download folder (e.g.,
C:\Users\YourUsername\Downloads
on Windows).
-
Keep the Browser Open:
- Do not close Google Chrome or the terminal while the script is running, as this will interrupt the downloading process.
-
Large Data Sets:
- If you have a lot of media, the script might take a long time to process all links. Let it run until it completes.
-
Chrome Version Mismatch:
- If the script fails due to a mismatch between your Chrome version and ChromeDriver, download the correct version of ChromeDriver from here.
-
Headless Mode (Optional):
- If you don’t want the browser window to be visible, you can enable headless mode by modifying the script:
options.add_argument("--headless")
- If you don’t want the browser window to be visible, you can enable headless mode by modifying the script:
-
Errors:
- If the script encounters an error, check the terminal for the error message. Most issues are related to incorrect paths or missing dependencies.
By following these steps, you can automate the process of downloading all your Snapchat Memories from the HTML file provided by Snapchat. This script saves time and ensures that all media files are downloaded without manual effort.
If you encounter any issues, feel free to open an issue For Improvements, feel free to open an pull request