Simple program to download and replace Discord CDN weblinks from the output of Discord Archiver with hard, on drive path links to maintain media access after the CDN links expire. Has additional functionality for downloading gifs from Tenor
Project description
Meant to be used in conjunction with Discord Archiver
A simple script and command line tool to archive the Discord media from Discord CDN links in archived chats, along with options for archiving Tenor gifs in the chat, or replacing the embed Tenor view links with direct media links to make the chat look nicer.
All media sent through Discord uses Discord's CDN (Content Distribution Network) links, which have a built in expiry of around 24 hours when not used in the Discord app or website. Thus, any links archived will be inaccessible after that time period, meaning that your archived chats will lose all their media after 24 hours.
This script downloads and replaces all the CDN media links in the archive HTML file with a path to a locally saved version of the media, meaning even after the links expire you can still scroll through the chats and see all the photos, voice messages, and videos in all their glory.
Please run this tool either immediately after downloading the archive via Discord Archiver, or within approximately 24 hours so that media can be saved without the links expiring.
Installation
Install from pip with the following command
pip install discord-archiver-media-archiver
Can also be run as a python script via
python3 media_archiver.py "archive name"
Usage
usage: cdn_archiver.py [-h] [-g] [-ndc] [-gl] archive
positional arguments:
archive the Discord archive in the current working directory to archive media from
options:
-h, --help show this help message and exit
-g, --gifs enable the download and archival of gifs from Tenor or GIPHY while archiving
-ndc, --no-discord-cdn
disable downloads from the Discord CDN servers (useful for if the CDN links are already expired or downloaded and you just want to archive gifs)
-gl, --gif-links replace the gif embed links in the archive with the direct media links from Tenor (does not archive any media, overrides -g)
Examples
da-ma "archive_(350) Discord_2026-07-16.html"
Downloads all Discord CDN media in the archive file "archive_(350) Discord_2026-07-16.html", but not gifs.
da-ma "archive_(350) Discord_2026-07-16.html" -g
Downloads all Discord CDN media in the archive file "archive_(350) Discord_2026-07-16.html" including gifs.
da-ma "archive_(350) Discord_2026-07-16.html" -gl
Downloads all Discord CDN media in the archive file "archive_(350) Discord_2026-07-16.html" and replaces all Tenor gifs with their direct media link, but does not download them.
da-ma "archive_(350) Discord_2026-07-16.html" -g -ndc
Downloads only the Tenor gifs from the archive file "archive_(350) Discord_2026-07-16.html".
Python API
Since this was written in Python, you can also import the package media_archiver in order to use the underlying methods behind the CLI tool in your Python scripts and programs.
The core methods are:
archive_media(archive_name: str, do_cdn = True, do_gifs = False, do_gif_links = False)
fetch_tenor_media_link(tenor_view_link : str)
# Convert from a Tenor view link to a Tenor direct media link
class CDN_Media(media_link: str, save_location: Path, fetch = True)
# Downloads media from media_link upon creation unless fetch is set to false, so be careful.
# Despite the name, does still work on gifs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discord_archiver_media_archiver-1.0.1.tar.gz.
File metadata
- Download URL: discord_archiver_media_archiver-1.0.1.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aecc2f5023530128b8ba03f5749e0881f86cfb54b2cdf6b93b240e26c0569914
|
|
| MD5 |
50f1fca24ebaaff85d6dceec66ac8c01
|
|
| BLAKE2b-256 |
9e1f0dc9b650a49fdb67044c0ea26f423e55c5abfefeccb1010a9d21dacbf406
|
File details
Details for the file discord_archiver_media_archiver-1.0.1-py3-none-any.whl.
File metadata
- Download URL: discord_archiver_media_archiver-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ca5e5bb9cbb387e1fcf1fa411a4fd31619c64822e755e43657552633440ca68
|
|
| MD5 |
8b91485d6cc61d9e98043a8e7609bf39
|
|
| BLAKE2b-256 |
f230dafc1d842afca1459561d3390ce49cdb93cb843becbc08ae5f4daf4674ab
|