flashdata-dev commited on
Commit
c0bd27b
·
verified ·
1 Parent(s): 1cd79df

Publish youtube_metadata tool and request guide

Browse files
Files changed (10) hide show
  1. LICENSE +21 -0
  2. README.md +71 -5
  3. app.js +75 -0
  4. example.json +445 -0
  5. index.html +20 -17
  6. input-schema.json +28 -0
  7. requirements.txt +2 -0
  8. style.css +1 -28
  9. task.json +23 -0
  10. tool.py +20 -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: Youtube Metadata Chapters Flashdata
3
- emoji: 🐠
4
- colorFrom: red
5
  colorTo: indigo
6
  sdk: static
 
7
  pinned: false
8
  license: mit
9
- short_description: YouTube metadata and chapter inspection
 
 
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: "YouTube metadata and chapter inspection"
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-metadata
15
  ---
16
 
17
+ # YouTube metadata and chapter inspection — FlashData
18
+
19
+ Prepare a video research brief before reading a transcript or processing media. Inspect the title, channel, description and available chapters to choose the portions worth reviewing.
20
+
21
+ **Try this task:** Inspect a video's chapters and channel attribution for a research note.
22
+
23
+ [FlashData youtube metadata documentation](https://flashdata.dev/docs/sources/youtube_metadata?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube-metadata-chapters-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-metadata-chapters-flashdata", trust_remote_code=True)
44
+ result = tool(**{'include_chapters': True, 'include_formats': False, '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
+ | `include_chapters` | boolean | True | Include available video chapters. |
56
+ | `include_formats` | boolean | True | Include available format metadata. |
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`. Relevant fields: `videoId`, `title`, `channel`, `duration`, `chapters`.
65
+
66
+ Use available chapter timestamps to guide manual review. Preserve video ID and channel attribution alongside your notes.
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
+ Chapters exist only when supplied by the video. Counts, formats and other metadata can be unavailable; this does not fetch transcript text.
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_metadata?utm_source=hugging-face&utm_medium=integration&utm_campaign=intent_gtm_2026q4&utm_content=youtube-metadata-chapters-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,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "request": {
3
+ "source": "youtube_metadata",
4
+ "video_id": "dQw4w9WgXcQ",
5
+ "params": {
6
+ "include_formats": false,
7
+ "include_chapters": true
8
+ }
9
+ },
10
+ "response": {
11
+ "source": "youtube_metadata",
12
+ "status": "done",
13
+ "results": [
14
+ {
15
+ "videoId": "dQw4w9WgXcQ",
16
+ "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
17
+ "description": "The official video for \u201cNever Gonna Give You Up\u201d by Rick Astley. \n\nNever: The Autobiography \ud83d\udcda OUT NOW! \nFollow this link to get your copy and listen to Rick\u2019s \u2018Never\u2019 playlist \u2764\ufe0f #RickAstleyNever\nhttps://linktr.ee/rickastleynever\n\n\u201cNever Gonna Give You Up\u201d was a global smash on its release in July 1987, topping the charts in 25 countries including Rick\u2019s native UK and the US Billboard Hot 100. It also won the Brit Award for Best single in 1988. Stock Aitken and Waterman wrote and produced the track which was the lead-off single and lead track from Rick\u2019s debut LP \u201cWhenever You Need Somebody\u201d. The album was itself a UK number one and would go on to sell over 15 million copies worldwide.\n\nThe legendary video was directed by Simon West \u2013 who later went on to make Hollywood blockbusters such as Con Air, Lara Croft \u2013 Tomb Raider and The Expendables 2. The video passed the 1bn YouTube views milestone on 28 July 2021.\n\nSubscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/YTSubID\n\nFollow Rick Astley:\nFacebook: https://RickAstley.lnk.to/FBFollowID \nTwitter: https://RickAstley.lnk.to/TwitterID \nInstagram: https://RickAstley.lnk.to/InstagramID \nWebsite: https://RickAstley.lnk.to/storeID \nTikTok: https://RickAstley.lnk.to/TikTokID\n\nListen to Rick Astley:\nSpotify: https://RickAstley.lnk.to/SpotifyID \nApple Music: https://RickAstley.lnk.to/AppleMusicID \nAmazon Music: https://RickAstley.lnk.to/AmazonMusicID \nDeezer: https://RickAstley.lnk.to/DeezerID \n\nLyrics:\nWe\u2019re no strangers to love\nYou know the rules and so do I\nA full commitment\u2019s what I\u2019m thinking of\nYou wouldn\u2019t get this from any other guy\n\nI just wanna tell you how I\u2019m feeling\nGotta make you understand\n\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\nWe\u2019ve known each other for so long\nYour heart\u2019s been aching but you\u2019re too shy to say it\nInside we both know what\u2019s been going on\nWe know the game and we\u2019re gonna play it\n\nAnd if you ask me how I\u2019m feeling\nDon\u2019t tell me you\u2019re too blind to see\n\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\n#RickAstley #NeverGonnaGiveYouUp #WheneverYouNeedSomebody #OfficialMusicVideo",
18
+ "channel": "Rick Astley",
19
+ "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
20
+ "channelUrl": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
21
+ "channelSubscriberCount": 4540000,
22
+ "viewCount": 1816253015,
23
+ "likeCount": 19394097,
24
+ "commentCount": 2400000,
25
+ "uploadDate": "2009-10-25T00:00:00Z",
26
+ "duration": 213,
27
+ "durationString": "3:33",
28
+ "thumbnails": [
29
+ {
30
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/3.jpg",
31
+ "width": null,
32
+ "height": null
33
+ },
34
+ {
35
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/3.webp",
36
+ "width": null,
37
+ "height": null
38
+ },
39
+ {
40
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/2.jpg",
41
+ "width": null,
42
+ "height": null
43
+ },
44
+ {
45
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/2.webp",
46
+ "width": null,
47
+ "height": null
48
+ },
49
+ {
50
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/1.jpg",
51
+ "width": null,
52
+ "height": null
53
+ },
54
+ {
55
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/1.webp",
56
+ "width": null,
57
+ "height": null
58
+ },
59
+ {
60
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/mq3.jpg",
61
+ "width": null,
62
+ "height": null
63
+ },
64
+ {
65
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/mq3.webp",
66
+ "width": null,
67
+ "height": null
68
+ },
69
+ {
70
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/mq2.jpg",
71
+ "width": null,
72
+ "height": null
73
+ },
74
+ {
75
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/mq2.webp",
76
+ "width": null,
77
+ "height": null
78
+ },
79
+ {
80
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/mq1.jpg",
81
+ "width": null,
82
+ "height": null
83
+ },
84
+ {
85
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/mq1.webp",
86
+ "width": null,
87
+ "height": null
88
+ },
89
+ {
90
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hq3.jpg",
91
+ "width": null,
92
+ "height": null
93
+ },
94
+ {
95
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/hq3.webp",
96
+ "width": null,
97
+ "height": null
98
+ },
99
+ {
100
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hq2.jpg",
101
+ "width": null,
102
+ "height": null
103
+ },
104
+ {
105
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/hq2.webp",
106
+ "width": null,
107
+ "height": null
108
+ },
109
+ {
110
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hq1.jpg",
111
+ "width": null,
112
+ "height": null
113
+ },
114
+ {
115
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/hq1.webp",
116
+ "width": null,
117
+ "height": null
118
+ },
119
+ {
120
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/sd3.jpg",
121
+ "width": null,
122
+ "height": null
123
+ },
124
+ {
125
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/sd3.webp",
126
+ "width": null,
127
+ "height": null
128
+ },
129
+ {
130
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/sd2.jpg",
131
+ "width": null,
132
+ "height": null
133
+ },
134
+ {
135
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/sd2.webp",
136
+ "width": null,
137
+ "height": null
138
+ },
139
+ {
140
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/sd1.jpg",
141
+ "width": null,
142
+ "height": null
143
+ },
144
+ {
145
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/sd1.webp",
146
+ "width": null,
147
+ "height": null
148
+ },
149
+ {
150
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg",
151
+ "width": null,
152
+ "height": null
153
+ },
154
+ {
155
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/default.webp",
156
+ "width": null,
157
+ "height": null
158
+ },
159
+ {
160
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/mqdefault.jpg",
161
+ "width": 320,
162
+ "height": 180
163
+ },
164
+ {
165
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/mqdefault.webp",
166
+ "width": null,
167
+ "height": null
168
+ },
169
+ {
170
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/0.jpg",
171
+ "width": null,
172
+ "height": null
173
+ },
174
+ {
175
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/0.webp",
176
+ "width": null,
177
+ "height": null
178
+ },
179
+ {
180
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
181
+ "width": null,
182
+ "height": null
183
+ },
184
+ {
185
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEfCKgBEF5IVfKriqkDEggBFQAAiEIYAXABwAEGuALzGA==&rs=AOn4CLAy5pvOfmmlRtbC9v1ptqnWgPympA",
186
+ "width": 168,
187
+ "height": 94
188
+ },
189
+ {
190
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEfCMQBEG5IVfKriqkDEggBFQAAiEIYAXABwAEGuALzGA==&rs=AOn4CLDnaw1sg9xedLybAaLCts8m3KNOlQ",
191
+ "width": 196,
192
+ "height": 110
193
+ },
194
+ {
195
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEgCPYBEIoBSFXyq4qpAxIIARUAAIhCGAFwAcABBrgC8xg=&rs=AOn4CLAz-h7jukeJwLXsm6EJZ_0FIhWWgw",
196
+ "width": 246,
197
+ "height": 138
198
+ },
199
+ {
200
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEgCNACELwBSFXyq4qpAxIIARUAAIhCGAFwAcABBrgC8xg=&rs=AOn4CLCqh65ZpY-1S9Y3vJeHWwXLcY0qUw",
201
+ "width": 336,
202
+ "height": 188
203
+ },
204
+ {
205
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/hqdefault.webp",
206
+ "width": null,
207
+ "height": null
208
+ },
209
+ {
210
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/sddefault.jpg",
211
+ "width": null,
212
+ "height": null
213
+ },
214
+ {
215
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/sddefault.webp",
216
+ "width": null,
217
+ "height": null
218
+ },
219
+ {
220
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hq720.jpg",
221
+ "width": 1280,
222
+ "height": 720
223
+ },
224
+ {
225
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/hq720.webp",
226
+ "width": null,
227
+ "height": null
228
+ },
229
+ {
230
+ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
231
+ "width": 1280,
232
+ "height": 720
233
+ },
234
+ {
235
+ "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/maxresdefault.webp",
236
+ "width": 1920,
237
+ "height": 1080
238
+ }
239
+ ],
240
+ "categories": [
241
+ "Music"
242
+ ],
243
+ "tags": [
244
+ "rick astley",
245
+ "Never Gonna Give You Up",
246
+ "nggyu",
247
+ "never gonna give you up lyrics",
248
+ "rick rolled",
249
+ "Rick Roll",
250
+ "rick astley official",
251
+ "rickrolled",
252
+ "Fortnite song",
253
+ "Fortnite event",
254
+ "Fortnite dance",
255
+ "fortnite never gonna give you up",
256
+ "rick roll",
257
+ "rickrolling",
258
+ "rick rolling",
259
+ "never gonna give you up",
260
+ "80s music",
261
+ "rick astley new",
262
+ "animated video",
263
+ "rickroll",
264
+ "meme songs",
265
+ "never gonna give u up lyrics",
266
+ "Rick Astley 2022",
267
+ "never gonna let you down",
268
+ "animated",
269
+ "rick rolls 2022",
270
+ "never gonna give you up karaoke"
271
+ ],
272
+ "ageLimit": 0,
273
+ "isLive": false,
274
+ "wasLive": false,
275
+ "hasTranscripts": true,
276
+ "transcriptLanguages": [
277
+ "fr",
278
+ "no",
279
+ "ab",
280
+ "id",
281
+ "ta",
282
+ "yi",
283
+ "es-419",
284
+ "be",
285
+ "ro",
286
+ "su",
287
+ "zu",
288
+ "ko",
289
+ "to",
290
+ "mk",
291
+ "az",
292
+ "om",
293
+ "dz",
294
+ "ml",
295
+ "gd",
296
+ "nl",
297
+ "sk",
298
+ "bho",
299
+ "ay",
300
+ "or",
301
+ "ceb",
302
+ "bs",
303
+ "new",
304
+ "gn",
305
+ "mn",
306
+ "mg",
307
+ "kha",
308
+ "haw",
309
+ "et",
310
+ "fy",
311
+ "gu",
312
+ "ht",
313
+ "ts",
314
+ "ca",
315
+ "ms",
316
+ "ur",
317
+ "uk",
318
+ "sw",
319
+ "af",
320
+ "tg",
321
+ "ba",
322
+ "oc",
323
+ "st",
324
+ "tr",
325
+ "fa",
326
+ "ny",
327
+ "lo",
328
+ "ti",
329
+ "fo",
330
+ "pa",
331
+ "co",
332
+ "ig",
333
+ "sl",
334
+ "ee",
335
+ "hy",
336
+ "kk",
337
+ "sv",
338
+ "cs",
339
+ "lt",
340
+ "tn",
341
+ "as",
342
+ "ky",
343
+ "ak",
344
+ "ja",
345
+ "eu",
346
+ "mt",
347
+ "de",
348
+ "ar",
349
+ "dv",
350
+ "el",
351
+ "pl",
352
+ "es",
353
+ "pt-BR",
354
+ "lua",
355
+ "vi",
356
+ "ka",
357
+ "sm",
358
+ "jv",
359
+ "os",
360
+ "bo",
361
+ "de-DE",
362
+ "sr",
363
+ "pam",
364
+ "war",
365
+ "sg",
366
+ "kri",
367
+ "ku",
368
+ "ps",
369
+ "xh",
370
+ "ug",
371
+ "lg",
372
+ "te",
373
+ "so",
374
+ "th",
375
+ "sa",
376
+ "iw",
377
+ "tt",
378
+ "zh-Hant",
379
+ "sq",
380
+ "hu",
381
+ "cy",
382
+ "da",
383
+ "yo",
384
+ "en-orig",
385
+ "qu",
386
+ "ss",
387
+ "am",
388
+ "it",
389
+ "bn",
390
+ "gl",
391
+ "kn",
392
+ "bg",
393
+ "ne",
394
+ "hi",
395
+ "my",
396
+ "is",
397
+ "hmn",
398
+ "kl",
399
+ "fil",
400
+ "en",
401
+ "lv",
402
+ "fj",
403
+ "sn",
404
+ "luo",
405
+ "iu",
406
+ "mi",
407
+ "br",
408
+ "km",
409
+ "sd",
410
+ "rn",
411
+ "pt",
412
+ "mfe",
413
+ "ru",
414
+ "si",
415
+ "ve",
416
+ "ha",
417
+ "pt-PT",
418
+ "mr",
419
+ "hr",
420
+ "uz",
421
+ "nso",
422
+ "zh-Hans",
423
+ "ln",
424
+ "gv",
425
+ "la",
426
+ "gaa",
427
+ "lb",
428
+ "tum",
429
+ "tk",
430
+ "crs",
431
+ "aa",
432
+ "fi",
433
+ "rw",
434
+ "eo",
435
+ "ga",
436
+ "wo"
437
+ ]
438
+ }
439
+ ],
440
+ "usage": {
441
+ "credits": 0.01
442
+ },
443
+ "created_at": "2026-09-16T07:45:41.114Z"
444
+ }
445
+ }
index.html CHANGED
@@ -1,19 +1,22 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
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,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additionalProperties": false,
3
+ "description": "YouTube metadata parameters.",
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
+ "include_chapters": {
11
+ "default": true,
12
+ "description": "Include available video chapters.",
13
+ "title": "Include Chapters",
14
+ "type": "boolean"
15
+ },
16
+ "include_formats": {
17
+ "default": true,
18
+ "description": "Include available format metadata.",
19
+ "title": "Include Formats",
20
+ "type": "boolean"
21
+ }
22
+ },
23
+ "required": [
24
+ "video_id"
25
+ ],
26
+ "title": "YouTubeMetadataInput",
27
+ "type": "object"
28
+ }
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,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "slug": "youtube-metadata-chapters-flashdata",
3
+ "title": "YouTube metadata and chapter inspection \u2014 FlashData",
4
+ "scenario": "Prepare a video research brief before reading a transcript or processing media. Inspect the title, channel, description and available chapters to choose the portions worth reviewing.",
5
+ "task": "Inspect a video's chapters and channel attribution for a research note.",
6
+ "input": {
7
+ "video_id": "FUfGcZ092b0",
8
+ "include_chapters": true,
9
+ "include_formats": false
10
+ },
11
+ "path": "results.0",
12
+ "fields": [
13
+ "videoId",
14
+ "title",
15
+ "channel",
16
+ "duration",
17
+ "chapters"
18
+ ],
19
+ "next": "Use available chapter timestamps to guide manual review. Preserve video ID and channel attribution alongside your notes.",
20
+ "limit": "Chapters exist only when supplied by the video. Counts, formats and other metadata can be unavailable; this does not fetch transcript text.",
21
+ "source": "youtube_metadata",
22
+ "repo_id": "flashdata-dev/youtube-metadata-chapters-flashdata"
23
+ }
tool.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import Tool
2
+
3
+
4
+ class FlashDataTool(Tool):
5
+ name = 'youtube_metadata'
6
+ description = 'Prepare a video research brief before reading a transcript or processing media. Inspect the title, channel, description and available chapters to choose the portions worth reviewing. Chapters exist only when supplied by the video. Counts, formats and other metadata can be unavailable; this does not fetch transcript text. Uses paid FlashData API credits. Never automatically retry an uncertain submission; check Jobs first.'
7
+ inputs = {'include_chapters': {'description': 'Include available video chapters. Default: True.',
8
+ 'nullable': True,
9
+ 'type': 'boolean'},
10
+ 'include_formats': {'description': 'Include available format metadata. Default: True.',
11
+ 'nullable': True,
12
+ 'type': 'boolean'},
13
+ 'video_id': {'description': '11-character YouTube video ID or a YouTube video URL.',
14
+ 'type': 'string'}}
15
+ output_type = 'object'
16
+
17
+ def forward(self, video_id: str, include_chapters: bool = True, include_formats: bool = True) -> dict:
18
+ from langchain_flashdata import FlashDataYouTubeMetadata
19
+ values = {'video_id': video_id, 'include_chapters': include_chapters, 'include_formats': include_formats}
20
+ return FlashDataYouTubeMetadata().invoke({key: value for key, value in values.items() if value is not None})