flashdata-dev's picture
Track FlashData signup and pricing referrals
a8ca054 verified
|
Raw History Blame Contribute Delete
4.77 kB
---
title: "YouTube Download to Cloud Storage"
short_description: "Download video, audio or clips to your cloud storage."
emoji: "🔎"
colorFrom: "blue"
colorTo: "indigo"
sdk: "static"
app_file: "index.html"
pinned: false
license: "mit"
tags:
- smolagents
- tool
- flashdata
- youtube-download
---
# YouTube Download to Cloud Storage
Download YouTube video, audio or clips to your own S3 or other supported cloud storage. Submit a job once, then read its status and delivery manifest.
[API documentation](https://flashdata.dev/docs/sources/youtube_download?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube-cloud-media-delivery-flashdata) · [Get an API key](https://flashdata.dev/signup?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube_download-task) · [Pricing](https://flashdata.dev/pricing?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube_download-task)
Requires your own FlashData API key and paid Credits. The Python tool is free to install.
## Try the inputs
Edit the JSON in this Space, generate a Python call, and inspect the included sample response or paste your own JSON. This page runs locally in your browser; it does not run a data query or collect your API key.
## Run with Python
Use Python 3.10 or newer:
```sh
python -m pip install "smolagents==1.26.0" "langchain-flashdata==0.2.1"
```
Review [tool.py](tool.py) before enabling `trust_remote_code`. Run locally with your key:
```python
import getpass
import os
from smolagents import load_tool
os.environ["FLASHDATA_API_KEY"] = getpass.getpass("FlashData API key: ")
os.environ["FLASHDATA_DOWNLOAD_STORAGE"] = getpass.getpass("Storage configuration JSON: ")
tool = load_tool("flashdata-dev/youtube-cloud-media-delivery-flashdata", trust_remote_code=True)
result = tool(**{'operation': 'submit',
'parameters': {'end_at': '00:00:10',
'output_format': 'mp4',
'start_at': '00:00:00',
'video_id': 'FUfGcZ092b0',
'video_quality': '<=720'}})
print(result)
```
The same loaded tool can be used with smolagents. A direct Python call does not require a model.
## Track the download
Supply storage credentials through `FLASHDATA_DOWNLOAD_STORAGE`, outside the public inputs. See [storage configuration](https://flashdata.dev/docs/sources/youtube_download?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube-cloud-media-delivery-flashdata) for S3, S3-compatible, OSS, GCS, Azure, COS, BOS and TOS.
After submitting, save the job ID and read it without resubmitting:
```python
saved_job_id = result["id"]
status = tool(operation="status", job_id=saved_job_id)
# After completion:
output = tool(operation="result", job_id=saved_job_id)
```
`submit` takes media `parameters`; `status` and `result` take only `job_id`. Completed output contains a delivery manifest with `file_url`, `file_size` and available media fields.
## Inputs
The table below describes fields inside the `parameters` object for `operation="submit"`.
| Parameter | Required / default | Details |
| --- | --- | --- |
| `video_id` | Required | 11-character YouTube video ID or a YouTube video URL. |
| `download_type` | 'audio_video' | download type enum=['audio_video', 'video', 'audio'] |
| `video_quality` | None | video quality |
| `fps` | None | fps |
| `audio_language` | None | audio language enum=['default', 'original'] |
| `audio_quality` | None | audio quality enum=['best', '320', '256', '192', '128'] |
| `yt_dlp_format` | None | yt dlp format |
| `upload_metadata` | False | upload metadata |
| `output_format` | None | output format enum=['mp4', 'webm', 'mkv', 'm4a', 'mp3', 'opus'] |
| `start_at` | None | start at |
| `end_at` | None | end at |
See [input-schema.json](input-schema.json) for full validation rules. Optional `None` values are omitted; adapter defaults apply.
## Output
Read `links`. Fields: `rel`, `href`, `method`. Optional fields may be absent.
[example.json](example.json) contains a recorded response and its original request, not a new result for the input shown in the Space.
## Limits and cost
Requires your own writable storage and permission for your intended use. Downloads are asynchronous and charged by delivered data volume; storage charges are separate.
Check [current pricing](https://flashdata.dev/pricing?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube_download-task) before running. Any model or hosting charges are separate.
For an uncertain timeout, check your FlashData Jobs before retrying; this tool does not automatically retry paid submissions.