Skip to content

Commit ce952b5

Browse files
fix: add types
1 parent b129a84 commit ce952b5

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

definitions/vite-supadata-runner/worker/userRoutes.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import { Hono } from "hono";
22
import {
3-
Crawl,
4-
CrawlJob,
5-
JobResult,
63
Map,
74
Scrape,
85
Supadata,
96
Transcript,
10-
TranscriptOrJobId,
11-
YoutubeChannel,
12-
YoutubePlaylist,
13-
YoutubeVideo,
7+
type TranscriptOrJobId,
8+
type YoutubeVideo,
149
} from '@supadata/js';
1510

1611
async function getUserAPIKey(c: any) {
@@ -45,14 +40,14 @@ export function userRoutes(app: Hono<{ Bindings: any }>) {
4540
apiKey,
4641
});
4742

48-
const transcriptResult = await supadata.transcript({
43+
const res: TranscriptOrJobId = await supadata.transcript({
4944
url: e.url,
5045
lang: 'en', // optional
5146
text: true, // optional: return plain text instead of timestamped chunks
5247
mode: 'auto', // optional: 'native', 'auto', or 'generate'
5348
});
5449

55-
return c.json({ success: true, data: transcriptResult });
50+
return c.json({ success: true, data: res });
5651
} catch (error: any) {
5752
console.error('Supdata routing error:', error);
5853
return c.json({
@@ -77,11 +72,11 @@ export function userRoutes(app: Hono<{ Bindings: any }>) {
7772
apiKey,
7873
});
7974

80-
const transcriptResult: Transcript = await supadata.youtube.transcript({
75+
const res: Transcript = await supadata.youtube.transcript({
8176
url: e.url,
8277
});
8378

84-
return c.json({ success: true, data: transcriptResult });
79+
return c.json({ success: true, data: res });
8580
} catch (error: any) {
8681
console.error('Supdata routing error:', error);
8782
return c.json({
@@ -136,7 +131,7 @@ export function userRoutes(app: Hono<{ Bindings: any }>) {
136131
apiKey,
137132
});
138133

139-
const res = await supadata.youtube.video({
134+
const res: YoutubeVideo = await supadata.youtube.video({
140135
id: e.videoId,
141136
});
142137

0 commit comments

Comments
 (0)