Thanks to visit codestin.com
Credit goes to github.com

Skip to content

savinmikhail/rcdtool

 
 

Repository files navigation

rcdtool

Script that downloads telegram restricted content.

Usage

For help:

./rcdtool --help

Normally, the script will take the channel and message IDs from the CLI argument, but if you did not provide them, then the script will prompt your for each missing ID. You can also customize the output filename.

If you have channel and message IDs you can do:

./rcdtool -c /path/to/config.ini -C <channel ID here> -M <message ID here> -O interesting-video.mp4

Then the script starts the downloading.

Well, if you use the Python script, then change rcdtool by python rcdtool et voilà.

Where I find these IDs?

In desktop: right click > copy message/post link. In mobile: touch the message > copy link

This link will have this format:

https://t.me/c/<channel ID>/<message ID>

Then, extract the IDs from the link. Or you can pass that link to the tool with --link as follows:

./rcdtool --link https://t.me/c/106942033f/123 -O stuff.png

Dist

In this repository we release the source code (Python) and a binary option for GNU/Linux. You can build a binary for any other operating system using tool as PyInstaller.

Telegram session

You MUST have an API ID provided by Telegram at https://my.telegram.org/ (I think). This is as follows:

api_id: 32767
api_hash: ed855a59bbe4a3360dbf7a0538842142

You might have problems with registering new app, consider following these advices: https://habr.com/ru/articles/923168/

Then rename config.ini.sample to config.ini, edit it and save wherever you want. If the file is in the same directory as rcdtool and its name is exactly "config.ini", then rcdtool will load it automatically.

The first time, rcdtool will ask you for your phone number, and will start a login process. When this is done, a .session file will be created. With this .session file, the tool could access to your Telegram account to read messages and download medias. The name of the .session file is set in config.ini.

This tool answers to the question of how to bypass content forwarding/download restriction on telegram channels suck as restricted videos.

Advanced usage

You can define multiple message IDs separated by commas and define a range of message IDs using '..'.

# message id 34
rcdtool -c config.ini -C qwert -M 34

# message id 34 and 50
rcdtool -c config.ini -C qwert -M 34,50 -O download/photo

# message id range from 34 to 60
rcdtool -c config.ini -C -100200200 -M 34..60

# two message id and a message id range
rcdtool -c config.ini -C 200200 -M 13,15,20..30

# passing a simple link
rcdtool -c config.ini --link https://t.me/c/200200/503

# passing a link where the <message id> section define multiple message ids
rcdtool -c config.ini --link https://t.me/c/200200/13,15,20..30

You can request that the script infer the file extension.

rcdtool -c config.ini -C qwert -M 34 -O download/base --infer-extension

If you want to find a media in a comment on a channel post, use --discussion-message-id to set the message id of the comment.

Docker

You can run this app inside a docker container, see Makefile

Makefile shortcuts

Prefer one-liners via make (defaults include --infer-extension so files get a proper extension):

  • Build and prepare:
make build
make setup
  • Start a long‑lived container once, then exec commands inside it:
make up         # builds image, prepares data/, runs container as a daemon
make shell      # optional: drop into /work inside the container
docker exec -it -w /work rcdtoold python3 /app/rcdtool_from_messages.py --infer-extension -f /app/.stuff/messages.md -c /work/config.ini

About

Script that downloads telegram restricted content.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 95.9%
  • Dockerfile 2.3%
  • Makefile 1.8%