This Telegram bot allows you to turn YouTube videos into podcasts that you can listen to in your favorite podcast app. Simply send a YouTube link to the bot and it will download the video, extract the audio, and generate an RSS feed that you can host on your server.
The bot is built using Deno
, a secure runtime for JavaScript and TypeScript, and uses the ytdl-core library to download and extract the audio from the YouTube video. It also uses the podcast library to generate the RSS feed.
To use the bot, you'll need to set up a Telegram bot and get an API token. You'll also need to have Deno
and Node.js
installed on your machine.
-
Clone this repository:
git clone https://github.com/uqe/youtube2rss
-
Install dependencies:
deno cache src/deps.ts --lock=deno.lock --lock-write
-
Make sure ffmpeg installed on your machine:
ffmpeg -version
-
Create SQLite database:
deno task prepare
-
Start a Teleram bot with this ENV variables:
TELEGRAM_BOT_TOKEN
andSERVER_URL
, for example:TELEGRAM_BOT_TOKEN=myTeLeGrAmBoTtOkEn SERVER_URL=https://my-s3-bucket-public-url.com deno task telegram
-
Start a chat with your bot in Telegram.
-
Send the bot a YouTube link.
-
The bot will download the video, extract the audio, and generate an RSS feed.
-
Host the RSS feed on your server and subscribe to it in your favorite podcast app.
-
Install dependencies:
deno install --allow-net --allow-read https://deno.land/[email protected]/http/file_server.ts
-
Start the file server:
deno task serve
- Start a Teleram bot with this ENV variables:
TELEGRAM_BOT_TOKEN
,SERVER_URL
,S3_BUCKET
,S3_ACCESS_KEY
,S3_ENDPOINT
andS3_SECRET_KEY
, for example:
TELEGRAM_BOT_TOKEN=myTeLeGrAmBoTtOkEn
SERVER_URL=https://my-s3-bucket-public-url.com
S3_BUCKET=youtube2rss
S3_ACCESS_KEY=s3AcCeSsKeY
S3_ENDPOINT=bucket.s3.com
S3_SECRET_KEY=s3SeCrEtKeY
deno task telegram
If all variables are set, the bot will store .mp3
files and generated rss.xml
file in your S3 bucket. I'm using Cloudflare R2 as S3 compatible storage. The free plan is sufficient for my needs. Don't forget to manually upload cover.jpg
to your bucket.
This project is licensed under the MIT License. See the LICENSE file for details.