A Rust-based Cloudflare Workers service that generates direct download links for videos from X.com (formerly Twitter).
- Generate direct download links for X.com/Twitter videos
- Fast and efficient using Rust and Cloudflare Workers
- Simple REST API with easy integration
- Serverless deployment via Cloudflare Workers
- Handles both x.com and twitter.com URLs
- Rust and Cargo
- Node.js and npm (for Cloudflare Wrangler)
- Wrangler CLI (Cloudflare Workers CLI)
-
Clone the repository:
git clone https://github.com/yourusername/xvdl.git cd xvdl -
Install dependencies:
cargo build
-
Install the worker-build tool:
cargo install worker-build
Send an HTTP request to your deployed Cloudflare Worker with the X/Twitter URL path:
https://your-worker-subdomain.workers.dev/https://x.com/username/status/1234567890
The service will return a direct download URL to the video if successful.
Request:
GET https://your-worker-subdomain.workers.dev/https://x.com/username/status/1234567890
Successful Response:
https://video-host.com/path/to/video.mp4
Error Response (400 Bad Request):
Invalid X URL. Only x.com and twitter.com URLs are supported.
Error Response (500 Internal Server Error):
Download job failed
To deploy the service to Cloudflare Workers:
-
Log in to Cloudflare using Wrangler:
wrangler login
-
Build and deploy the service:
wrangler publish
-
Your service will be available at
https://xvdl.your-account.workers.dev/
The API has a single endpoint that accepts X/Twitter URLs:
GET /{twitter_url}
Where {twitter_url} is a complete URL to an X/Twitter post containing a video.
The request is a simple HTTP GET with the Twitter URL as the path.
- On success: A plain text response containing the direct download URL
- On error: An error message with appropriate HTTP status code (400 for invalid requests, 500 for server errors)
- Rust - Programming language
- Cloudflare Workers - Serverless platform
- worker-rs - Rust bindings for Cloudflare Workers
- reqwest - HTTP client for Rust
- serde - Serialization framework for Rust
MIT
- Meowu (474384902@qq.com)
Contributions are welcome! Please feel free to submit a Pull Request.