This Bun-powered project converts YouTube video subtitles to SRT format using Cloudflare Workers.
-
Install Bun if you haven't already.
-
Clone and enter the repo:
git clone https://github.com/nicobailon/youtube-transcript-api-cf-worker.git cd youtube-transcript-api-cf-worker
-
Install dependencies:
bun install
-
Get Wrangler:
bun add -g wrangler
-
Log into Cloudflare:
wrangler login
Run locally:
wrangler dev
Access at http://localhost:8787
.
Deploy to Cloudflare:
wrangler publish
Hit your worker with a GET request:
https://your-worker.workers.dev/?url=https://www.youtube.com/watch?v=H7Qe96fqg1M
You'll get the SRT content as plain text.
src/index.ts
: Worker logicwrangler.toml
: Cloudflare configpackage.json
: Project metadatatsconfig.json
: TypeScript settings
- youtube-captions-scraper (MIT)
- @cloudflare/workers-types (BSD-3-Clause)
- typescript (Apache-2.0)
PRs welcome!
MIT. Go wild.