The downloader is this good boy 🐕
Self-hosted solution to download video sent to Telegram 🤖 (obv in 🦀, lol)
mediaDownloader can be used to download and deliver media from a selection of sources.
Sometimes on TikTok (I know 😫) there's some proper quality content that I need to immediately deliver to somebody, this takes care of this in a pretty straightforward way.
There are 3 main binaries:
media_downloader
, responsible for downloading the media from the sourcebot
, responsible for receiving the request and delivering the media to the usercleaner
, responsible for cleaning up the downloaded media after a certain amount of time (externally managed)
The container expects to load the configuration file from /mediaDownloader/config.toml
so mount a volume accordingly.
$ docker run -itd \
--rm \
-v /path/to/my/configuration/file:/config/file \
tatoalo/media-downloader
version: "3.8"
services:
mediadownloader:
image: tatoalo/media-downloader:development
container_name: mediadownloader
restart: unless-stopped
volumes:
- /path/to/my/configuration/file:/config/file
The configuration file allows to have control over multiple aspects of the downloader.
[telegram]
token = "token"
[redis]
username = "username"
password = "password"
host = "host"
port = 6942
channel = "channel"
[supported_sites]
sites = [
"site1.com",
"site2.com",
]
[telemetry]
endpoint = "endpoint"
api_key = "api_key"
[aweme_api]
[...]
The only parameter required is the token
of the bot you want to use, for more information refer to the official documentation.
The downloader uses redis
as a message broker and to store the video ID
in order to save processing/delivery times and bandwidth.
The required parameters are:
username
password
host
port
channel
The downloader uses a supported_sites
whitelist to determine admissable sources.
TikTok support 😉
The downloader can be instrumented to send traces via OpenTelemetry to a remote endpoint.
The default scheduling mechanism is stored in media-downloader-cron
, although a custom schedule can be introduced in one of two ways:
- Edit
media-downloader-cron
accordingly and rebuild the image - Edit the environment variables directly in the
docker run
command ordocker compose
file, namely. It is possible to customize the behaviour via the following env variable:CLEANER_CRON
for when the cleaning mechanism is executed
An additional environment variable can be set in order to monitor the health of the cleaner
cron job:
HC_UUID_CLEANER
Its value must be an healthchecks
-compatible uuid
(or slug
).
I've been a fan of cronitor but healtchecks's free offering is more convenient in my opinion.
Copyright 2024 Alessandro Pogliaghi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.