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

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

discord_archiver_media_archiver-1.0.0.tar.gz (10.5 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.0.tar.gz.

File metadata

  • Download URL: discord_archiver_media_archiver-1.0.0.tar.gz
  • Upload date:
  • Size: 10.5 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.0.tar.gz
Algorithm Hash digest
SHA256 8440356f60a72b24c5ffb4a5eaf607ad610cef2bdcf39aa5c596de15f74e81e3
MD5 669f40b8cb3f9517b06b03ac39be4124
BLAKE2b-256 581da4fcee56b0ab934b87b9a5b985ff87e056d754697d1540e67986b283ffa2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: discord_archiver_media_archiver-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8913fe8c4cb3d0227ac09ca781ff13169a037d39a5de9e2f30b283e79ca94f00
MD5 790141a977b7c94a8eaf2cd2acaa0268
BLAKE2b-256 4545660076aa76b4e5c0ca0fdd14e0aed6baee0b8a9897f454813639824d2f59

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