vidnavigator 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -23
- package/dist/index.d.ts +137 -64
- package/dist/index.js +127 -13
- package/dist/models/TikTok.d.ts +134 -0
- package/dist/models/TikTok.js +92 -1
- package/dist/models/Usage.d.ts +71 -0
- package/dist/models/Usage.js +70 -1
- package/package.json +1 -1
- package/src/index.ts +296 -88
- package/src/models/TikTok.ts +231 -0
- package/src/models/Usage.ts +127 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The official JavaScript/TypeScript SDK for the [VidNavigator Developer API](http
|
|
|
10
10
|
## Why VidNavigator?
|
|
11
11
|
|
|
12
12
|
- **Multi-platform transcription** — YouTube, Instagram Reels & carousel posts, TikTok, X/Twitter, Vimeo, Facebook, Dailymotion, Loom, and more.
|
|
13
|
-
- **Async TikTok profile scraping** —
|
|
13
|
+
- **Async TikTok profile scraping and keyword search** — collect public TikTok videos in the background, then read results via cursor pagination or a signed `download_url`.
|
|
14
14
|
- **Instagram carousel support** — select a specific video by index, or transcribe every video in a carousel post with one call.
|
|
15
15
|
- **AI-powered analysis** — get summaries, people mentioned, places, key subjects, and direct answers to questions about any video or audio.
|
|
16
16
|
- **Structured data extraction** — define a JSON schema and receive typed, structured fields extracted from any transcript (powered by LLMs).
|
|
@@ -67,10 +67,12 @@ const vn = new VidNavigatorClient({
|
|
|
67
67
|
|
|
68
68
|
## Examples
|
|
69
69
|
|
|
70
|
-
### 1.
|
|
70
|
+
### 1. Get a transcript (any platform)
|
|
71
|
+
|
|
72
|
+
There is a single `getTranscript` method that auto-detects the platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, and more) from the URL.
|
|
71
73
|
|
|
72
74
|
```ts
|
|
73
|
-
const { video_info, transcript } = await vn.
|
|
75
|
+
const { video_info, transcript } = await vn.getTranscript({
|
|
74
76
|
video_url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
|
75
77
|
language: 'en',
|
|
76
78
|
});
|
|
@@ -90,9 +92,11 @@ for (const seg of transcript.slice(0, 3)) {
|
|
|
90
92
|
|
|
91
93
|
Pass `transcript_text: true` to get the full transcript as a single plain-text string instead of segments.
|
|
92
94
|
|
|
95
|
+
> **Deprecated:** `getYouTubeTranscript()` still works but is deprecated — it now forwards to `getTranscript()` and emits a deprecation warning. Use `getTranscript()` instead.
|
|
96
|
+
|
|
93
97
|
### 2. Instagram Reel / TikTok / X / Vimeo
|
|
94
98
|
|
|
95
|
-
For most non-
|
|
99
|
+
For most non-Instagram platforms, you can use either `getTranscript` (fast, caption-based) or `transcribeVideo` (speech-to-text). **Note:** Instagram only supports `transcribeVideo`.
|
|
96
100
|
|
|
97
101
|
```ts
|
|
98
102
|
// Instagram Reel (speech-to-text only)
|
|
@@ -216,7 +220,33 @@ for (const video of videos) {
|
|
|
216
220
|
|
|
217
221
|
For large profiles, process videos sequentially or with a small concurrency limit so you do not exhaust credits or hit rate limits.
|
|
218
222
|
|
|
219
|
-
### 4.
|
|
223
|
+
### 4. TikTok keyword search (async)
|
|
224
|
+
|
|
225
|
+
TikTok keyword search follows the same async pattern as profile scraping: submit a search, then poll by `task_id` until results are ready.
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
const submitted = await vn.submitTikTokSearch({
|
|
229
|
+
query: 'ai tools',
|
|
230
|
+
max_results: 100,
|
|
231
|
+
parallel_search_slices: 2,
|
|
232
|
+
after_datetime: '2024-01-01',
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
let task = await vn.getTikTokSearch(submitted.task_id, { limit: 50 });
|
|
236
|
+
|
|
237
|
+
while (task.task_status === 'processing') {
|
|
238
|
+
await sleep(5000);
|
|
239
|
+
task = await vn.getTikTokSearch(submitted.task_id, { limit: 50 });
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
for (const result of task.results) {
|
|
243
|
+
console.log(result.published_at?.toISOString(), result.url, result.stats?.views);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Use `parallel_search_slices` from `2` to `4` when you need broader collection than TikTok's natural single-chain cap. Billing scales with the number of slices, so keep it at `1` unless you need the wider result set.
|
|
248
|
+
|
|
249
|
+
### 5. Instagram carousel posts (multiple videos)
|
|
220
250
|
|
|
221
251
|
Instagram carousel posts can contain multiple videos. You can select a specific video by index, or transcribe them all at once:
|
|
222
252
|
|
|
@@ -249,7 +279,7 @@ if ('carousel_info' in all) {
|
|
|
249
279
|
}
|
|
250
280
|
```
|
|
251
281
|
|
|
252
|
-
###
|
|
282
|
+
### 6. Upload and analyze a local file
|
|
253
283
|
|
|
254
284
|
Upload audio or video files for transcription, analysis, and search. Supported formats: mp4, webm, mov, avi, wmv, flv, mkv, m4a, mp3, mpeg, mpga, wav.
|
|
255
285
|
|
|
@@ -283,9 +313,9 @@ console.log(transcript_analysis.query_answer?.answer);
|
|
|
283
313
|
// "Three action items were discussed: 1) Finalize the hiring..."
|
|
284
314
|
```
|
|
285
315
|
|
|
286
|
-
###
|
|
316
|
+
### 7. Extract structured data
|
|
287
317
|
|
|
288
|
-
Define a schema and get back clean, structured data extracted from any video or file transcript. Powered by LLMs with
|
|
318
|
+
Define a schema and get back clean, structured data extracted from any video or file transcript. Powered by LLMs with per-call usage tracking (see [Per-call usage](#per-call-usage)).
|
|
289
319
|
|
|
290
320
|
```ts
|
|
291
321
|
const { data, usage } = await vn.extractVideoData({
|
|
@@ -309,7 +339,9 @@ console.log(data);
|
|
|
309
339
|
// key_quotes: ["Never gonna give you up", "Never gonna let you down", ...]
|
|
310
340
|
// }
|
|
311
341
|
|
|
312
|
-
|
|
342
|
+
// LLM token counts live under the analysis_request charge:
|
|
343
|
+
console.log(usage?.analysis_tokens?.total_tokens); // 847
|
|
344
|
+
console.log(usage?.total_credits); // 2
|
|
313
345
|
```
|
|
314
346
|
|
|
315
347
|
Also works on uploaded files:
|
|
@@ -326,16 +358,29 @@ const { data } = await vn.extractFileData({
|
|
|
326
358
|
});
|
|
327
359
|
```
|
|
328
360
|
|
|
361
|
+
For larger schemas, pass a JSON or YAML schema file with multipart form-data:
|
|
362
|
+
|
|
363
|
+
```ts
|
|
364
|
+
const { data } = await vn.extractVideoData({
|
|
365
|
+
video_url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
|
366
|
+
schemaFilePath: './schemas/video-extraction.yaml',
|
|
367
|
+
include_usage: true,
|
|
368
|
+
});
|
|
369
|
+
```
|
|
370
|
+
|
|
329
371
|
**Supported schema types:** `String`, `Number`, `Boolean`, `Integer`, `Object`, `Array`, `Enum`
|
|
330
372
|
|
|
331
|
-
###
|
|
373
|
+
### 8. Semantic search
|
|
332
374
|
|
|
333
375
|
Search YouTube videos and uploaded files with AI-powered ranking/reranking.
|
|
334
376
|
|
|
335
377
|
```ts
|
|
336
378
|
// Search YouTube videos
|
|
337
|
-
const videoResults = await vn.
|
|
379
|
+
const videoResults = await vn.searchYouTube({
|
|
338
380
|
query: 'how to deploy a Node.js app',
|
|
381
|
+
focus: 'relevance', // 'relevance' (default) | 'popularity' | 'brevity'
|
|
382
|
+
max_results: 5, // caps how many candidates are analysed (and the cost)
|
|
383
|
+
include_usage: true, // attach a per-call usage block
|
|
339
384
|
});
|
|
340
385
|
|
|
341
386
|
console.log(`Found ${videoResults.total_found} results`);
|
|
@@ -344,6 +389,11 @@ for (const r of videoResults.results) {
|
|
|
344
389
|
console.log(` ${r.transcript_summary}`);
|
|
345
390
|
}
|
|
346
391
|
|
|
392
|
+
// If credits run out mid-search, a partial result is returned instead of throwing:
|
|
393
|
+
if (videoResults.status === 'partial') {
|
|
394
|
+
console.log('Partial results:', videoResults.error_code); // "insufficient_credits_video_search"
|
|
395
|
+
}
|
|
396
|
+
|
|
347
397
|
// Search uploaded files — optionally scoped to a namespace
|
|
348
398
|
const fileResults = await vn.searchFiles({
|
|
349
399
|
query: 'quarterly revenue discussion',
|
|
@@ -357,7 +407,9 @@ for (const r of fileResults.results) {
|
|
|
357
407
|
}
|
|
358
408
|
```
|
|
359
409
|
|
|
360
|
-
|
|
410
|
+
> **Deprecated:** `searchVideos()` still works but is deprecated — it now forwards to `searchYouTube()` (the `/search/video` endpoint moved to `/youtube/search`) and emits a deprecation warning. Use `searchYouTube()` instead.
|
|
411
|
+
|
|
412
|
+
### 9. Organize files with namespaces
|
|
361
413
|
|
|
362
414
|
```ts
|
|
363
415
|
// Create a namespace
|
|
@@ -377,7 +429,7 @@ const files = await vn.getFiles({ namespace_id: ns.id });
|
|
|
377
429
|
const all = await vn.getNamespaces();
|
|
378
430
|
```
|
|
379
431
|
|
|
380
|
-
###
|
|
432
|
+
### 10. Usage and credits
|
|
381
433
|
|
|
382
434
|
```ts
|
|
383
435
|
const usage = await vn.getUsage();
|
|
@@ -389,6 +441,36 @@ console.log(`Storage: ${usage.storage.used_formatted} / ${usage.storage.limit_fo
|
|
|
389
441
|
console.log(`Channels indexed: ${usage.channelsIndexed.used} / ${usage.channelsIndexed.limit}`);
|
|
390
442
|
```
|
|
391
443
|
|
|
444
|
+
### Per-call usage
|
|
445
|
+
|
|
446
|
+
Pass `include_usage: true` to most endpoints (`getTranscript`, `transcribeVideo`, `analyzeVideo`, `analyzeFile`, `extractVideoData`, `extractFileData`, `searchYouTube`, `searchFiles`) to receive a `usage` block describing exactly what the request cost. For the TikTok pollers (`getTikTokProfileScrape`, `getTikTokSearch`), pass `include_usage: true` in the options object — usage is populated once `task_status === 'completed'`.
|
|
447
|
+
|
|
448
|
+
The `usage` field is a `UsageBlock`:
|
|
449
|
+
|
|
450
|
+
```ts
|
|
451
|
+
const { usage } = await vn.getTranscript({
|
|
452
|
+
video_url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
|
453
|
+
include_usage: true,
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
if (usage) {
|
|
457
|
+
console.log(usage.total_credits); // net credits deducted by this request
|
|
458
|
+
console.log(usage.credits_remaining_after); // balance after the request (when provided)
|
|
459
|
+
|
|
460
|
+
// Every meter that fired, consolidated to one entry per service_type:
|
|
461
|
+
for (const charge of usage.charges) {
|
|
462
|
+
console.log(charge.service_type, charge.quantity, charge.credits, charge.waived);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Convenience accessors:
|
|
466
|
+
const residential = usage.charge_for('residential_request'); // matching charge entry or undefined
|
|
467
|
+
const tokens = usage.analysis_tokens; // { prompt_tokens, completion_tokens, total_tokens }
|
|
468
|
+
console.log(tokens?.total_tokens);
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
`service_type` is one of: `standard_request`, `residential_request`, `transcription_hour`, `analysis_request`, `search_request`, `scene_analysis_hour`. LLM token counts (for `/extract/*`, `/analyze/*`, and `/youtube/search`) are nested inside the `analysis_request` charge — read them via the `analysis_tokens` accessor rather than expecting flat `total_tokens`. When a charge is waived via a cache-hit sponsorship, the entry carries `waived: true` + `credits_saved`, and the block carries a top-level `waived.credits_saved`.
|
|
473
|
+
|
|
392
474
|
---
|
|
393
475
|
|
|
394
476
|
## API Reference
|
|
@@ -399,20 +481,22 @@ All methods return a `Promise`. Responses are automatically parsed into typed mo
|
|
|
399
481
|
|
|
400
482
|
| Method | Description |
|
|
401
483
|
|--------|-------------|
|
|
402
|
-
| `
|
|
403
|
-
| `
|
|
484
|
+
| `getTranscript(payload)` | Get a transcript for any supported video; auto-detects the platform from the URL (note: Instagram uses `transcribeVideo`) |
|
|
485
|
+
| `getYouTubeTranscript(payload)` | **Deprecated** — forwards to `getTranscript()` |
|
|
404
486
|
| `transcribeVideo(payload)` | Speech-to-text transcription via AI models; supports Instagram carousel with `all_videos` |
|
|
405
487
|
|
|
406
|
-
**Common options:** `video_url`, `language`, `metadata_only`, `fallback_to_metadata`, `transcript_text`
|
|
488
|
+
**Common options:** `video_url`, `language`, `metadata_only`, `fallback_to_metadata`, `transcript_text`, `include_usage`
|
|
407
489
|
|
|
408
490
|
### TikTok
|
|
409
491
|
|
|
410
492
|
| Method | Description |
|
|
411
493
|
|--------|-------------|
|
|
412
494
|
| `submitTikTokProfileScrape(payload)` | Start an async public TikTok profile scrape. Returns a `task_id` immediately |
|
|
413
|
-
| `getTikTokProfileScrape(task_id, query?)` | Poll task status and retrieve a page of videos. Options: `cursor`, `limit` |
|
|
495
|
+
| `getTikTokProfileScrape(task_id, query?)` | Poll task status and retrieve a page of videos. Options: `cursor`, `limit`, `include_usage` |
|
|
496
|
+
| `submitTikTokSearch(payload)` | Start an async TikTok keyword search. Returns a `task_id` immediately |
|
|
497
|
+
| `getTikTokSearch(task_id, query?)` | Poll search status and retrieve a page of results. Options: `cursor`, `limit`, `include_usage` |
|
|
414
498
|
|
|
415
|
-
Completed tasks include `videos
|
|
499
|
+
Completed profile tasks include `videos`; completed search tasks include `results`. Both include `pagination`, optional `stats`, and an optional short-lived `download_url` for retrieving the whole result as JSON. Datetime filters use `after_datetime` and `before_datetime`, each accepting either `YYYY-MM-DD` or full ISO datetime strings with timezone; TikTok `published_at` values are parsed into JavaScript `Date` objects, and numeric counters such as `views` and `likes` are normalized to integers.
|
|
416
500
|
|
|
417
501
|
### Files
|
|
418
502
|
|
|
@@ -460,7 +544,7 @@ Returns `transcript_analysis` containing:
|
|
|
460
544
|
| `extractVideoData(payload)` | Extract structured data from an online video transcript |
|
|
461
545
|
| `extractFileData(payload)` | Extract structured data from an uploaded file transcript |
|
|
462
546
|
|
|
463
|
-
**Options:** `schema` (required), `what_to_extract` (optional guidance), `include_usage` (
|
|
547
|
+
**Options:** `schema` (required for JSON requests), `schemaFilePath` (JSON/YAML schema file via multipart form-data), `what_to_extract` (optional guidance), `include_usage` (attach a per-call `UsageBlock`; read LLM tokens via `usage.analysis_tokens`)
|
|
464
548
|
|
|
465
549
|
**Schema field types:** `String`, `Number`, `Boolean`, `Integer`, `Object`, `Array`, `Enum`
|
|
466
550
|
|
|
@@ -468,10 +552,13 @@ Returns `transcript_analysis` containing:
|
|
|
468
552
|
|
|
469
553
|
| Method | Description |
|
|
470
554
|
|--------|-------------|
|
|
471
|
-
| `
|
|
555
|
+
| `searchYouTube(payload)` | Search YouTube videos with AI ranking/reranking |
|
|
556
|
+
| `searchVideos(payload)` | **Deprecated** — forwards to `searchYouTube()` |
|
|
472
557
|
| `searchFiles(payload)` | Semantic search across uploaded files, with optional `namespace_ids` scope |
|
|
473
558
|
|
|
474
|
-
|
|
559
|
+
**`searchYouTube` options:** `query` (required), `use_enhanced_search` (default `true`), `start_year`, `end_year`, `focus` (`'relevance'` (default) \| `'popularity'` \| `'brevity'`), `duration`, `max_results` (caps candidates analysed & cost; defaults to your plan ceiling), `include_usage`.
|
|
560
|
+
|
|
561
|
+
Results include `relevance_score`, `transcript_summary`, `people`, `places`, `key_subjects`, `query_answer`, `timestamps`, and `relevant_text`. If credits run out mid-search the API returns a partial result: `searchYouTube` surfaces it as `{ status: 'partial', error_code: 'insufficient_credits_video_search', results, usage? }` instead of throwing.
|
|
475
562
|
|
|
476
563
|
### System
|
|
477
564
|
|
|
@@ -531,13 +618,18 @@ All API responses are parsed into typed classes with static `fromJSON()` constru
|
|
|
531
618
|
| `NamespaceRef` | Lightweight `{ id, name }` reference embedded in file and search responses |
|
|
532
619
|
| `VideoSearchResult` | Extends `VideoInfo` with `relevance_score`, `transcript_summary`, search metadata |
|
|
533
620
|
| `FileSearchResult` | Extends `FileInfo` with `relevance_score`, `query_answer`, timestamps, signed URL |
|
|
534
|
-
| `UsageData` |
|
|
535
|
-
| `
|
|
621
|
+
| `UsageData` | Account-level usage from `getUsage()`: credits info, per-service activity counts, storage metrics, subscription details |
|
|
622
|
+
| `UsageBlock` | Per-call usage returned when `include_usage: true`: `charges[]`, `total_credits`, `credits_remaining_after`, `waived`, plus `charge_for(service_type)` and `analysis_tokens` accessors |
|
|
623
|
+
| `UsageCharge` | A single consolidated meter charge: `service_type`, `quantity`, `credits`, `waived`, `credits_saved`, and (on `analysis_request`) `tokens` |
|
|
624
|
+
| `ExtractionTokenUsage` | Legacy flat token usage (`prompt_tokens`, `completion_tokens`, `total_tokens`) — extraction now returns a `UsageBlock`; prefer `usage.analysis_tokens` |
|
|
536
625
|
| `CarouselInfo` | Carousel summary: total items, video/image count, transcribed count, total duration |
|
|
537
626
|
| `CarouselVideoResult` | Per-video result in a carousel: index, status, video info, transcript |
|
|
538
627
|
| `TikTokProfileScrapeSubmission` | Async scrape submission: `task_id`, status, profile URL, expiry |
|
|
539
628
|
| `TikTokProfileTask` | TikTok profile scrape task with status, profile metadata, videos, pagination, `download_url` |
|
|
540
629
|
| `TikTokVideo` | Public TikTok video metadata returned by profile scraping, including `published_at` as a `Date` and integer counters |
|
|
630
|
+
| `TikTokSearchSubmission` | Async TikTok keyword search submission: `task_id`, query, slice count, expiry |
|
|
631
|
+
| `TikTokSearchTask` | TikTok keyword search task with status, results, pagination, `download_url` |
|
|
632
|
+
| `TikTokSearchResult` | Normalized TikTok keyword result, including `published_at` as a `Date` and integer counters |
|
|
541
633
|
| `TweetStatement` | Structured X/Twitter claim analysis, topics, entities, tone, intent, and source text |
|
|
542
634
|
|
|
543
635
|
## Links
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { VideoInfo, TranscriptOutput, FileInfo, AnalysisResult, VideoSearchResult, FileSearchResult, UsageData, Namespace, NamespaceRef, ExtractionSchema,
|
|
2
|
+
import { VideoInfo, TranscriptOutput, FileInfo, AnalysisResult, VideoSearchResult, FileSearchResult, UsageData, Namespace, NamespaceRef, ExtractionSchema, UsageBlock, CarouselInfo, CarouselVideoResult, TikTokProfileScrapeRequest, TikTokProfileScrapeSubmission, TikTokProfileTask, TikTokSearchRequest, TikTokSearchSubmission, TikTokSearchTask, TweetStatement } from './models';
|
|
3
3
|
export * from './models';
|
|
4
4
|
export * from './errors';
|
|
5
5
|
/** SDK version (keep in sync with package.json) */
|
|
6
|
-
export declare const SDK_VERSION = "1.0.
|
|
6
|
+
export declare const SDK_VERSION = "1.0.5";
|
|
7
7
|
export interface SDKConfig {
|
|
8
8
|
apiKey: string;
|
|
9
9
|
baseURL?: string;
|
|
@@ -15,19 +15,28 @@ export type TranscriptRequestPayload = {
|
|
|
15
15
|
metadata_only?: boolean;
|
|
16
16
|
fallback_to_metadata?: boolean;
|
|
17
17
|
transcript_text?: boolean;
|
|
18
|
+
include_usage?: boolean;
|
|
18
19
|
};
|
|
19
20
|
export type TranscribeVideoPayload = {
|
|
20
21
|
video_url: string;
|
|
21
22
|
transcript_text?: boolean;
|
|
22
23
|
all_videos?: boolean;
|
|
24
|
+
include_usage?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type TranscriptResult = {
|
|
27
|
+
video_info: VideoInfo;
|
|
28
|
+
transcript: TranscriptOutput;
|
|
29
|
+
usage?: UsageBlock;
|
|
23
30
|
};
|
|
24
31
|
export type TranscribeVideoSingleResult = {
|
|
25
32
|
video_info: VideoInfo;
|
|
26
33
|
transcript: TranscriptOutput;
|
|
34
|
+
usage?: UsageBlock;
|
|
27
35
|
};
|
|
28
36
|
export type TranscribeVideoCarouselResult = {
|
|
29
37
|
carousel_info: CarouselInfo;
|
|
30
38
|
videos: CarouselVideoResult[];
|
|
39
|
+
usage?: UsageBlock;
|
|
31
40
|
};
|
|
32
41
|
export type TranscribeVideoResult = TranscribeVideoSingleResult | TranscribeVideoCarouselResult;
|
|
33
42
|
export type UploadFileSuccessResult = {
|
|
@@ -52,26 +61,123 @@ export interface ExtractDataResult {
|
|
|
52
61
|
data: Record<string, unknown>;
|
|
53
62
|
video_info?: VideoInfo;
|
|
54
63
|
file_info?: FileInfo;
|
|
55
|
-
usage?:
|
|
64
|
+
usage?: UsageBlock;
|
|
56
65
|
}
|
|
66
|
+
export type YouTubeSearchFocus = 'relevance' | 'popularity' | 'brevity';
|
|
67
|
+
export type SearchYouTubePayload = {
|
|
68
|
+
query: string;
|
|
69
|
+
use_enhanced_search?: boolean;
|
|
70
|
+
start_year?: number;
|
|
71
|
+
end_year?: number;
|
|
72
|
+
focus?: YouTubeSearchFocus;
|
|
73
|
+
duration?: number;
|
|
74
|
+
max_results?: number;
|
|
75
|
+
include_usage?: boolean;
|
|
76
|
+
};
|
|
77
|
+
export type SearchYouTubeResult = {
|
|
78
|
+
results: VideoSearchResult[];
|
|
79
|
+
query: string;
|
|
80
|
+
total_found: number;
|
|
81
|
+
explanation?: string;
|
|
82
|
+
usage?: UsageBlock;
|
|
83
|
+
/** Present when a 402 partial-results response is returned. */
|
|
84
|
+
status?: 'success' | 'partial';
|
|
85
|
+
/** Present on partial results (e.g. `insufficient_credits_video_search`). */
|
|
86
|
+
error_code?: string;
|
|
87
|
+
};
|
|
88
|
+
export type SearchFilesPayload = {
|
|
89
|
+
query: string;
|
|
90
|
+
namespace_ids?: string[];
|
|
91
|
+
include_usage?: boolean;
|
|
92
|
+
};
|
|
93
|
+
export type SearchFilesResult = {
|
|
94
|
+
results: FileSearchResult[];
|
|
95
|
+
query: string;
|
|
96
|
+
total_found: number;
|
|
97
|
+
explanation?: string;
|
|
98
|
+
usage?: UsageBlock;
|
|
99
|
+
};
|
|
100
|
+
export type AnalyzeVideoPayload = {
|
|
101
|
+
video_url: string;
|
|
102
|
+
query?: string;
|
|
103
|
+
transcript_text?: boolean;
|
|
104
|
+
include_usage?: boolean;
|
|
105
|
+
};
|
|
106
|
+
export type AnalyzeFilePayload = {
|
|
107
|
+
file_id: string;
|
|
108
|
+
query?: string;
|
|
109
|
+
transcript_text?: boolean;
|
|
110
|
+
include_usage?: boolean;
|
|
111
|
+
};
|
|
112
|
+
export type AnalyzeVideoResult = {
|
|
113
|
+
video_info: VideoInfo;
|
|
114
|
+
transcript: TranscriptOutput;
|
|
115
|
+
transcript_analysis: AnalysisResult;
|
|
116
|
+
usage?: UsageBlock;
|
|
117
|
+
};
|
|
118
|
+
export type AnalyzeFileResult = {
|
|
119
|
+
file_info: FileInfo;
|
|
120
|
+
transcript: TranscriptOutput;
|
|
121
|
+
transcript_analysis: AnalysisResult;
|
|
122
|
+
usage?: UsageBlock;
|
|
123
|
+
};
|
|
124
|
+
export type ExtractVideoDataPayload = {
|
|
125
|
+
video_url: string;
|
|
126
|
+
schema: ExtractionSchema;
|
|
127
|
+
what_to_extract?: string;
|
|
128
|
+
transcribe?: boolean;
|
|
129
|
+
include_usage?: boolean;
|
|
130
|
+
};
|
|
131
|
+
export type ExtractVideoDataMultipartPayload = {
|
|
132
|
+
video_url: string;
|
|
133
|
+
/** Path to a JSON or YAML schema file. The API accepts either a raw schema or a full extraction request object. */
|
|
134
|
+
schemaFilePath: string;
|
|
135
|
+
what_to_extract?: string;
|
|
136
|
+
transcribe?: boolean;
|
|
137
|
+
include_usage?: boolean;
|
|
138
|
+
};
|
|
139
|
+
export type ExtractFileDataPayload = {
|
|
140
|
+
file_id: string;
|
|
141
|
+
schema: ExtractionSchema;
|
|
142
|
+
what_to_extract?: string;
|
|
143
|
+
include_usage?: boolean;
|
|
144
|
+
};
|
|
145
|
+
export type ExtractFileDataMultipartPayload = {
|
|
146
|
+
file_id: string;
|
|
147
|
+
/** Path to a JSON or YAML schema file. The API accepts either a raw schema or a full extraction request object. */
|
|
148
|
+
schemaFilePath: string;
|
|
149
|
+
what_to_extract?: string;
|
|
150
|
+
include_usage?: boolean;
|
|
151
|
+
};
|
|
57
152
|
export declare class VidNavigatorClient {
|
|
58
153
|
private client;
|
|
59
154
|
constructor(config: SDKConfig);
|
|
60
155
|
private request;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Get a transcript for any supported video. The endpoint auto-detects the
|
|
158
|
+
* platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, etc.)
|
|
159
|
+
* from `video_url`. For Instagram, use {@link VidNavigatorClient.transcribeVideo}.
|
|
160
|
+
*/
|
|
161
|
+
getTranscript(payload: TranscriptRequestPayload): Promise<TranscriptResult>;
|
|
162
|
+
/**
|
|
163
|
+
* @deprecated There is now a single `/transcript` endpoint that auto-detects the
|
|
164
|
+
* platform. Use {@link VidNavigatorClient.getTranscript} instead. This alias
|
|
165
|
+
* forwards to `getTranscript` and will be removed in a future release.
|
|
166
|
+
*/
|
|
167
|
+
getYouTubeTranscript(payload: TranscriptRequestPayload): Promise<TranscriptResult>;
|
|
69
168
|
transcribeVideo(payload: TranscribeVideoPayload): Promise<TranscribeVideoResult>;
|
|
70
169
|
submitTikTokProfileScrape(payload: TikTokProfileScrapeRequest): Promise<TikTokProfileScrapeSubmission>;
|
|
71
170
|
getTikTokProfileScrape(task_id: string, query?: {
|
|
72
171
|
cursor?: string;
|
|
73
172
|
limit?: number;
|
|
173
|
+
include_usage?: boolean;
|
|
74
174
|
}): Promise<TikTokProfileTask>;
|
|
175
|
+
submitTikTokSearch(payload: TikTokSearchRequest): Promise<TikTokSearchSubmission>;
|
|
176
|
+
getTikTokSearch(task_id: string, query?: {
|
|
177
|
+
cursor?: string;
|
|
178
|
+
limit?: number;
|
|
179
|
+
include_usage?: boolean;
|
|
180
|
+
}): Promise<TikTokSearchTask>;
|
|
75
181
|
getFiles(query?: {
|
|
76
182
|
limit?: number;
|
|
77
183
|
offset?: number;
|
|
@@ -134,62 +240,29 @@ export declare class VidNavigatorClient {
|
|
|
134
240
|
namespace_ids: string[];
|
|
135
241
|
namespaces: NamespaceRef[];
|
|
136
242
|
}>;
|
|
137
|
-
analyzeVideo(payload:
|
|
138
|
-
|
|
139
|
-
query?: string;
|
|
140
|
-
transcript_text?: boolean;
|
|
141
|
-
}): Promise<{
|
|
142
|
-
video_info: VideoInfo;
|
|
143
|
-
transcript: TranscriptOutput;
|
|
144
|
-
transcript_analysis: AnalysisResult;
|
|
145
|
-
}>;
|
|
146
|
-
analyzeFile(payload: {
|
|
147
|
-
file_id: string;
|
|
148
|
-
query?: string;
|
|
149
|
-
transcript_text?: boolean;
|
|
150
|
-
}): Promise<{
|
|
151
|
-
file_info: FileInfo;
|
|
152
|
-
transcript: TranscriptOutput;
|
|
153
|
-
transcript_analysis: AnalysisResult;
|
|
154
|
-
}>;
|
|
243
|
+
analyzeVideo(payload: AnalyzeVideoPayload): Promise<AnalyzeVideoResult>;
|
|
244
|
+
analyzeFile(payload: AnalyzeFilePayload): Promise<AnalyzeFileResult>;
|
|
155
245
|
getTweetStatement(payload: {
|
|
156
246
|
tweet_id: string;
|
|
157
247
|
}): Promise<TweetStatement>;
|
|
158
|
-
extractVideoData(payload:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
focus?: 'relevance' | 'popularity' | 'brevity';
|
|
177
|
-
duration?: number;
|
|
178
|
-
}): Promise<{
|
|
179
|
-
results: VideoSearchResult[];
|
|
180
|
-
query: string;
|
|
181
|
-
total_found: number;
|
|
182
|
-
explanation?: string;
|
|
183
|
-
}>;
|
|
184
|
-
searchFiles(payload: {
|
|
185
|
-
query: string;
|
|
186
|
-
namespace_ids?: string[];
|
|
187
|
-
}): Promise<{
|
|
188
|
-
results: FileSearchResult[];
|
|
189
|
-
query: string;
|
|
190
|
-
total_found: number;
|
|
191
|
-
explanation?: string;
|
|
192
|
-
}>;
|
|
248
|
+
extractVideoData(payload: ExtractVideoDataPayload | ExtractVideoDataMultipartPayload): Promise<ExtractDataResult>;
|
|
249
|
+
extractFileData(payload: ExtractFileDataPayload | ExtractFileDataMultipartPayload): Promise<ExtractDataResult>;
|
|
250
|
+
/**
|
|
251
|
+
* Search YouTube for videos with AI analysis and ranking.
|
|
252
|
+
*
|
|
253
|
+
* If the account runs out of `residential_request` credits mid-search, the API
|
|
254
|
+
* returns HTTP 402 with `status: "partial"` and the videos analysed so far. The
|
|
255
|
+
* SDK surfaces that partial payload (results, `status: "partial"`, `error_code`,
|
|
256
|
+
* and `usage` when requested) instead of throwing.
|
|
257
|
+
*/
|
|
258
|
+
searchYouTube(payload: SearchYouTubePayload): Promise<SearchYouTubeResult>;
|
|
259
|
+
/**
|
|
260
|
+
* @deprecated `/search/video` moved to `/youtube/search`. Use
|
|
261
|
+
* {@link VidNavigatorClient.searchYouTube} instead. This alias forwards to
|
|
262
|
+
* `searchYouTube` and will be removed in a future release.
|
|
263
|
+
*/
|
|
264
|
+
searchVideos(payload: SearchYouTubePayload): Promise<SearchYouTubeResult>;
|
|
265
|
+
searchFiles(payload: SearchFilesPayload): Promise<SearchFilesResult>;
|
|
193
266
|
getUsage(): Promise<UsageData>;
|
|
194
267
|
healthCheck(): Promise<{
|
|
195
268
|
status?: string;
|