Publish youtube_captions tool and request guide
Browse files- LICENSE +21 -0
- README.md +72 -6
- app.js +75 -0
- example.json +334 -0
- index.html +20 -17
- input-schema.json +29 -0
- requirements.txt +2 -0
- style.css +1 -28
- task.json +21 -0
- tool.py +21 -0
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 FlashData contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
CHANGED
|
@@ -1,12 +1,78 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: mit
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: "YouTube uploader caption retrieval"
|
| 3 |
+
emoji: 🔎
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
sdk: static
|
| 7 |
+
app_file: index.html
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
| 10 |
+
tags:
|
| 11 |
+
- smolagents
|
| 12 |
+
- tool
|
| 13 |
+
- flashdata
|
| 14 |
+
- youtube-captions
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# YouTube uploader caption retrieval — FlashData
|
| 18 |
+
|
| 19 |
+
Read an uploader-provided caption track for editorial review. Choose a language explicitly and retain the timing of each segment to check wording against the original video.
|
| 20 |
+
|
| 21 |
+
**Try this task:** Retrieve an existing manually supplied English caption track.
|
| 22 |
+
|
| 23 |
+
[FlashData youtube captions documentation](https://flashdata.dev/docs/sources/youtube_captions?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube-uploader-captions-flashdata) · [Create a FlashData account](https://flashdata.dev/signup)
|
| 24 |
+
|
| 25 |
+
## Run it
|
| 26 |
+
|
| 27 |
+
Open the Space to edit a request and inspect a documentation response sample. The interactive page runs locally in your browser; it does not send a FlashData query or collect an API key. The Python tool runs in your own process.
|
| 28 |
+
|
| 29 |
+
Use Python 3.10 or newer. Install the pinned dependencies:
|
| 30 |
+
|
| 31 |
+
```sh
|
| 32 |
+
python -m pip install "smolagents==1.26.0" "langchain-flashdata==0.2.1"
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
Create an API key in the FlashData console, fund the required credits, and supply the key in your local environment. Review `tool.py` before enabling remote code execution.
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
import getpass
|
| 39 |
+
import os
|
| 40 |
+
from smolagents import load_tool
|
| 41 |
+
|
| 42 |
+
os.environ["FLASHDATA_API_KEY"] = getpass.getpass("FlashData API key: ")
|
| 43 |
+
tool = load_tool("flashdata-dev/youtube-uploader-captions-flashdata", trust_remote_code=True)
|
| 44 |
+
result = tool(**{'auto': False, 'language': 'en', 'video_id': 'FUfGcZ092b0'})
|
| 45 |
+
print(result)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
This is a native smolagents Tool with typed task inputs. Add the loaded tool to your own agent; model choice, prompts and model fees remain under your control. Direct calls above do not need a model.
|
| 49 |
+
|
| 50 |
+
## Inputs
|
| 51 |
+
|
| 52 |
+
| Parameter | Type | Required / default | Details |
|
| 53 |
+
| --- | --- | --- | --- |
|
| 54 |
+
| `video_id` | string | Required | 11-character YouTube video ID or a YouTube video URL. |
|
| 55 |
+
| `language` | string | 'en' | Requested caption language code. pattern=^[A-Za-z0-9-]{1,35}$ |
|
| 56 |
+
| `auto` | boolean | False | False selects manual; true automatic captions. |
|
| 57 |
+
|
| 58 |
+
Optional `None` values are omitted; the documented adapter defaults apply.
|
| 59 |
+
|
| 60 |
+
Full validation rules are in `input-schema.json`.
|
| 61 |
+
|
| 62 |
+
## Output and next step
|
| 63 |
+
|
| 64 |
+
The useful data is at `results.0.segments`. Relevant fields: `start`, `end`, `text`.
|
| 65 |
+
|
| 66 |
+
Use the returned isAutoGenerated flag and languageCode to identify the selected track; preserve timestamps in downstream review.
|
| 67 |
+
|
| 68 |
+
The Space includes a recorded documentation example and its original request. It is not a fresh result for the task prompt above. Optional fields may be absent.
|
| 69 |
+
|
| 70 |
+
## Costs, limits and failures
|
| 71 |
+
|
| 72 |
+
Defaults to uploader-provided English captions. The requested track must exist. No ASR, translation or automatic fallback; this differs from the Transcript default.
|
| 73 |
+
|
| 74 |
+
The tool is MIT licensed. It is free to install. **FlashData API calls are paid**; installation does not include free data queries. Check current [FlashData pricing](https://flashdata.dev/pricing) and your console balance. Platform, model and customer storage charges are separate. Each search/page is a separate request; Extended Search has its own rate. Downloads are charged by delivered data volume.
|
| 75 |
+
|
| 76 |
+
An uncertain timeout can still represent a charged request. Check Jobs in the FlashData console before trying again; this integration does not automatically retry paid submissions. A 401 means the key was rejected, 402 means insufficient credits, and 429 means a rate or quota limit.
|
| 77 |
+
|
| 78 |
+
[Get started with this FlashData capability](https://flashdata.dev/docs/sources/youtube_captions?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube-uploader-captions-flashdata)
|
app.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const byId = id => document.getElementById(id);
|
| 2 |
+
const pythonLiteral = value => {
|
| 3 |
+
if (value === null) return 'None';
|
| 4 |
+
if (typeof value === 'boolean') return value ? 'True' : 'False';
|
| 5 |
+
if (Array.isArray(value)) return `[${value.map(pythonLiteral).join(', ')}]`;
|
| 6 |
+
if (typeof value === 'object') return `{${Object.entries(value).map(([k,v]) => `${JSON.stringify(k)}: ${pythonLiteral(v)}`).join(', ')}}`;
|
| 7 |
+
return JSON.stringify(value);
|
| 8 |
+
};
|
| 9 |
+
|
| 10 |
+
const [task, example, schema] = await Promise.all(['task.json','example.json','input-schema.json'].map(async file => {
|
| 11 |
+
const response = await fetch(file);
|
| 12 |
+
if (!response.ok) throw new Error(`Unable to load ${file}`);
|
| 13 |
+
return response.json();
|
| 14 |
+
}));
|
| 15 |
+
|
| 16 |
+
document.title = task.title;
|
| 17 |
+
for (const key of ['title','scenario','task','next','limit']) byId(key).textContent = task[key];
|
| 18 |
+
byId('docs').href = `https://flashdata.dev/docs/sources/${task.source}?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=${task.slug}`;
|
| 19 |
+
byId('source').href = `https://huggingface.co/spaces/${task.repo_id}/blob/main/tool.py`;
|
| 20 |
+
byId('readme').href = `https://huggingface.co/spaces/${task.repo_id}/blob/main/README.md`;
|
| 21 |
+
byId('parameters').value = JSON.stringify(task.input,null,2);
|
| 22 |
+
byId('response').value = JSON.stringify(example.response,null,2);
|
| 23 |
+
byId('sample-request').textContent = JSON.stringify(example.request,null,2);
|
| 24 |
+
|
| 25 |
+
function generate() {
|
| 26 |
+
try {
|
| 27 |
+
const args = JSON.parse(byId('parameters').value);
|
| 28 |
+
if (!args || Array.isArray(args) || typeof args !== 'object') throw new Error('Enter a JSON object.');
|
| 29 |
+
const allowed = task.source === 'youtube_download' ? ['operation','parameters','job_id'] : Object.keys(schema.properties);
|
| 30 |
+
if (Object.keys(args).some(key => !allowed.includes(key))) throw new Error('Use only the documented inputs; keep credentials in your local environment.');
|
| 31 |
+
const code = [
|
| 32 |
+
'# Install: python -m pip install smolagents==1.26.0 langchain-flashdata==0.2.1',
|
| 33 |
+
'import getpass', 'import os', 'from smolagents import load_tool', '',
|
| 34 |
+
'os.environ["FLASHDATA_API_KEY"] = getpass.getpass("FlashData API key: ")',
|
| 35 |
+
...(task.source === 'youtube_download' && args.operation === 'submit' ? ['os.environ["FLASHDATA_DOWNLOAD_STORAGE"] = getpass.getpass("Customer storage JSON: ")'] : []),
|
| 36 |
+
`tool = load_tool(${JSON.stringify(task.repo_id)}, trust_remote_code=True)`,
|
| 37 |
+
`result = tool(**${pythonLiteral(args)})`, 'print(result)'
|
| 38 |
+
];
|
| 39 |
+
byId('python').textContent = code.join('\n');
|
| 40 |
+
byId('input-status').textContent = 'Python call generated. The tool validates full parameter constraints before a request.';
|
| 41 |
+
} catch (error) {
|
| 42 |
+
byId('python').textContent = '';
|
| 43 |
+
byId('input-status').textContent = error.message;
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
function inspect() {
|
| 48 |
+
byId('results').replaceChildren();
|
| 49 |
+
try {
|
| 50 |
+
const response = JSON.parse(byId('response').value);
|
| 51 |
+
const selected = task.path.split('.').reduce((value, key) => value?.[key], response);
|
| 52 |
+
if (selected === undefined || selected === null) throw new Error(`No value at ${task.path}. Check the response format; failed or pending requests may have different fields.`);
|
| 53 |
+
const rows = Array.isArray(selected) ? selected : [selected];
|
| 54 |
+
byId('response-status').textContent = `${rows.length} item(s) at ${task.path}. Showing up to 10.`;
|
| 55 |
+
for (const row of rows.slice(0,10)) {
|
| 56 |
+
const card = document.createElement('div'); card.className = 'result';
|
| 57 |
+
const fields = typeof row === 'object' && row !== null ? task.fields.filter(key => Object.hasOwn(row,key)) : [];
|
| 58 |
+
if (!fields.length) { const p=document.createElement('p'); p.className='field'; p.textContent=typeof row === 'string' ? row : JSON.stringify(row); card.append(p); }
|
| 59 |
+
for (const key of fields) {
|
| 60 |
+
const line=document.createElement('p'); line.className='field';
|
| 61 |
+
const label=document.createElement('b'); label.textContent=key+': '; line.append(label);
|
| 62 |
+
const value=row[key];
|
| 63 |
+
if (typeof value === 'string' && /^https?:\/\//.test(value)) {
|
| 64 |
+
const link=document.createElement('a'); link.href=value; link.textContent=value; link.target='_blank'; link.rel='noopener noreferrer'; line.append(link);
|
| 65 |
+
} else line.append(document.createTextNode(typeof value === 'object' ? JSON.stringify(value) : String(value)));
|
| 66 |
+
card.append(line);
|
| 67 |
+
}
|
| 68 |
+
byId('results').append(card);
|
| 69 |
+
}
|
| 70 |
+
} catch (error) { byId('response-status').textContent=error.message; }
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
byId('generate').addEventListener('click',generate);
|
| 74 |
+
byId('inspect').addEventListener('click',inspect);
|
| 75 |
+
generate(); inspect();
|
example.json
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"request": {
|
| 3 |
+
"source": "youtube_captions",
|
| 4 |
+
"video_id": "dQw4w9WgXcQ",
|
| 5 |
+
"params": {
|
| 6 |
+
"language": "en",
|
| 7 |
+
"auto": false
|
| 8 |
+
}
|
| 9 |
+
},
|
| 10 |
+
"response": {
|
| 11 |
+
"source": "youtube_captions",
|
| 12 |
+
"status": "done",
|
| 13 |
+
"results": [
|
| 14 |
+
{
|
| 15 |
+
"videoId": "dQw4w9WgXcQ",
|
| 16 |
+
"languageCode": "en",
|
| 17 |
+
"languageName": null,
|
| 18 |
+
"isAutoGenerated": false,
|
| 19 |
+
"segments": [
|
| 20 |
+
{
|
| 21 |
+
"start": 1.36,
|
| 22 |
+
"end": 3.04,
|
| 23 |
+
"text": "[\u266a\u266a\u266a]"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"start": 18.64,
|
| 27 |
+
"end": 21.880000000000003,
|
| 28 |
+
"text": "\u266a We're no strangers to love \u266a"
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"start": 22.64,
|
| 32 |
+
"end": 26.96,
|
| 33 |
+
"text": "\u266a You know the rules\nand so do I \u266a"
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"start": 27.04,
|
| 37 |
+
"end": 31.04,
|
| 38 |
+
"text": "\u266a A full commitment's\nwhat I'm thinking of \u266a"
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"start": 31.12,
|
| 42 |
+
"end": 35.08,
|
| 43 |
+
"text": "\u266a You wouldn't get this\nfrom any other guy \u266a"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"start": 35.16,
|
| 47 |
+
"end": 39.519999999999996,
|
| 48 |
+
"text": "\u266a I just wanna tell you\nhow I'm feeling \u266a"
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"start": 40.52,
|
| 52 |
+
"end": 42.92,
|
| 53 |
+
"text": "\u266a Gotta make you understand \u266a"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"start": 43,
|
| 57 |
+
"end": 45.12,
|
| 58 |
+
"text": "\u266a Never gonna give you up \u266a"
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"start": 45.2,
|
| 62 |
+
"end": 47.080000000000005,
|
| 63 |
+
"text": "\u266a Never gonna let you down \u266a"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"start": 47.32,
|
| 67 |
+
"end": 51.12,
|
| 68 |
+
"text": "\u266a Never gonna run around\nand desert you \u266a"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"start": 51.48,
|
| 72 |
+
"end": 53.48,
|
| 73 |
+
"text": "\u266a Never gonna make you cry \u266a"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"start": 53.6,
|
| 77 |
+
"end": 55.52,
|
| 78 |
+
"text": "\u266a Never gonna say goodbye \u266a"
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"start": 55.72,
|
| 82 |
+
"end": 59.36,
|
| 83 |
+
"text": "\u266a Never gonna tell a lie\nand hurt you \u266a"
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"start": 60.8,
|
| 87 |
+
"end": 64.8,
|
| 88 |
+
"text": "\u266a We've known each other\nfor so long \u266a"
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"start": 64.88,
|
| 92 |
+
"end": 69.03999999999999,
|
| 93 |
+
"text": "\u266a Your heart's been aching\nbut you're too shy to say it \u266a"
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"start": 69.12,
|
| 97 |
+
"end": 72.96000000000001,
|
| 98 |
+
"text": "\u266a Inside we both know\nwhat's been going \u266a"
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"start": 73.36,
|
| 102 |
+
"end": 77.2,
|
| 103 |
+
"text": "\u266a We know the game\nand we're gonna play it \u266a"
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"start": 77.4,
|
| 107 |
+
"end": 82.04,
|
| 108 |
+
"text": "\u266a And if you ask me\nhow I'm feeling \u266a"
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"start": 82.4,
|
| 112 |
+
"end": 85.24000000000001,
|
| 113 |
+
"text": "\u266a Don't tell me\nyou're too blind to see \u266a"
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"start": 85.32,
|
| 117 |
+
"end": 87.27999999999999,
|
| 118 |
+
"text": "\u266a Never gonna give you up \u266a"
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"start": 87.36,
|
| 122 |
+
"end": 89.32,
|
| 123 |
+
"text": "\u266a Never gonna let you down \u266a"
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"start": 89.44,
|
| 127 |
+
"end": 93.72,
|
| 128 |
+
"text": "\u266a Never gonna run around\nand desert you \u266a"
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"start": 93.8,
|
| 132 |
+
"end": 95.6,
|
| 133 |
+
"text": "\u266a Never gonna make you cry \u266a"
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"start": 95.76,
|
| 137 |
+
"end": 98,
|
| 138 |
+
"text": "\u266a Never gonna say goodbye \u266a"
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"start": 98.08,
|
| 142 |
+
"end": 102.03999999999999,
|
| 143 |
+
"text": "\u266a Never gonna tell a lie\nand hurt you \u266a"
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"start": 102.2,
|
| 147 |
+
"end": 104.12,
|
| 148 |
+
"text": "\u266a Never gonna give you up \u266a"
|
| 149 |
+
},
|
| 150 |
+
{
|
| 151 |
+
"start": 104.28,
|
| 152 |
+
"end": 106.36,
|
| 153 |
+
"text": "\u266a Never gonna let you down \u266a"
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"start": 106.48,
|
| 157 |
+
"end": 110.08,
|
| 158 |
+
"text": "\u266a Never gonna run around\nand desert you \u266a"
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"start": 110.76,
|
| 162 |
+
"end": 112.72,
|
| 163 |
+
"text": "\u266a Never gonna make you cry \u266a"
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"start": 112.8,
|
| 167 |
+
"end": 114.67999999999999,
|
| 168 |
+
"text": "\u266a Never gonna say goodbye \u266a"
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"start": 114.96,
|
| 172 |
+
"end": 118.75999999999999,
|
| 173 |
+
"text": "\u266a Never gonna tell a lie\nand hurt you \u266a"
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"start": 119.84,
|
| 177 |
+
"end": 122.96000000000001,
|
| 178 |
+
"text": "\u266a (Ooh, give you up) \u266a"
|
| 179 |
+
},
|
| 180 |
+
{
|
| 181 |
+
"start": 123.72,
|
| 182 |
+
"end": 127.36,
|
| 183 |
+
"text": "\u266a (Ooh, give you up) \u266a"
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"start": 128.48,
|
| 187 |
+
"end": 130.11999999999998,
|
| 188 |
+
"text": "\u266a Never gonna give,\nnever gonna give \u266a"
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"start": 130.24,
|
| 192 |
+
"end": 131.56,
|
| 193 |
+
"text": "\u266a (Give you up) \u266a"
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"start": 132.48,
|
| 197 |
+
"end": 134.23999999999998,
|
| 198 |
+
"text": "\u266a Never gonna give,\nnever gonna give \u266a"
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"start": 134.36,
|
| 202 |
+
"end": 135.92000000000002,
|
| 203 |
+
"text": "\u266a (Give you up) \u266a"
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"start": 136.76,
|
| 207 |
+
"end": 141.07999999999998,
|
| 208 |
+
"text": "\u266a We've known each other\nfor so long \u266a"
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"start": 141.2,
|
| 212 |
+
"end": 145.2,
|
| 213 |
+
"text": "\u266a Your heart's been aching\nbut you're too shy to say it \u266a"
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"start": 145.28,
|
| 217 |
+
"end": 149.12,
|
| 218 |
+
"text": "\u266a Inside we both know\nwhat's been going \u266a"
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"start": 149.52,
|
| 222 |
+
"end": 153.20000000000002,
|
| 223 |
+
"text": "\u266a We know the game\nand we're gonna play it \u266a"
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"start": 153.36,
|
| 227 |
+
"end": 158.04000000000002,
|
| 228 |
+
"text": "\u266a I just wanna tell you\nhow I'm feeling \u266a"
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"start": 158.64,
|
| 232 |
+
"end": 161.32,
|
| 233 |
+
"text": "\u266a Gotta make you understand \u266a"
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"start": 161.4,
|
| 237 |
+
"end": 163.36,
|
| 238 |
+
"text": "\u266a Never gonna give you up \u266a"
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"start": 163.44,
|
| 242 |
+
"end": 165.64,
|
| 243 |
+
"text": "\u266a Never gonna let you down \u266a"
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"start": 165.72,
|
| 247 |
+
"end": 169.72,
|
| 248 |
+
"text": "\u266a Never gonna run around\nand desert you \u266a"
|
| 249 |
+
},
|
| 250 |
+
{
|
| 251 |
+
"start": 169.8,
|
| 252 |
+
"end": 171.64000000000001,
|
| 253 |
+
"text": "\u266a Never gonna make you cry \u266a"
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"start": 171.8,
|
| 257 |
+
"end": 173.96,
|
| 258 |
+
"text": "\u266a Never gonna say goodbye \u266a"
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"start": 174.04,
|
| 262 |
+
"end": 177.6,
|
| 263 |
+
"text": "\u266a Never gonna tell a lie\nand hurt you \u266a"
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"start": 178.2,
|
| 267 |
+
"end": 180.23999999999998,
|
| 268 |
+
"text": "\u266a Never gonna give you up \u266a"
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"start": 180.32,
|
| 272 |
+
"end": 182.44,
|
| 273 |
+
"text": "\u266a Never gonna let you down \u266a"
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"start": 182.52,
|
| 277 |
+
"end": 186.64000000000001,
|
| 278 |
+
"text": "\u266a Never gonna run around\nand desert you \u266a"
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"start": 186.72,
|
| 282 |
+
"end": 188.72,
|
| 283 |
+
"text": "\u266a Never gonna make you cry \u266a"
|
| 284 |
+
},
|
| 285 |
+
{
|
| 286 |
+
"start": 188.84,
|
| 287 |
+
"end": 190.72,
|
| 288 |
+
"text": "\u266a Never gonna say goodbye \u266a"
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"start": 190.84,
|
| 292 |
+
"end": 195.20000000000002,
|
| 293 |
+
"text": "\u266a Never gonna tell a lie\nand hurt you \u266a"
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"start": 195.28,
|
| 297 |
+
"end": 197.12,
|
| 298 |
+
"text": "\u266a Never gonna give you up \u266a"
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"start": 197.2,
|
| 302 |
+
"end": 199.23999999999998,
|
| 303 |
+
"text": "\u266a Never gonna let you down \u266a"
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"start": 199.4,
|
| 307 |
+
"end": 203.12,
|
| 308 |
+
"text": "\u266a Never gonna run around\nand desert you \u266a"
|
| 309 |
+
},
|
| 310 |
+
{
|
| 311 |
+
"start": 203.36,
|
| 312 |
+
"end": 205.60000000000002,
|
| 313 |
+
"text": "\u266a Never gonna make you cry \u266a"
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"start": 205.68,
|
| 317 |
+
"end": 207.84,
|
| 318 |
+
"text": "\u266a Never gonna say goodbye \u266a"
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"start": 207.92,
|
| 322 |
+
"end": 211.32,
|
| 323 |
+
"text": "\u266a Never gonna tell a lie\nand hurt you \u266a"
|
| 324 |
+
}
|
| 325 |
+
],
|
| 326 |
+
"fullText": "[\u266a\u266a\u266a] \u266a We're no strangers to love \u266a \u266a You know the rules\nand so do I \u266a \u266a A full commitment's\nwhat I'm thinking of \u266a \u266a You wouldn't get this\nfrom any other guy \u266a \u266a I just wanna tell you\nhow I'm feeling \u266a \u266a Gotta make you understand \u266a \u266a Never gonna give you up \u266a \u266a Never gonna let you down \u266a \u266a Never gonna run around\nand desert you \u266a \u266a Never gonna make you cry \u266a \u266a Never gonna say goodbye \u266a \u266a Never gonna tell a lie\nand hurt you \u266a \u266a We've known each other\nfor so long \u266a \u266a Your heart's been aching\nbut you're too shy to say it \u266a \u266a Inside we both know\nwhat's been going \u266a \u266a We know the game\nand we're gonna play it \u266a \u266a And if you ask me\nhow I'm feeling \u266a \u266a Don't tell me\nyou're too blind to see \u266a \u266a Never gonna give you up \u266a \u266a Never gonna let you down \u266a \u266a Never gonna run around\nand desert you \u266a \u266a Never gonna make you cry \u266a \u266a Never gonna say goodbye \u266a \u266a Never gonna tell a lie\nand hurt you \u266a \u266a Never gonna give you up \u266a \u266a Never gonna let you down \u266a \u266a Never gonna run around\nand desert you \u266a \u266a Never gonna make you cry \u266a \u266a Never gonna say goodbye \u266a \u266a Never gonna tell a lie\nand hurt you \u266a \u266a (Ooh, give you up) \u266a \u266a (Ooh, give you up) \u266a \u266a Never gonna give,\nnever gonna give \u266a \u266a (Give you up) \u266a \u266a Never gonna give,\nnever gonna give \u266a \u266a (Give you up) \u266a \u266a We've known each other\nfor so long \u266a \u266a Your heart's been aching\nbut you're too shy to say it \u266a \u266a Inside we both know\nwhat's been going \u266a \u266a We know the game\nand we're gonna play it \u266a \u266a I just wanna tell you\nhow I'm feeling \u266a \u266a Gotta make you understand \u266a \u266a Never gonna give you up \u266a \u266a Never gonna let you down \u266a \u266a Never gonna run around\nand desert you \u266a \u266a Never gonna make you cry \u266a \u266a Never gonna say goodbye \u266a \u266a Never gonna tell a lie\nand hurt you \u266a \u266a Never gonna give you up \u266a \u266a Never gonna let you down \u266a \u266a Never gonna run around\nand desert you \u266a \u266a Never gonna make you cry \u266a \u266a Never gonna say goodbye \u266a \u266a Never gonna tell a lie\nand hurt you \u266a \u266a Never gonna give you up \u266a \u266a Never gonna let you down \u266a \u266a Never gonna run around\nand desert you \u266a \u266a Never gonna make you cry \u266a \u266a Never gonna say goodbye \u266a \u266a Never gonna tell a lie\nand hurt you \u266a"
|
| 327 |
+
}
|
| 328 |
+
],
|
| 329 |
+
"usage": {
|
| 330 |
+
"credits": 0.01
|
| 331 |
+
},
|
| 332 |
+
"created_at": "2026-09-16T07:45:46.290Z"
|
| 333 |
+
}
|
| 334 |
+
}
|
index.html
CHANGED
|
@@ -1,19 +1,22 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 6 |
+
<title>FlashData research tool</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<main>
|
| 11 |
+
<header><a href="https://flashdata.dev" class="brand">FLASHDATA</a><span>Research tools for AI agents</span></header>
|
| 12 |
+
<section class="intro"><p class="eyebrow">SMOLAGENTS TOOL · PYTHON</p><h1 id="title">Loading tool…</h1><p id="scenario"></p><a id="docs" class="cta">Get an API key and read the docs ↗</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">This is a recorded documentation sample, not a live response to the request on the left. You can paste your own response JSON to explore its fields.</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>The tool is free to install. <strong>FlashData API calls are paid.</strong> Platform, model and customer storage costs are separate. No API or model call is made by this page. <a href="https://flashdata.dev/pricing">Check pricing ↗</a></p><p>For an uncertain timeout, check Jobs before retrying a paid submission. Download jobs must be read with their saved ID; do not submit again while pending.</p></section>
|
| 18 |
+
<footer><a id="source">Review tool.py</a><a id="readme">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>
|
| 21 |
+
</body>
|
| 22 |
</html>
|
input-schema.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"description": "Select uploader captions by default, without fallback.",
|
| 4 |
+
"properties": {
|
| 5 |
+
"video_id": {
|
| 6 |
+
"description": "11-character YouTube video ID or a YouTube video URL.",
|
| 7 |
+
"title": "Video Id",
|
| 8 |
+
"type": "string"
|
| 9 |
+
},
|
| 10 |
+
"language": {
|
| 11 |
+
"default": "en",
|
| 12 |
+
"description": "Requested caption language code.",
|
| 13 |
+
"pattern": "^[A-Za-z0-9-]{1,35}$",
|
| 14 |
+
"title": "Language",
|
| 15 |
+
"type": "string"
|
| 16 |
+
},
|
| 17 |
+
"auto": {
|
| 18 |
+
"default": false,
|
| 19 |
+
"description": "False selects manual; true automatic captions.",
|
| 20 |
+
"title": "Auto",
|
| 21 |
+
"type": "boolean"
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"required": [
|
| 25 |
+
"video_id"
|
| 26 |
+
],
|
| 27 |
+
"title": "YouTubeCaptionsInput",
|
| 28 |
+
"type": "object"
|
| 29 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
smolagents==1.26.0
|
| 2 |
+
langchain-flashdata==0.2.1
|
style.css
CHANGED
|
@@ -1,28 +1 @@
|
|
| 1 |
-
body {
|
| 2 |
-
padding: 2rem;
|
| 3 |
-
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
| 4 |
-
}
|
| 5 |
-
|
| 6 |
-
h1 {
|
| 7 |
-
font-size: 16px;
|
| 8 |
-
margin-top: 0;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
p {
|
| 12 |
-
color: rgb(107, 114, 128);
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
.card {
|
| 19 |
-
max-width: 620px;
|
| 20 |
-
margin: 0 auto;
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
.card p:last-child {
|
| 27 |
-
margin-bottom: 0;
|
| 28 |
-
}
|
|
|
|
| 1 |
+
:root{color-scheme:light;font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif;color:#14243b;background:#f4f7fb;font-synthesis:none}*{box-sizing:border-box}body{margin:0}main{max-width:1240px;margin:auto;padding:32px}a{color:#175bc1;text-underline-offset:3px}header{display:flex;align-items:center;gap:24px;border-bottom:1px solid #dce3ed;padding-bottom:24px;color:#64748b;font-size:14px}.brand{font-size:21px;letter-spacing:.1em;font-weight:850;text-decoration:none;color:#123364}.intro{max-width:900px;padding:52px 0 38px}.eyebrow{font-size:12px;letter-spacing:.13em;font-weight:750;color:#4977aa}h1{font-size:clamp(28px,4vw,46px);line-height:1.12;letter-spacing:-.035em;margin:18px 0}h2{font-size:22px;margin:0 0 14px}h3{font-size:17px;margin:28px 0 8px}p{line-height:1.65}.intro>p:not(.eyebrow){font-size:18px;color:#4d6077}.cta{display:inline-block;background:#164f9b;color:white;padding:12px 18px;border-radius:7px;text-decoration:none;font-weight:600;margin-top:12px}.grid{display:grid;grid-template-columns:1fr 1fr;gap:22px}.panel{background:#fff;border:1px solid #dce3ed;border-radius:12px;padding:26px;min-width:0;box-shadow:0 5px 20px #12336405}.hint{color:#61738b;font-size:13px}label{display:block;font-size:13px;font-weight:650;margin:20px 0 8px}textarea{display:block;width:100%;height:190px;resize:vertical;border:1px solid #cbd6e6;border-radius:7px;padding:13px;font:13px/1.55 ui-monospace,SFMono-Regular,monospace;color:#253c58;background:#fbfcff}button{margin-top:12px;border:1px solid #b5c9e4;border-radius:7px;background:#edf4ff;color:#164f9b;padding:10px 15px;cursor:pointer;font:600 14px inherit}button:hover{background:#dfecff}pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f4f7fb;padding:15px;border-radius:7px;font:12px/1.6 ui-monospace,SFMono-Regular,monospace}details{font-size:13px}summary{cursor:pointer;color:#175bc1}.result{padding:14px 0;border-bottom:1px solid #e5ebf3}.result:first-child{padding-top:0}.field{font-size:13px;line-height:1.6;overflow-wrap:anywhere;margin:4px 0}.field b{color:#62758b;font-weight:500}.next{margin-top:22px}footer{display:flex;flex-wrap:wrap;gap:20px;padding:25px 0;color:#718096;font-size:12px}[role=status]{font-size:13px;color:#536b88}:focus-visible{outline:3px solid #7ea9ee;outline-offset:3px}@media(max-width:800px){main{padding:20px}.grid{grid-template-columns:1fr}.intro{padding-top:30px}header{flex-wrap:wrap;gap:8px}.panel{padding:20px}h1{font-size:32px}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
task.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"slug": "youtube-uploader-captions-flashdata",
|
| 3 |
+
"title": "YouTube uploader caption retrieval \u2014 FlashData",
|
| 4 |
+
"scenario": "Read an uploader-provided caption track for editorial review. Choose a language explicitly and retain the timing of each segment to check wording against the original video.",
|
| 5 |
+
"task": "Retrieve an existing manually supplied English caption track.",
|
| 6 |
+
"input": {
|
| 7 |
+
"video_id": "FUfGcZ092b0",
|
| 8 |
+
"language": "en",
|
| 9 |
+
"auto": false
|
| 10 |
+
},
|
| 11 |
+
"path": "results.0.segments",
|
| 12 |
+
"fields": [
|
| 13 |
+
"start",
|
| 14 |
+
"end",
|
| 15 |
+
"text"
|
| 16 |
+
],
|
| 17 |
+
"next": "Use the returned isAutoGenerated flag and languageCode to identify the selected track; preserve timestamps in downstream review.",
|
| 18 |
+
"limit": "Defaults to uploader-provided English captions. The requested track must exist. No ASR, translation or automatic fallback; this differs from the Transcript default.",
|
| 19 |
+
"source": "youtube_captions",
|
| 20 |
+
"repo_id": "flashdata-dev/youtube-uploader-captions-flashdata"
|
| 21 |
+
}
|
tool.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import Tool
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class FlashDataTool(Tool):
|
| 5 |
+
name = 'youtube_captions'
|
| 6 |
+
description = 'Read an uploader-provided caption track for editorial review. Choose a language explicitly and retain the timing of each segment to check wording against the original video. Defaults to uploader-provided English captions. The requested track must exist. No ASR, translation or automatic fallback; this differs from the Transcript default. Uses paid FlashData API credits. Never automatically retry an uncertain submission; check Jobs first.'
|
| 7 |
+
inputs = {'auto': {'description': 'False selects manual; true automatic captions. Default: False.',
|
| 8 |
+
'nullable': True,
|
| 9 |
+
'type': 'boolean'},
|
| 10 |
+
'language': {'description': 'Requested caption language code. pattern: ^[A-Za-z0-9-]{1,35}$. '
|
| 11 |
+
"Default: 'en'.",
|
| 12 |
+
'nullable': True,
|
| 13 |
+
'type': 'string'},
|
| 14 |
+
'video_id': {'description': '11-character YouTube video ID or a YouTube video URL.',
|
| 15 |
+
'type': 'string'}}
|
| 16 |
+
output_type = 'object'
|
| 17 |
+
|
| 18 |
+
def forward(self, video_id: str, language: str = 'en', auto: bool = False) -> dict:
|
| 19 |
+
from langchain_flashdata import FlashDataYouTubeCaptions
|
| 20 |
+
values = {'video_id': video_id, 'language': language, 'auto': auto}
|
| 21 |
+
return FlashDataYouTubeCaptions().invoke({key: value for key, value in values.items() if value is not None})
|