Skip to main content

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

discord_archiver_media_archiver-1.0.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file discord_archiver_media_archiver-1.0.2.tar.gz.

File metadata

  • Download URL: discord_archiver_media_archiver-1.0.2.tar.gz
  • Upload date:
  • Size: 15.0 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

Hashes for discord_archiver_media_archiver-1.0.2.tar.gz
Algorithm Hash digest
SHA256 38f69bd9548211a8baf9981cf763e71fbe85583de339100516f0ae1ee3f8128b
MD5 4a39f1e12ccb83ae9efa35820063f5d1
BLAKE2b-256 aea64995abaf6d22e2178681d7d98b38f5da4c5fbca1b6e6ea6d50cc874c3145

See more details on using hashes here.

File details

Details for the file discord_archiver_media_archiver-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: discord_archiver_media_archiver-1.0.2-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

Hashes for discord_archiver_media_archiver-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bcb9dce894e114ef4ec34875e7e3d54d4c1dfa27407dcaf3d825ff9e2f1a272e
MD5 e460b3386df7375cee0894ad3d8d6543
BLAKE2b-256 b98e0c4c95b51db3e00f503731f504eab39e845453b64e2ab58c99135b91d128

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page