Telegram бот для управления торрент клиентом и интеграция с трекером

It’s been half a year since the first publication about my small project, Kinozal-Bot. During this time, I have intermittently worked on it, adding new features and removing others due to Telegram’s limitations. In this article, I want to discuss the updates, who might find this solution useful, and what problems it solves.

The initial idea was to enable content search and download from the Kinozal torrent tracker to my home computer via my phone, regardless of my location—be it at work or on the road. Upon arriving home, I could simply turn on the TV, open the Plex app, and start watching. This was achieved within the first month, where the integration process (from downloading the torrent file and content to syncing with the Plex server) occurs within a single interface.

In my daily life, the bot is used almost every day, mostly by my spouse, because it’s convenient. There’s no need to approach the computer (which is often occupied) and use different interfaces separately. Personally, I find great value in the Kinozal-News channel, where I never miss new movie releases and get updates on new seasons of familiar series. Posts are automatically generated based on new publications on the Kinozal torrent tracker, filtered by rating (7.0+) and release year (2023+).

Each post on the channel contains a 🧲 Magnet link for downloading content in your torrent client (redirecting automatically to the default torrent client on both computer and phone). Additionally, each post includes brief information about the torrent, #hashtags for genre filtering on the channel, and buttons with links to the movie or series descriptions in the Kinopoisk and IMDb databases.

Remote Control

There are a couple of dozen applications available online (though fewer on iOS) for remote control of torrent clients (e.g., qBittorrent Controller or Transmission Remote). I have used them myself, but they all require direct access to the computer. This means your device (e.g., phone) must be on the same network as the computer, or you need to set up your own VPN server. With the bot, you don’t need to install a separate client on each device, as Telegram can be used through a browser, and all requests go through the Telegram API, which acts as a gateway between the client and server.

The bot supports two clients: qBittorrent and Transmission, which can be configured and used independently of the tracker’s settings or availability.

Unified Interface

All torrent trackers have outdated interfaces (from the 2010s) and lack mobile versions. When traveling, finding a torrent to download on a phone or tablet can be a challenge, as accessing familiar trackers requires a VPN, and using such sites on a phone is extremely inconvenient. With the bot, you get a simple and convenient interface where you can search for torrents using familiar filters (by release year and resolution) and download torrent files directly to Telegram.

Adding torrents for download is also possible using the info hash or URL of any tracker’s torrent file. For local content downloads to your phone, I recommend using LibreTorrent, which is open-source and downloads metadata (and content) much faster than uTorrent on Android.

Actor Search

Additionally, for each movie or series, you can get a list of actors or search for an actor by name to get brief information and their filmography, which can then be used for further searches.

Additional Information via TMDB

Not all information may be useful, but many are accustomed to using Kinopoisk. For some, it’s no secret that much of the information about foreign films and series comes from The Movie Database. For me, the most valuable information is the release dates of seasons and episodes, which looks like this:

The bot implements this search through the TMDB API using the IMDb id present in each torrent. You can also get separate information about each episode, including its rating and guest actors.

Plex Management

Since the final viewing device is an Android-based TV, you need to install the Plex client application on it and connect it to your server running on the computer. You can set up automatic synchronization of a specified section (this should be the directory targeted by the default torrent client) or manually through the bot. Additionally, you can get extra information from the server, such as episode duration, format, resolution, and a list of recent views (with stop times) and additions.

The obvious advantage of a Plex Pass subscription is the ability to download your content from the server to a local device for offline viewing (usually a phone or tablet). As an alternative solution, I set up the second torrent client to download content to a separate directory, which is then synced with cloud storage. For example, with the bot, I can pre-load a selected movie, and when I have stable internet access, I can start watching online from my phone (without restrictions, as streaming through the Plex app without a subscription often gets interrupted) or download the file to my device. It may not be a perfect solution, but I’ve been using it for a long time.

Summary

You can find setup instructions and additional information about the project in the source repository on GitHub. I still see many opportunities for developing this solution, but due to numerous API limitations, not everything can be implemented, which makes sense since Telegram is primarily a messenger. I have a couple of backend projects (requiring refinement, just started learning JavaScript) for which I plan to create my mobile interface. My goal is to integrate a modern WebTorrent client and Russian-language trackers using APIs for unified interaction and management through the phone. If anyone finds this topic interesting, I would be happy to collaborate (you can write to me on Habr).

TrendTechie
Telegram бот для управления торрент клиентом и интеграция с трекером