What it is
Open-source engines that take a link to a media page and return a file with metadata: yt-dlp for video and audio from web pages, streamrip for music releases with full tags.
How we use it
The media bot takes a link and returns the file in the chat in the chosen quality, with FFmpeg compression and a cache. Heavy jobs run in a queue with a cap on parallel work.
What it is in plain words
yt-dlp and streamrip are open-source Python programs that turn a link to a media page into a file. yt-dlp works with video and audio pages on hundreds of sites and can return the stream in the chosen quality. streamrip specialises in music: it fetches releases from music services where the user has an account, as FLAC or another format, with tags and cover art. Both can run from the command line or as a library inside your own code.
Where it helps a business
- A Telegram bot or a service should take a link from a user and return a ready file in the chat, in the chosen quality.
- Your own clips, webinar recordings or lectures published on different platforms need to be collected into one archive.
- Media from many sources needs one processing chain: conversion, compression, tags, cover art, delivery.
How it works
- Extractors. yt-dlp has a separate module for each site that finds the media streams on a page. A new site often works without any code on your side.
- Formats and quality. The engine returns a list of available formats; the program picks one by resolution, codec or size, or lets the user choose.
- FFmpeg on the back end. Video and audio streams are often stored separately; yt-dlp joins them through FFmpeg and can convert audio to MP3 and embed a cover.
- Metadata. Title, author, duration and cover come with the file; for music, tags are written by libraries such as mutagen.
- As a library or a process. yt-dlp is called from Python directly; streamrip is often run as a child process with a config the program generates itself.
How we use it
- The media bot takes a link and returns the file in the same chat: quality choice with the size shown in advance, MP3 with cover art, compression or splitting through FFmpeg, files up to 2 GB through a local Bot API, and a cache for repeated links.
- ToshaMusic runs the engine as a child process with its own config, and a worker pool caps how many heavy jobs run at once. After that the file goes through a quality check: bit depth, sample rate and spectrum.
yt-dlp and streamrip
| yt-dlp | streamrip |
|---|
| Content | video and audio from web pages | music releases from music services |
| Sources | hundreds of sites through extractors | a few services, with the user's own account |
| Result | a video or audio file in the chosen quality | albums and tracks with full tags and cover art |
| Updates | very frequent, sites change often | less frequent |
Common mistakes
- An old engine version. Sites change their pages, and a version from a month ago may stop working. The engine is updated regularly, and when something fails, the update comes first.
- No queue. Heavy jobs started in parallel without limits overload the server and the source. A queue, a worker pool and per-user rate limits are needed from the start.
- Ignoring file limits. Telegram's cloud Bot API does not accept a file over 50 MB from a bot; you need compression, splitting or a local Bot API server.
- Dependency conflicts. Engines pull in their own versions of libraries; they are installed in a separate environment or container.
- Forgetting about rights. The engine does not decide whose content it is. It is used for your own materials, for content with an open licence, or with the user's own access to a service under its rules.
When you do not need it
If media only needs to be watched, an embedded player is enough. And if all files are your own and already lie on your server, the engine is unnecessary: a direct link to the file is simpler.