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.4.tar.gz (10.8 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.4.tar.gz.

File metadata

  • Download URL: discord_archiver_media_archiver-1.0.4.tar.gz
  • Upload date:
  • Size: 10.8 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.4.tar.gz
Algorithm Hash digest
SHA256 a5477f24ebd5541d5ddeb3ed325c3dc4847d686fa522989725759392cd7d0fdd
MD5 e3aed7b89b671c25cf812ebc76431f8b
BLAKE2b-256 4c02980ec636c44210dcd72372641866dc9b2cdf623cfde01d95f20a0de5b04b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: discord_archiver_media_archiver-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 60849b1c89e27badbb61b48582b91b2c46d42439ea1efca1bf16e96cbc7a71f3
MD5 7c98a28b6a01f2584dd777a4953ebdff
BLAKE2b-256 0c854b84bffa27a602a69d3cdb9c7b0605db8dfa4cb9437d76769788aec35ef0

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