/anydownloadbot

Telegram bot that responds to links with a video or audio file

Primary LanguagePython

AnyDownloadBot

Available on Telegram as @AnyDownloadBot.

Send it a link and receive back a video or audio file to keep offline. Works with YouTube, SoundCloud, anything really. Hosted as an AWS Lambda function, built using youtube-dl and Python.

Sample chat log

Usage

You can use the hosted version by chatting with @AnyDownloadBot on Telegram. Send a link to get back an audio file. Send the link with /video to get back the video. Telegram limits uploads to 50 MB, so a link to a download will be sent if needed.

Installation

Install serverless and fill in your Telegram token and cutt.ly API key in the .env file.

Deploy the ffmpeg-lambda-layer AWS Lambda layer and update the ffmpegBaseLayer property in the serverless.yml file.

Run the following commands:

npm install
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
sls deploy

Update the webhook on Telegram by making a request to http://api.telegram.org/bot[YOUR_BOT_TOKEN]/setWebhook?url=[AWS_ENDPOINT] (you can just open it in your browser).

The completed URL should look like http://api.telegram.org/bot0000000000:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/setWebhook?url=https://0000000000.execute-api.us-east-0.amazonaws.com/dev/webhook and you should get back an OK.