Clarify capability names and simplify documentation
Browse files
README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: "YouTube
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
pinned: false
|
| 9 |
-
license: mit
|
| 10 |
tags:
|
| 11 |
- smolagents
|
| 12 |
- tool
|
|
@@ -14,25 +15,27 @@ tags:
|
|
| 14 |
- youtube-download
|
| 15 |
---
|
| 16 |
|
| 17 |
-
# YouTube
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
##
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
|
| 31 |
```sh
|
| 32 |
python -m pip install "smolagents==1.26.0" "langchain-flashdata==0.2.1"
|
| 33 |
```
|
| 34 |
|
| 35 |
-
|
| 36 |
|
| 37 |
```python
|
| 38 |
import getpass
|
|
@@ -40,7 +43,7 @@ import os
|
|
| 40 |
from smolagents import load_tool
|
| 41 |
|
| 42 |
os.environ["FLASHDATA_API_KEY"] = getpass.getpass("FlashData API key: ")
|
| 43 |
-
os.environ["FLASHDATA_DOWNLOAD_STORAGE"] = getpass.getpass("
|
| 44 |
tool = load_tool("flashdata-dev/youtube-cloud-media-delivery-flashdata", trust_remote_code=True)
|
| 45 |
result = tool(**{'operation': 'submit',
|
| 46 |
'parameters': {'end_at': '00:00:10',
|
|
@@ -51,54 +54,53 @@ result = tool(**{'operation': 'submit',
|
|
| 51 |
print(result)
|
| 52 |
```
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
## Inputs
|
| 57 |
-
|
| 58 |
-
| Parameter | Type | Required / default | Details |
|
| 59 |
-
| --- | --- | --- | --- |
|
| 60 |
-
| `video_id` | string | Required | 11-character YouTube video ID or a YouTube video URL. |
|
| 61 |
-
| `download_type` | string | 'audio_video' | download type enum=['audio_video', 'video', 'audio'] |
|
| 62 |
-
| `video_quality` | string | None | video quality pattern=^(best/worst/(?:<=/==/>=)(?:144/360/480/720/1080/1440/2160/4320))$ |
|
| 63 |
-
| `fps` | string | None | fps pattern=^(?:>=/<=/==)(?:[1-9]\d?/1\d\d/2[0-3]\d/240)$ |
|
| 64 |
-
| `audio_language` | string | None | audio language enum=['default', 'original'] |
|
| 65 |
-
| `audio_quality` | string | None | audio quality enum=['best', '320', '256', '192', '128'] |
|
| 66 |
-
| `yt_dlp_format` | string | None | yt dlp format |
|
| 67 |
-
| `upload_metadata` | boolean | False | upload metadata |
|
| 68 |
-
| `output_format` | string | None | output format enum=['mp4', 'webm', 'mkv', 'm4a', 'mp3', 'opus'] |
|
| 69 |
-
| `start_at` | string | None | start at pattern=^\d{1,2}:[0-5]\d:[0-5]\d$ |
|
| 70 |
-
| `end_at` | string | None | end at pattern=^\d{1,2}:[0-5]\d:[0-5]\d$ |
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
After submission, save `result["id"]`. Then read without resubmitting:
|
| 79 |
|
| 80 |
```python
|
| 81 |
saved_job_id = result["id"]
|
| 82 |
status = tool(operation="status", job_id=saved_job_id)
|
|
|
|
| 83 |
output = tool(operation="result", job_id=saved_job_id)
|
| 84 |
```
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
|
| 94 |
-
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
-
|
| 99 |
|
| 100 |
-
|
| 101 |
|
| 102 |
-
|
| 103 |
|
| 104 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
title: "YouTube Download to Cloud Storage"
|
| 3 |
+
short_description: "Download video, audio or clips to your cloud storage."
|
| 4 |
+
emoji: "🔎"
|
| 5 |
+
colorFrom: "blue"
|
| 6 |
+
colorTo: "indigo"
|
| 7 |
+
sdk: "static"
|
| 8 |
+
app_file: "index.html"
|
| 9 |
pinned: false
|
| 10 |
+
license: "mit"
|
| 11 |
tags:
|
| 12 |
- smolagents
|
| 13 |
- tool
|
|
|
|
| 15 |
- youtube-download
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# YouTube Download to Cloud Storage
|
| 19 |
|
| 20 |
+
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.
|
| 21 |
|
| 22 |
+
[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/app/api-keys) · [Pricing](https://flashdata.dev/pricing)
|
| 23 |
|
| 24 |
+
Requires your own FlashData API key and paid Credits. The Python tool is free to install.
|
| 25 |
|
| 26 |
+
## Try the inputs
|
| 27 |
|
| 28 |
+
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.
|
| 29 |
|
| 30 |
+
## Run with Python
|
| 31 |
+
|
| 32 |
+
Use Python 3.10 or newer:
|
| 33 |
|
| 34 |
```sh
|
| 35 |
python -m pip install "smolagents==1.26.0" "langchain-flashdata==0.2.1"
|
| 36 |
```
|
| 37 |
|
| 38 |
+
Review [tool.py](tool.py) before enabling `trust_remote_code`. Run locally with your key:
|
| 39 |
|
| 40 |
```python
|
| 41 |
import getpass
|
|
|
|
| 43 |
from smolagents import load_tool
|
| 44 |
|
| 45 |
os.environ["FLASHDATA_API_KEY"] = getpass.getpass("FlashData API key: ")
|
| 46 |
+
os.environ["FLASHDATA_DOWNLOAD_STORAGE"] = getpass.getpass("Storage configuration JSON: ")
|
| 47 |
tool = load_tool("flashdata-dev/youtube-cloud-media-delivery-flashdata", trust_remote_code=True)
|
| 48 |
result = tool(**{'operation': 'submit',
|
| 49 |
'parameters': {'end_at': '00:00:10',
|
|
|
|
| 54 |
print(result)
|
| 55 |
```
|
| 56 |
|
| 57 |
+
The same loaded tool can be used with smolagents. A direct Python call does not require a model.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
## Track the download
|
| 60 |
|
| 61 |
+
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.
|
| 62 |
|
| 63 |
+
After submitting, save the job ID and read it without resubmitting:
|
|
|
|
|
|
|
| 64 |
|
| 65 |
```python
|
| 66 |
saved_job_id = result["id"]
|
| 67 |
status = tool(operation="status", job_id=saved_job_id)
|
| 68 |
+
# After completion:
|
| 69 |
output = tool(operation="result", job_id=saved_job_id)
|
| 70 |
```
|
| 71 |
|
| 72 |
+
`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.
|
| 73 |
+
|
| 74 |
+
## Inputs
|
| 75 |
+
|
| 76 |
+
The table below describes fields inside the `parameters` object for `operation="submit"`.
|
| 77 |
|
| 78 |
+
| Parameter | Required / default | Details |
|
| 79 |
+
| --- | --- | --- |
|
| 80 |
+
| `video_id` | Required | 11-character YouTube video ID or a YouTube video URL. |
|
| 81 |
+
| `download_type` | 'audio_video' | download type enum=['audio_video', 'video', 'audio'] |
|
| 82 |
+
| `video_quality` | None | video quality |
|
| 83 |
+
| `fps` | None | fps |
|
| 84 |
+
| `audio_language` | None | audio language enum=['default', 'original'] |
|
| 85 |
+
| `audio_quality` | None | audio quality enum=['best', '320', '256', '192', '128'] |
|
| 86 |
+
| `yt_dlp_format` | None | yt dlp format |
|
| 87 |
+
| `upload_metadata` | False | upload metadata |
|
| 88 |
+
| `output_format` | None | output format enum=['mp4', 'webm', 'mkv', 'm4a', 'mp3', 'opus'] |
|
| 89 |
+
| `start_at` | None | start at |
|
| 90 |
+
| `end_at` | None | end at |
|
| 91 |
|
| 92 |
+
See [input-schema.json](input-schema.json) for full validation rules. Optional `None` values are omitted; adapter defaults apply.
|
| 93 |
|
| 94 |
+
## Output
|
| 95 |
|
| 96 |
+
Read `links`. Fields: `rel`, `href`, `method`. Optional fields may be absent.
|
| 97 |
|
| 98 |
+
[example.json](example.json) contains a recorded response and its original request, not a new result for the input shown in the Space.
|
| 99 |
|
| 100 |
+
## Limits and cost
|
| 101 |
|
| 102 |
+
Requires your own writable storage and permission for your intended use. Downloads are asynchronous and charged by delivered data volume; storage charges are separate.
|
| 103 |
|
| 104 |
+
Check [current pricing](https://flashdata.dev/pricing) before running. Any model or hosting charges are separate.
|
| 105 |
|
| 106 |
+
For an uncertain timeout, check your FlashData Jobs before retrying; this tool does not automatically retry paid submissions.
|
index.html
CHANGED
|
@@ -3,18 +3,18 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 6 |
-
<title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<main>
|
| 11 |
-
<header><a href="https://flashdata.dev" class="brand" target="_blank" rel="noopener">FLASHDATA</a><span>
|
| 12 |
-
<section class="intro"><p class="eyebrow">
|
| 13 |
<div class="grid">
|
| 14 |
<section class="panel"><h2>Build a request</h2><p id="task"></p><label for="parameters">Tool inputs (JSON)</label><textarea id="parameters" spellcheck="false"></textarea><button id="generate" type="button">Generate Python call</button><p id="input-status" role="status"></p><pre><code id="python"></code></pre><p class="hint">Run this code in your Python environment. Your API key is entered there, not on this page.</p></section>
|
| 15 |
-
<section class="panel"><h2>Inspect the response</h2><p class="hint">
|
| 16 |
</div>
|
| 17 |
-
<section class="panel next"><h2>Use the result</h2><p id="next"></p><h3>Limits and costs</h3><p id="limit"></p><p>
|
| 18 |
<footer><a id="source" target="_blank" rel="noopener">Review tool.py</a><a id="readme" target="_blank" rel="noopener">Installation and input reference</a><span>MIT licensed integration · FlashData API terms apply separately</span></footer>
|
| 19 |
</main>
|
| 20 |
<script type="module" src="app.js"></script>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 6 |
+
<title>Search and video data tools</title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<main>
|
| 11 |
+
<header><a href="https://flashdata.dev" class="brand" target="_blank" rel="noopener">FLASHDATA</a><span>Search & video data</span></header>
|
| 12 |
+
<section class="intro"><p class="eyebrow">PYTHON TOOL · REQUEST EXAMPLES</p><h1 id="title">Loading tool…</h1><p id="scenario"></p><a id="docs" class="cta" target="_blank" rel="noopener">API documentation & setup ↗</a></section>
|
| 13 |
<div class="grid">
|
| 14 |
<section class="panel"><h2>Build a request</h2><p id="task"></p><label for="parameters">Tool inputs (JSON)</label><textarea id="parameters" spellcheck="false"></textarea><button id="generate" type="button">Generate Python call</button><p id="input-status" role="status"></p><pre><code id="python"></code></pre><p class="hint">Run this code in your Python environment. Your API key is entered there, not on this page.</p></section>
|
| 15 |
+
<section class="panel"><h2>Inspect the response</h2><p class="hint">View the included sample or paste your own response JSON. Editing the request does not run a query.</p><details><summary>Original sample request</summary><pre id="sample-request"></pre></details><label for="response">Response JSON</label><textarea id="response" spellcheck="false"></textarea><button id="inspect" type="button">Inspect results</button><p id="response-status" role="status"></p><div id="results"></div></section>
|
| 16 |
</div>
|
| 17 |
+
<section class="panel next"><h2>Use the result</h2><p id="next"></p><h3>Limits and costs</h3><p id="limit"></p><p>Requires your FlashData API key. <strong>Data calls use paid Credits.</strong> This page only prepares code and displays JSON. <a href="https://flashdata.dev/pricing" target="_blank" rel="noopener">Check pricing ↗</a></p><p>Check FlashData Jobs before retrying a request that timed out.</p></section>
|
| 18 |
<footer><a id="source" target="_blank" rel="noopener">Review tool.py</a><a id="readme" target="_blank" rel="noopener">Installation and input reference</a><span>MIT licensed integration · FlashData API terms apply separately</span></footer>
|
| 19 |
</main>
|
| 20 |
<script type="module" src="app.js"></script>
|
task.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
{
|
| 2 |
"slug": "youtube-cloud-media-delivery-flashdata",
|
| 3 |
-
"title": "YouTube
|
| 4 |
-
"scenario": "
|
| 5 |
-
"task": "
|
| 6 |
"input": {
|
| 7 |
"operation": "submit",
|
| 8 |
"parameters": {
|
|
@@ -19,8 +19,9 @@
|
|
| 19 |
"href",
|
| 20 |
"method"
|
| 21 |
],
|
| 22 |
-
"next": "
|
| 23 |
-
"limit": "
|
|
|
|
| 24 |
"source": "youtube_download",
|
| 25 |
"repo_id": "flashdata-dev/youtube-cloud-media-delivery-flashdata"
|
| 26 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"slug": "youtube-cloud-media-delivery-flashdata",
|
| 3 |
+
"title": "YouTube Download to Cloud Storage",
|
| 4 |
+
"scenario": "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.",
|
| 5 |
+
"task": "Prepare a download, or check an existing job ID.",
|
| 6 |
"input": {
|
| 7 |
"operation": "submit",
|
| 8 |
"parameters": {
|
|
|
|
| 19 |
"href",
|
| 20 |
"method"
|
| 21 |
],
|
| 22 |
+
"next": "Save the submitted job ID. Select status or result to read that job without submitting it again.",
|
| 23 |
+
"limit": "Requires your own writable storage and permission for your intended use. Downloads are asynchronous and charged by delivered data volume; storage charges are separate.",
|
| 24 |
+
"short_description": "Download video, audio or clips to your cloud storage.",
|
| 25 |
"source": "youtube_download",
|
| 26 |
"repo_id": "flashdata-dev/youtube-cloud-media-delivery-flashdata"
|
| 27 |
}
|
tool.py
CHANGED
|
@@ -3,7 +3,7 @@ from smolagents import Tool
|
|
| 3 |
|
| 4 |
class FlashDataTool(Tool):
|
| 5 |
name = 'youtube_download'
|
| 6 |
-
description = '
|
| 7 |
inputs = {'job_id': {'description': 'Required for status/result. ID returned by a previous submit.',
|
| 8 |
'nullable': True,
|
| 9 |
'type': 'string'},
|
|
|
|
| 3 |
|
| 4 |
class FlashDataTool(Tool):
|
| 5 |
name = 'youtube_download'
|
| 6 |
+
description = '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. Requires your own writable storage and permission for your intended use. Downloads are asynchronous and charged by delivered data volume; storage charges are separate. Uses paid FlashData API credits. Never automatically retry an uncertain submission; check Jobs first.'
|
| 7 |
inputs = {'job_id': {'description': 'Required for status/result. ID returned by a previous submit.',
|
| 8 |
'nullable': True,
|
| 9 |
'type': 'string'},
|