YouTube Video Download API (Segments via FFmpeg)

Bondhu Digital Logo

This API endpoint was modified by Bondhu Digital.

Downloads YouTube videos using `yt-dlp`, then optionally cuts segments using `ffmpeg`. Input via JSON.

Disclaimer: Downloading YouTube videos may violate their Terms of Service. Use responsibly.

Logging: Check .log files in youtube_downloads/ on errors.

Server Status

API Usage

Endpoint

https://api.bondhudigital.com/index.php

Method

POST

Headers

Content-Type: application/json

Request Body (JSON Payload)

Send a JSON object with the following structure:

{
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "name": "custom_video_name",
    "start_time": 30,
    "end_time": 120
}

Note on Timestamps: If timestamps are provided, the full video is downloaded first, then cut using FFmpeg (`-c copy` for speed). Accuracy depends on video keyframes.

Success Response (JSON)

Returns a link to the downloaded file and its filename.

{
    "url": "https://api.bondhudigital.com/youtube_downloads/output_filename.mp4",
    "filename": "output_filename.mp4"
}

Error Response (JSON)

{
    "error": "Error message from yt-dlp, ffmpeg, or script."
}

Check the corresponding .log file in youtube_downloads/ for details.

How to Use (cURL Example)

Copy the command, replace values inside the JSON (`-d` argument), and run.

curl -X POST 'https://api.bondhudigital.com/index.php' \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","name":"custom_video_name","start_time":30,"end_time":120}'

Using with n8n:

Important Notes & Troubleshooting