vidnavigator 1.0.1 → 1.0.3

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 CHANGED
@@ -10,10 +10,11 @@ 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** — scrape public profile videos in the background, then read results via cursor pagination or a signed `download_url`.
13
14
  - **Instagram carousel support** — select a specific video by index, or transcribe every video in a carousel post with one call.
14
15
  - **AI-powered analysis** — get summaries, people mentioned, places, key subjects, and direct answers to questions about any video or audio.
15
16
  - **Structured data extraction** — define a JSON schema and receive typed, structured fields extracted from any transcript (powered by LLMs).
16
- - **Semantic search** — vector-based search with AI reranking across your indexed YouTube channels and uploaded file libraries.
17
+ - **AI search and reranking** — YouTube search and file search with AI ranking/reranking and rich result metadata.
17
18
  - **File management with namespaces** — upload audio/video files, organize them into namespaces, and scope searches and analysis by folder.
18
19
  - **Full TypeScript support** — rich types, autocompletion, and compile-time safety out of the box.
19
20
  - **Comprehensive error handling** — dedicated error classes for every API error code (`AuthenticationError`, `RateLimitExceededError`, `GeoRestrictedError`, and more).
@@ -112,7 +113,110 @@ const tweet = await vn.getTranscript({
112
113
  });
113
114
  ```
114
115
 
115
- ### 3. Instagram carousel posts (multiple videos)
116
+ ### 3. TikTok profile scraping (async)
117
+
118
+ TikTok profile scraping is asynchronous. First submit the profile URL, then poll the task until `task_status` is no longer `processing`. Once complete, you can either page through results with `getTikTokProfileScrape()` or fetch the full JSON from `download_url`.
119
+
120
+ ```ts
121
+ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
122
+
123
+ const submitted = await vn.submitTikTokProfileScrape({
124
+ profile_url: 'https://www.tiktok.com/@tiktok',
125
+ max_posts: 250,
126
+ after_datetime: '2024-01-01',
127
+ });
128
+
129
+ let task = await vn.getTikTokProfileScrape(submitted.task_id, { limit: 50 });
130
+
131
+ while (task.task_status === 'processing') {
132
+ await sleep(5000);
133
+ task = await vn.getTikTokProfileScrape(submitted.task_id, { limit: 50 });
134
+ }
135
+
136
+ if (task.task_status === 'failed') {
137
+ throw new Error(task.error_message || 'TikTok profile scrape failed');
138
+ }
139
+
140
+ console.log(`Matched ${task.stats?.videos_matched ?? task.pagination?.total_items ?? 0} videos`);
141
+ ```
142
+
143
+ Use cursor pagination when you want to process videos page by page:
144
+
145
+ ```ts
146
+ const videos = [];
147
+ let cursor: string | undefined;
148
+
149
+ do {
150
+ const page = await vn.getTikTokProfileScrape(submitted.task_id, {
151
+ limit: 100,
152
+ cursor,
153
+ });
154
+
155
+ videos.push(...page.videos);
156
+ cursor = page.pagination?.next_cursor ?? undefined;
157
+ } while (cursor);
158
+
159
+ console.log(`Loaded ${videos.length} TikTok videos`);
160
+ ```
161
+
162
+ Use `download_url` when you want the entire profile result in one request. The URL is short-lived and points directly to the generated JSON file, so it can be fetched with any HTTP client.
163
+
164
+ ```ts
165
+ if (!task.download_url) {
166
+ throw new Error('No download URL is available for this scrape');
167
+ }
168
+
169
+ const response = await fetch(task.download_url);
170
+ const fullProfile = await response.json();
171
+ const videos = fullProfile.videos ?? [];
172
+
173
+ console.log(`Downloaded ${videos.length} videos for`, fullProfile.profile_url);
174
+ ```
175
+
176
+ After you have the final video list, loop through each TikTok video URL and use the normal transcript or extraction APIs:
177
+
178
+ ```ts
179
+ for (const video of videos) {
180
+ if (!video.url) continue;
181
+
182
+ console.log(video.published_at?.toISOString()); // Date parsed from API `published_at`
183
+
184
+ const { transcript } = await vn.getTranscript({
185
+ video_url: video.url,
186
+ transcript_text: true,
187
+ fallback_to_metadata: true,
188
+ });
189
+
190
+ console.log(video.title, transcript);
191
+ }
192
+ ```
193
+
194
+ ```ts
195
+ for (const video of videos) {
196
+ if (!video.url) continue;
197
+
198
+ const { data } = await vn.extractVideoData({
199
+ video_url: video.url,
200
+ schema: {
201
+ hook: { type: 'String', description: 'The opening hook or premise' },
202
+ products: { type: 'Array', description: 'Products or brands mentioned' },
203
+ sentiment: {
204
+ type: 'Enum',
205
+ description: 'Overall sentiment',
206
+ enum: ['positive', 'negative', 'neutral', 'mixed'],
207
+ },
208
+ },
209
+ what_to_extract: 'Extract creator messaging and product mentions.',
210
+ transcribe: true,
211
+ });
212
+
213
+ console.log(video.url, data);
214
+ }
215
+ ```
216
+
217
+ For large profiles, process videos sequentially or with a small concurrency limit so you do not exhaust credits or hit rate limits.
218
+
219
+ ### 4. Instagram carousel posts (multiple videos)
116
220
 
117
221
  Instagram carousel posts can contain multiple videos. You can select a specific video by index, or transcribe them all at once:
118
222
 
@@ -145,7 +249,7 @@ if ('carousel_info' in all) {
145
249
  }
146
250
  ```
147
251
 
148
- ### 4. Upload and analyze a local file
252
+ ### 5. Upload and analyze a local file
149
253
 
150
254
  Upload audio or video files for transcription, analysis, and search. Supported formats: mp4, webm, mov, avi, wmv, flv, mkv, m4a, mp3, mpeg, mpga, wav.
151
255
 
@@ -179,7 +283,7 @@ console.log(transcript_analysis.query_answer?.answer);
179
283
  // "Three action items were discussed: 1) Finalize the hiring..."
180
284
  ```
181
285
 
182
- ### 5. Extract structured data
286
+ ### 6. Extract structured data
183
287
 
184
288
  Define a schema and get back clean, structured data extracted from any video or file transcript. Powered by LLMs with token usage tracking.
185
289
 
@@ -224,12 +328,12 @@ const { data } = await vn.extractFileData({
224
328
 
225
329
  **Supported schema types:** `String`, `Number`, `Boolean`, `Integer`, `Object`, `Array`, `Enum`
226
330
 
227
- ### 6. Semantic search
331
+ ### 7. Semantic search
228
332
 
229
- Search across your indexed YouTube channels and uploaded file libraries using AI-powered vector search with reranking.
333
+ Search YouTube videos and uploaded files with AI-powered ranking/reranking.
230
334
 
231
335
  ```ts
232
- // Search indexed YouTube videos
336
+ // Search YouTube videos
233
337
  const videoResults = await vn.searchVideos({
234
338
  query: 'how to deploy a Node.js app',
235
339
  });
@@ -253,7 +357,7 @@ for (const r of fileResults.results) {
253
357
  }
254
358
  ```
255
359
 
256
- ### 7. Organize files with namespaces
360
+ ### 8. Organize files with namespaces
257
361
 
258
362
  ```ts
259
363
  // Create a namespace
@@ -273,7 +377,7 @@ const files = await vn.getFiles({ namespace_id: ns.id });
273
377
  const all = await vn.getNamespaces();
274
378
  ```
275
379
 
276
- ### 8. Usage and credits
380
+ ### 9. Usage and credits
277
381
 
278
382
  ```ts
279
383
  const usage = await vn.getUsage();
@@ -301,6 +405,15 @@ All methods return a `Promise`. Responses are automatically parsed into typed mo
301
405
 
302
406
  **Common options:** `video_url`, `language`, `metadata_only`, `fallback_to_metadata`, `transcript_text`
303
407
 
408
+ ### TikTok
409
+
410
+ | Method | Description |
411
+ |--------|-------------|
412
+ | `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` |
414
+
415
+ Completed tasks include `videos`, `pagination`, optional scrape `stats`, and an optional short-lived `download_url` for retrieving the whole profile 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 video `published_at` values are parsed into JavaScript `Date` objects, and numeric counters such as `views` and `likes` are normalized to integers.
416
+
304
417
  ### Files
305
418
 
306
419
  | Method | Description |
@@ -331,6 +444,7 @@ All methods return a `Promise`. Responses are automatically parsed into typed mo
331
444
  |--------|-------------|
332
445
  | `analyzeVideo(payload)` | Analyze an online video with an optional natural language query |
333
446
  | `analyzeFile(payload)` | Analyze an uploaded file with an optional natural language query |
447
+ | `getTweetStatement(payload)` | Extract a structured claim analysis from an X/Twitter tweet ID |
334
448
 
335
449
  Returns `transcript_analysis` containing:
336
450
  - `summary` — content overview
@@ -354,7 +468,7 @@ Returns `transcript_analysis` containing:
354
468
 
355
469
  | Method | Description |
356
470
  |--------|-------------|
357
- | `searchVideos(payload)` | Semantic search across indexed YouTube channels |
471
+ | `searchVideos(payload)` | Search YouTube videos with AI ranking/reranking |
358
472
  | `searchFiles(payload)` | Semantic search across uploaded files, with optional `namespace_ids` scope |
359
473
 
360
474
  Results include `relevance_score`, `transcript_summary`, `people`, `places`, `key_subjects`, `query_answer`, `timestamps`, and `relevant_text`.
@@ -421,6 +535,10 @@ All API responses are parsed into typed classes with static `fromJSON()` constru
421
535
  | `ExtractionTokenUsage` | `prompt_tokens`, `completion_tokens`, `total_tokens` |
422
536
  | `CarouselInfo` | Carousel summary: total items, video/image count, transcribed count, total duration |
423
537
  | `CarouselVideoResult` | Per-video result in a carousel: index, status, video info, transcript |
538
+ | `TikTokProfileScrapeSubmission` | Async scrape submission: `task_id`, status, profile URL, expiry |
539
+ | `TikTokProfileTask` | TikTok profile scrape task with status, profile metadata, videos, pagination, `download_url` |
540
+ | `TikTokVideo` | Public TikTok video metadata returned by profile scraping, including `published_at` as a `Date` and integer counters |
541
+ | `TweetStatement` | Structured X/Twitter claim analysis, topics, entities, tone, intent, and source text |
424
542
 
425
543
  ## Links
426
544
 
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, ExtractionTokenUsage, CarouselInfo, CarouselVideoResult } from './models';
2
+ import { VideoInfo, TranscriptOutput, FileInfo, AnalysisResult, VideoSearchResult, FileSearchResult, UsageData, Namespace, NamespaceRef, ExtractionSchema, ExtractionTokenUsage, CarouselInfo, CarouselVideoResult, TikTokProfileScrapeRequest, TikTokProfileScrapeSubmission, TikTokProfileTask, 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.1";
6
+ export declare const SDK_VERSION = "1.0.2";
7
7
  export interface SDKConfig {
8
8
  apiKey: string;
9
9
  baseURL?: string;
@@ -50,6 +50,8 @@ export type UploadFileAcceptedResult = {
50
50
  export type UploadFileResult = UploadFileSuccessResult | UploadFileAcceptedResult;
51
51
  export interface ExtractDataResult {
52
52
  data: Record<string, unknown>;
53
+ video_info?: VideoInfo;
54
+ file_info?: FileInfo;
53
55
  usage?: ExtractionTokenUsage;
54
56
  }
55
57
  export declare class VidNavigatorClient {
@@ -65,6 +67,11 @@ export declare class VidNavigatorClient {
65
67
  transcript: TranscriptOutput;
66
68
  }>;
67
69
  transcribeVideo(payload: TranscribeVideoPayload): Promise<TranscribeVideoResult>;
70
+ submitTikTokProfileScrape(payload: TikTokProfileScrapeRequest): Promise<TikTokProfileScrapeSubmission>;
71
+ getTikTokProfileScrape(task_id: string, query?: {
72
+ cursor?: string;
73
+ limit?: number;
74
+ }): Promise<TikTokProfileTask>;
68
75
  getFiles(query?: {
69
76
  limit?: number;
70
77
  offset?: number;
@@ -145,10 +152,14 @@ export declare class VidNavigatorClient {
145
152
  transcript: TranscriptOutput;
146
153
  transcript_analysis: AnalysisResult;
147
154
  }>;
155
+ getTweetStatement(payload: {
156
+ tweet_id: string;
157
+ }): Promise<TweetStatement>;
148
158
  extractVideoData(payload: {
149
159
  video_url: string;
150
160
  schema: ExtractionSchema;
151
161
  what_to_extract?: string;
162
+ transcribe?: boolean;
152
163
  include_usage?: boolean;
153
164
  }): Promise<ExtractDataResult>;
154
165
  extractFileData(payload: {
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ const errors_1 = require("./errors");
26
26
  __exportStar(require("./models"), exports);
27
27
  __exportStar(require("./errors"), exports);
28
28
  /** SDK version (keep in sync with package.json) */
29
- exports.SDK_VERSION = '1.0.1';
29
+ exports.SDK_VERSION = '1.0.2';
30
30
  //endregion
31
31
  function parseApiErrorPayload(data) {
32
32
  const errorField = data?.error;
@@ -103,7 +103,7 @@ class VidNavigatorClient {
103
103
  };
104
104
  }
105
105
  async getYouTubeTranscript(payload) {
106
- const response = await this.request('POST', '/transcript/youtube', payload);
106
+ const response = await this.request('POST', '/youtube/transcript', payload);
107
107
  return {
108
108
  video_info: models_1.VideoInfo.fromJSON(response.data.video_info),
109
109
  transcript: (0, models_1.transcriptFromJSON)(response.data.transcript),
@@ -125,6 +125,16 @@ class VidNavigatorClient {
125
125
  };
126
126
  }
127
127
  //endregion
128
+ //region --- TikTok ---
129
+ async submitTikTokProfileScrape(payload) {
130
+ const response = await this.request('POST', '/tiktok/profile', payload);
131
+ return models_1.TikTokProfileScrapeSubmission.fromJSON(response.data);
132
+ }
133
+ async getTikTokProfileScrape(task_id, query) {
134
+ const response = await this.request('GET', `/tiktok/profile/${task_id}`, undefined, query);
135
+ return models_1.TikTokProfileTask.fromJSON(response.data);
136
+ }
137
+ //endregion
128
138
  //region --- Files ---
129
139
  async getFiles(query) {
130
140
  const response = await this.request('GET', '/files', undefined, query);
@@ -262,12 +272,17 @@ class VidNavigatorClient {
262
272
  transcript_analysis: models_1.AnalysisResult.fromJSON(response.data.transcript_analysis),
263
273
  };
264
274
  }
275
+ async getTweetStatement(payload) {
276
+ const response = await this.request('POST', '/tweet/statement', payload);
277
+ return models_1.TweetStatement.fromJSON(response.data);
278
+ }
265
279
  //endregion
266
280
  //region --- Extraction ---
267
281
  async extractVideoData(payload) {
268
282
  const body = await this.request('POST', '/extract/video', payload);
269
283
  return {
270
284
  data: body.data,
285
+ video_info: body.video_info ? models_1.VideoInfo.fromJSON(body.video_info) : undefined,
271
286
  usage: body.usage ? models_1.ExtractionTokenUsage.fromJSON(body.usage) : undefined,
272
287
  };
273
288
  }
@@ -275,6 +290,7 @@ class VidNavigatorClient {
275
290
  const body = await this.request('POST', '/extract/file', payload);
276
291
  return {
277
292
  data: body.data,
293
+ file_info: body.file_info ? models_1.FileInfo.fromJSON(body.file_info) : undefined,
278
294
  usage: body.usage ? models_1.ExtractionTokenUsage.fromJSON(body.usage) : undefined,
279
295
  };
280
296
  }
@@ -1,3 +1,5 @@
1
+ import { FileInfoJSON } from './FileInfo';
2
+ import { VideoInfoJSON } from './VideoInfo';
1
3
  export type ExtractionFieldType = 'String' | 'Number' | 'Boolean' | 'Integer' | 'Object' | 'Array' | 'Enum';
2
4
  export interface ExtractionField {
3
5
  type: ExtractionFieldType;
@@ -16,6 +18,8 @@ export interface ExtractionTokenUsageJSON {
16
18
  export interface ExtractionResponseJSON {
17
19
  status: 'success';
18
20
  data: Record<string, unknown>;
21
+ video_info?: VideoInfoJSON;
22
+ file_info?: FileInfoJSON;
19
23
  usage?: ExtractionTokenUsageJSON;
20
24
  }
21
25
  export declare class ExtractionTokenUsage {
@@ -0,0 +1,115 @@
1
+ export interface TikTokProfileScrapeRequest {
2
+ profile_url: string;
3
+ max_posts?: number;
4
+ /** Format: YYYY-MM-DD or ISO datetime with timezone */
5
+ after_datetime?: string;
6
+ /** Format: YYYY-MM-DD or ISO datetime with timezone */
7
+ before_datetime?: string;
8
+ min_likes?: number;
9
+ max_likes?: number;
10
+ }
11
+ export interface TikTokProfileScrapeSubmissionJSON {
12
+ task_id: string;
13
+ task_status: 'processing';
14
+ profile_url: string;
15
+ expires_at?: string;
16
+ check_status_url?: string;
17
+ message?: string;
18
+ }
19
+ export declare class TikTokProfileScrapeSubmission {
20
+ task_id: string;
21
+ task_status: 'processing';
22
+ profile_url: string;
23
+ expires_at?: string;
24
+ check_status_url?: string;
25
+ message?: string;
26
+ constructor(data: TikTokProfileScrapeSubmissionJSON);
27
+ static fromJSON(json: TikTokProfileScrapeSubmissionJSON): TikTokProfileScrapeSubmission;
28
+ }
29
+ export interface TikTokVideoJSON {
30
+ id?: string;
31
+ track?: string | null;
32
+ artists?: string[];
33
+ duration?: number | null;
34
+ title?: string | null;
35
+ description?: string | null;
36
+ timestamp?: number | null;
37
+ published_at?: string | null;
38
+ views?: number | null;
39
+ likes?: number | null;
40
+ reposts?: number | null;
41
+ comments?: number | null;
42
+ thumbnails?: Array<Record<string, unknown>>;
43
+ url?: string;
44
+ }
45
+ export declare class TikTokVideo {
46
+ id?: string;
47
+ track?: string | null;
48
+ artists?: string[];
49
+ duration?: number | null;
50
+ title?: string | null;
51
+ description?: string | null;
52
+ timestamp?: number | null;
53
+ published_at?: Date | null;
54
+ views?: number | null;
55
+ likes?: number | null;
56
+ reposts?: number | null;
57
+ comments?: number | null;
58
+ thumbnails?: Array<Record<string, unknown>>;
59
+ url?: string;
60
+ constructor(data: TikTokVideoJSON);
61
+ static fromJSON(json: TikTokVideoJSON): TikTokVideo;
62
+ }
63
+ export interface TikTokProfileFilters {
64
+ max_posts?: number | null;
65
+ after_datetime?: string | null;
66
+ before_datetime?: string | null;
67
+ min_likes?: number | null;
68
+ max_likes?: number | null;
69
+ }
70
+ export interface TikTokProfileStats {
71
+ videos_scanned?: number;
72
+ videos_matched?: number;
73
+ pages_consumed?: number;
74
+ }
75
+ export interface TikTokProfilePagination {
76
+ limit?: number;
77
+ offset?: number;
78
+ total_items?: number;
79
+ has_next?: boolean;
80
+ has_prev?: boolean;
81
+ next_cursor?: string | null;
82
+ prev_cursor?: string | null;
83
+ }
84
+ export interface TikTokProfileTaskJSON {
85
+ task_id: string;
86
+ task_status: 'processing' | 'completed' | 'failed';
87
+ profile_url?: string;
88
+ profile?: Record<string, unknown> | null;
89
+ filters?: TikTokProfileFilters;
90
+ stats?: TikTokProfileStats;
91
+ videos?: TikTokVideoJSON[];
92
+ pagination?: TikTokProfilePagination;
93
+ download_url?: string | null;
94
+ error_message?: string | null;
95
+ created_at?: string | null;
96
+ completed_at?: string | null;
97
+ expires_at?: string | null;
98
+ }
99
+ export declare class TikTokProfileTask {
100
+ task_id: string;
101
+ task_status: 'processing' | 'completed' | 'failed';
102
+ profile_url?: string;
103
+ profile?: Record<string, unknown> | null;
104
+ filters?: TikTokProfileFilters;
105
+ stats?: TikTokProfileStats;
106
+ videos: TikTokVideo[];
107
+ pagination?: TikTokProfilePagination;
108
+ download_url?: string | null;
109
+ error_message?: string | null;
110
+ created_at?: string | null;
111
+ completed_at?: string | null;
112
+ expires_at?: string | null;
113
+ constructor(data: TikTokProfileTaskJSON);
114
+ static fromJSON(json: TikTokProfileTaskJSON): TikTokProfileTask;
115
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TikTokProfileTask = exports.TikTokVideo = exports.TikTokProfileScrapeSubmission = void 0;
4
+ function toInteger(value) {
5
+ if (value === null || value === undefined)
6
+ return value;
7
+ return Math.trunc(value);
8
+ }
9
+ function toOptionalInteger(value) {
10
+ if (value === undefined)
11
+ return undefined;
12
+ return Math.trunc(value);
13
+ }
14
+ function toNullableDate(value) {
15
+ if (value === null || value === undefined)
16
+ return value;
17
+ const date = new Date(value);
18
+ return Number.isNaN(date.getTime()) ? undefined : date;
19
+ }
20
+ function normalizeFilters(filters) {
21
+ if (!filters)
22
+ return undefined;
23
+ return {
24
+ max_posts: toInteger(filters.max_posts),
25
+ after_datetime: filters.after_datetime,
26
+ before_datetime: filters.before_datetime,
27
+ min_likes: toInteger(filters.min_likes),
28
+ max_likes: toInteger(filters.max_likes),
29
+ };
30
+ }
31
+ function normalizeStats(stats) {
32
+ if (!stats)
33
+ return undefined;
34
+ return {
35
+ videos_scanned: toOptionalInteger(stats.videos_scanned),
36
+ videos_matched: toOptionalInteger(stats.videos_matched),
37
+ pages_consumed: toOptionalInteger(stats.pages_consumed),
38
+ };
39
+ }
40
+ function normalizePagination(pagination) {
41
+ if (!pagination)
42
+ return undefined;
43
+ return {
44
+ limit: toOptionalInteger(pagination.limit),
45
+ offset: toOptionalInteger(pagination.offset),
46
+ total_items: toOptionalInteger(pagination.total_items),
47
+ has_next: pagination.has_next,
48
+ has_prev: pagination.has_prev,
49
+ next_cursor: pagination.next_cursor,
50
+ prev_cursor: pagination.prev_cursor,
51
+ };
52
+ }
53
+ class TikTokProfileScrapeSubmission {
54
+ constructor(data) {
55
+ this.task_id = data.task_id;
56
+ this.task_status = data.task_status;
57
+ this.profile_url = data.profile_url;
58
+ this.expires_at = data.expires_at;
59
+ this.check_status_url = data.check_status_url;
60
+ this.message = data.message;
61
+ }
62
+ static fromJSON(json) {
63
+ return new TikTokProfileScrapeSubmission(json);
64
+ }
65
+ }
66
+ exports.TikTokProfileScrapeSubmission = TikTokProfileScrapeSubmission;
67
+ class TikTokVideo {
68
+ constructor(data) {
69
+ this.id = data.id;
70
+ this.track = data.track;
71
+ this.artists = data.artists;
72
+ this.duration = toInteger(data.duration);
73
+ this.title = data.title;
74
+ this.description = data.description;
75
+ this.timestamp = toInteger(data.timestamp);
76
+ this.published_at = toNullableDate(data.published_at);
77
+ this.views = toInteger(data.views);
78
+ this.likes = toInteger(data.likes);
79
+ this.reposts = toInteger(data.reposts);
80
+ this.comments = toInteger(data.comments);
81
+ this.thumbnails = data.thumbnails;
82
+ this.url = data.url;
83
+ }
84
+ static fromJSON(json) {
85
+ return new TikTokVideo(json);
86
+ }
87
+ }
88
+ exports.TikTokVideo = TikTokVideo;
89
+ class TikTokProfileTask {
90
+ constructor(data) {
91
+ this.task_id = data.task_id;
92
+ this.task_status = data.task_status;
93
+ this.profile_url = data.profile_url;
94
+ this.profile = data.profile;
95
+ this.filters = normalizeFilters(data.filters);
96
+ this.stats = normalizeStats(data.stats);
97
+ this.videos = data.videos?.map(TikTokVideo.fromJSON) ?? [];
98
+ this.pagination = normalizePagination(data.pagination);
99
+ this.download_url = data.download_url;
100
+ this.error_message = data.error_message;
101
+ this.created_at = data.created_at;
102
+ this.completed_at = data.completed_at;
103
+ this.expires_at = data.expires_at;
104
+ }
105
+ static fromJSON(json) {
106
+ return new TikTokProfileTask(json);
107
+ }
108
+ }
109
+ exports.TikTokProfileTask = TikTokProfileTask;
@@ -0,0 +1,39 @@
1
+ export type TweetClaimType = 'factual_claim' | 'opinion' | 'question' | 'call_to_action' | 'satire' | 'news_sharing' | 'personal_experience';
2
+ export type TweetIntent = 'educate' | 'inform' | 'analyze' | 'persuade' | 'entertain' | 'inspire' | 'challenge';
3
+ export type TweetTone = 'serious' | 'humorous' | 'provocative' | 'neutral' | 'warm' | 'skeptical' | 'inspirational';
4
+ export type TweetEmotion = 'curiosity' | 'urgency' | 'outrage' | 'fear' | 'hope_inspiration' | 'confidence_reassurance' | 'empathy_warmth' | 'awe_wonder';
5
+ export type TweetAuthority = 'data_driven' | 'expert_led' | 'experience_based' | 'speculative';
6
+ export interface TweetStatementJSON {
7
+ final_statement?: string;
8
+ statement_query?: string;
9
+ detailed_analysis?: string;
10
+ topics?: string[];
11
+ entities?: string[];
12
+ claim_type?: TweetClaimType;
13
+ intent?: TweetIntent;
14
+ tone?: TweetTone;
15
+ emotion?: TweetEmotion;
16
+ authority?: TweetAuthority;
17
+ tweet_text?: string | null;
18
+ tweet_media_summary?: string | null;
19
+ quoted_tweet_text?: string | null;
20
+ quoted_media_summary?: string | null;
21
+ }
22
+ export declare class TweetStatement {
23
+ final_statement?: string;
24
+ statement_query?: string;
25
+ detailed_analysis?: string;
26
+ topics?: string[];
27
+ entities?: string[];
28
+ claim_type?: TweetClaimType;
29
+ intent?: TweetIntent;
30
+ tone?: TweetTone;
31
+ emotion?: TweetEmotion;
32
+ authority?: TweetAuthority;
33
+ tweet_text?: string | null;
34
+ tweet_media_summary?: string | null;
35
+ quoted_tweet_text?: string | null;
36
+ quoted_media_summary?: string | null;
37
+ constructor(data: TweetStatementJSON);
38
+ static fromJSON(json: TweetStatementJSON): TweetStatement;
39
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TweetStatement = void 0;
4
+ class TweetStatement {
5
+ constructor(data) {
6
+ Object.assign(this, data);
7
+ }
8
+ static fromJSON(json) {
9
+ return new TweetStatement(json);
10
+ }
11
+ }
12
+ exports.TweetStatement = TweetStatement;
@@ -75,12 +75,17 @@ export interface UsageDataJSON {
75
75
  };
76
76
  credits: CreditsInfoJSON;
77
77
  usage: {
78
- video_transcripts: ActivityCountJSON;
79
- youtube_transcripts: ActivityCountJSON;
80
- video_searches: ActivityCountJSON;
81
- video_analyses: ActivityCountJSON;
82
- video_scene_analyses: ActivityCountJSON;
83
- video_uploads: ActivityCountJSON;
78
+ standard_request?: ActivityCountJSON;
79
+ residential_request?: ActivityCountJSON;
80
+ search_request?: ActivityCountJSON;
81
+ analysis_request?: ActivityCountJSON;
82
+ transcription_hour?: ActivityCountJSON;
83
+ video_scene_analyses?: ActivityCountJSON;
84
+ video_transcripts?: ActivityCountJSON;
85
+ youtube_transcripts?: ActivityCountJSON;
86
+ video_searches?: ActivityCountJSON;
87
+ video_analyses?: ActivityCountJSON;
88
+ video_uploads?: ActivityCountJSON;
84
89
  };
85
90
  channels_indexed: CapacityMetricJSON;
86
91
  storage: StorageUsageJSON;
@@ -105,12 +110,17 @@ export declare class UsageData {
105
110
  };
106
111
  credits: CreditsInfo;
107
112
  usage: {
108
- videoTranscripts: ActivityCount;
109
- youtubeTranscripts: ActivityCount;
110
- videoSearches: ActivityCount;
111
- videoAnalyses: ActivityCount;
112
- videoSceneAnalyses: ActivityCount;
113
- videoUploads: ActivityCount;
113
+ standardRequest?: ActivityCount;
114
+ residentialRequest?: ActivityCount;
115
+ searchRequest?: ActivityCount;
116
+ analysisRequest?: ActivityCount;
117
+ transcriptionHour?: ActivityCount;
118
+ videoSceneAnalyses?: ActivityCount;
119
+ videoTranscripts?: ActivityCount;
120
+ youtubeTranscripts?: ActivityCount;
121
+ videoSearches?: ActivityCount;
122
+ videoAnalyses?: ActivityCount;
123
+ videoUploads?: ActivityCount;
114
124
  };
115
125
  channelsIndexed: CapacityMetric;
116
126
  storage: StorageUsage;
@@ -69,12 +69,17 @@ class UsageData {
69
69
  };
70
70
  this.credits = CreditsInfo.fromJSON(data.credits);
71
71
  this.usage = {
72
- videoTranscripts: ActivityCount.fromJSON(data.usage.video_transcripts),
73
- youtubeTranscripts: ActivityCount.fromJSON(data.usage.youtube_transcripts),
74
- videoSearches: ActivityCount.fromJSON(data.usage.video_searches),
75
- videoAnalyses: ActivityCount.fromJSON(data.usage.video_analyses),
76
- videoSceneAnalyses: ActivityCount.fromJSON(data.usage.video_scene_analyses),
77
- videoUploads: ActivityCount.fromJSON(data.usage.video_uploads),
72
+ standardRequest: data.usage.standard_request ? ActivityCount.fromJSON(data.usage.standard_request) : undefined,
73
+ residentialRequest: data.usage.residential_request ? ActivityCount.fromJSON(data.usage.residential_request) : undefined,
74
+ searchRequest: data.usage.search_request ? ActivityCount.fromJSON(data.usage.search_request) : undefined,
75
+ analysisRequest: data.usage.analysis_request ? ActivityCount.fromJSON(data.usage.analysis_request) : undefined,
76
+ transcriptionHour: data.usage.transcription_hour ? ActivityCount.fromJSON(data.usage.transcription_hour) : undefined,
77
+ videoSceneAnalyses: data.usage.video_scene_analyses ? ActivityCount.fromJSON(data.usage.video_scene_analyses) : undefined,
78
+ videoTranscripts: data.usage.video_transcripts ? ActivityCount.fromJSON(data.usage.video_transcripts) : undefined,
79
+ youtubeTranscripts: data.usage.youtube_transcripts ? ActivityCount.fromJSON(data.usage.youtube_transcripts) : undefined,
80
+ videoSearches: data.usage.video_searches ? ActivityCount.fromJSON(data.usage.video_searches) : undefined,
81
+ videoAnalyses: data.usage.video_analyses ? ActivityCount.fromJSON(data.usage.video_analyses) : undefined,
82
+ videoUploads: data.usage.video_uploads ? ActivityCount.fromJSON(data.usage.video_uploads) : undefined,
78
83
  };
79
84
  this.channelsIndexed = CapacityMetric.fromJSON(data.channels_indexed);
80
85
  this.storage = StorageUsage.fromJSON(data.storage);
@@ -5,6 +5,8 @@ export * from './Extraction';
5
5
  export * from './FileInfo';
6
6
  export * from './Namespace';
7
7
  export * from './SearchResult';
8
+ export * from './TikTok';
8
9
  export * from './TranscriptSegment';
10
+ export * from './TweetStatement';
9
11
  export * from './VideoInfo';
10
12
  export * from './Usage';
@@ -21,6 +21,8 @@ __exportStar(require("./Extraction"), exports);
21
21
  __exportStar(require("./FileInfo"), exports);
22
22
  __exportStar(require("./Namespace"), exports);
23
23
  __exportStar(require("./SearchResult"), exports);
24
+ __exportStar(require("./TikTok"), exports);
24
25
  __exportStar(require("./TranscriptSegment"), exports);
26
+ __exportStar(require("./TweetStatement"), exports);
25
27
  __exportStar(require("./VideoInfo"), exports);
26
28
  __exportStar(require("./Usage"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidnavigator",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Official JavaScript SDK for the VidNavigator Developer API",
5
5
  "author": "VidNavigator",
6
6
  "license": "Apache-2.0",
package/src/index.ts CHANGED
@@ -28,6 +28,13 @@ import {
28
28
  CarouselInfoJSON,
29
29
  CarouselVideoResult,
30
30
  CarouselVideoResultJSON,
31
+ TikTokProfileScrapeRequest,
32
+ TikTokProfileScrapeSubmission,
33
+ TikTokProfileScrapeSubmissionJSON,
34
+ TikTokProfileTask,
35
+ TikTokProfileTaskJSON,
36
+ TweetStatement,
37
+ TweetStatementJSON,
31
38
  } from './models';
32
39
  import {
33
40
  VidNavigatorError,
@@ -47,7 +54,7 @@ export * from './models';
47
54
  export * from './errors';
48
55
 
49
56
  /** SDK version (keep in sync with package.json) */
50
- export const SDK_VERSION = '1.0.1';
57
+ export const SDK_VERSION = '1.0.2';
51
58
 
52
59
  //region --- Interfaces ---
53
60
  export interface SDKConfig {
@@ -110,6 +117,8 @@ export type UploadFileResult = UploadFileSuccessResult | UploadFileAcceptedResul
110
117
 
111
118
  export interface ExtractDataResult {
112
119
  data: Record<string, unknown>;
120
+ video_info?: VideoInfo;
121
+ file_info?: FileInfo;
113
122
  usage?: ExtractionTokenUsage;
114
123
  }
115
124
  //endregion
@@ -232,7 +241,7 @@ export class VidNavigatorClient {
232
241
  video_info: VideoInfoJSON;
233
242
  transcript: TranscriptSegmentJSON[] | string;
234
243
  }>
235
- >('POST', '/transcript/youtube', payload);
244
+ >('POST', '/youtube/transcript', payload);
236
245
 
237
246
  return {
238
247
  video_info: VideoInfo.fromJSON(response.data.video_info),
@@ -270,6 +279,32 @@ export class VidNavigatorClient {
270
279
  }
271
280
  //endregion
272
281
 
282
+ //region --- TikTok ---
283
+ async submitTikTokProfileScrape(
284
+ payload: TikTokProfileScrapeRequest
285
+ ): Promise<TikTokProfileScrapeSubmission> {
286
+ const response = await this.request<ApiSuccessResponse<TikTokProfileScrapeSubmissionJSON>>(
287
+ 'POST',
288
+ '/tiktok/profile',
289
+ payload
290
+ );
291
+ return TikTokProfileScrapeSubmission.fromJSON(response.data);
292
+ }
293
+
294
+ async getTikTokProfileScrape(
295
+ task_id: string,
296
+ query?: { cursor?: string; limit?: number }
297
+ ): Promise<TikTokProfileTask> {
298
+ const response = await this.request<ApiSuccessResponse<TikTokProfileTaskJSON>>(
299
+ 'GET',
300
+ `/tiktok/profile/${task_id}`,
301
+ undefined,
302
+ query
303
+ );
304
+ return TikTokProfileTask.fromJSON(response.data);
305
+ }
306
+ //endregion
307
+
273
308
  //region --- Files ---
274
309
  async getFiles(query?: {
275
310
  limit?: number;
@@ -530,6 +565,15 @@ export class VidNavigatorClient {
530
565
  transcript_analysis: AnalysisResult.fromJSON(response.data.transcript_analysis),
531
566
  };
532
567
  }
568
+
569
+ async getTweetStatement(payload: { tweet_id: string }): Promise<TweetStatement> {
570
+ const response = await this.request<ApiSuccessResponse<TweetStatementJSON>>(
571
+ 'POST',
572
+ '/tweet/statement',
573
+ payload
574
+ );
575
+ return TweetStatement.fromJSON(response.data);
576
+ }
533
577
  //endregion
534
578
 
535
579
  //region --- Extraction ---
@@ -537,15 +581,18 @@ export class VidNavigatorClient {
537
581
  video_url: string;
538
582
  schema: ExtractionSchema;
539
583
  what_to_extract?: string;
584
+ transcribe?: boolean;
540
585
  include_usage?: boolean;
541
586
  }): Promise<ExtractDataResult> {
542
587
  const body = await this.request<{
543
588
  status: 'success';
544
589
  data: Record<string, unknown>;
590
+ video_info?: VideoInfoJSON;
545
591
  usage?: ExtractionTokenUsageJSON;
546
592
  }>('POST', '/extract/video', payload);
547
593
  return {
548
594
  data: body.data,
595
+ video_info: body.video_info ? VideoInfo.fromJSON(body.video_info) : undefined,
549
596
  usage: body.usage ? ExtractionTokenUsage.fromJSON(body.usage) : undefined,
550
597
  };
551
598
  }
@@ -559,10 +606,12 @@ export class VidNavigatorClient {
559
606
  const body = await this.request<{
560
607
  status: 'success';
561
608
  data: Record<string, unknown>;
609
+ file_info?: FileInfoJSON;
562
610
  usage?: ExtractionTokenUsageJSON;
563
611
  }>('POST', '/extract/file', payload);
564
612
  return {
565
613
  data: body.data,
614
+ file_info: body.file_info ? FileInfo.fromJSON(body.file_info) : undefined,
566
615
  usage: body.usage ? ExtractionTokenUsage.fromJSON(body.usage) : undefined,
567
616
  };
568
617
  }
@@ -1,3 +1,6 @@
1
+ import { FileInfoJSON } from './FileInfo';
2
+ import { VideoInfoJSON } from './VideoInfo';
3
+
1
4
  export type ExtractionFieldType =
2
5
  | 'String'
3
6
  | 'Number'
@@ -27,6 +30,8 @@ export interface ExtractionTokenUsageJSON {
27
30
  export interface ExtractionResponseJSON {
28
31
  status: 'success';
29
32
  data: Record<string, unknown>;
33
+ video_info?: VideoInfoJSON;
34
+ file_info?: FileInfoJSON;
30
35
  usage?: ExtractionTokenUsageJSON;
31
36
  }
32
37
 
@@ -0,0 +1,223 @@
1
+ export interface TikTokProfileScrapeRequest {
2
+ profile_url: string;
3
+ max_posts?: number;
4
+ /** Format: YYYY-MM-DD or ISO datetime with timezone */
5
+ after_datetime?: string;
6
+ /** Format: YYYY-MM-DD or ISO datetime with timezone */
7
+ before_datetime?: string;
8
+ min_likes?: number;
9
+ max_likes?: number;
10
+ }
11
+
12
+ function toInteger(value: number | null | undefined): number | null | undefined {
13
+ if (value === null || value === undefined) return value;
14
+ return Math.trunc(value);
15
+ }
16
+
17
+ function toOptionalInteger(value: number | undefined): number | undefined {
18
+ if (value === undefined) return undefined;
19
+ return Math.trunc(value);
20
+ }
21
+
22
+ function toNullableDate(value: string | null | undefined): Date | null | undefined {
23
+ if (value === null || value === undefined) return value;
24
+ const date = new Date(value);
25
+ return Number.isNaN(date.getTime()) ? undefined : date;
26
+ }
27
+
28
+ function normalizeFilters(filters: TikTokProfileFilters | undefined): TikTokProfileFilters | undefined {
29
+ if (!filters) return undefined;
30
+ return {
31
+ max_posts: toInteger(filters.max_posts),
32
+ after_datetime: filters.after_datetime,
33
+ before_datetime: filters.before_datetime,
34
+ min_likes: toInteger(filters.min_likes),
35
+ max_likes: toInteger(filters.max_likes),
36
+ };
37
+ }
38
+
39
+ function normalizeStats(stats: TikTokProfileStats | undefined): TikTokProfileStats | undefined {
40
+ if (!stats) return undefined;
41
+ return {
42
+ videos_scanned: toOptionalInteger(stats.videos_scanned),
43
+ videos_matched: toOptionalInteger(stats.videos_matched),
44
+ pages_consumed: toOptionalInteger(stats.pages_consumed),
45
+ };
46
+ }
47
+
48
+ function normalizePagination(
49
+ pagination: TikTokProfilePagination | undefined
50
+ ): TikTokProfilePagination | undefined {
51
+ if (!pagination) return undefined;
52
+ return {
53
+ limit: toOptionalInteger(pagination.limit),
54
+ offset: toOptionalInteger(pagination.offset),
55
+ total_items: toOptionalInteger(pagination.total_items),
56
+ has_next: pagination.has_next,
57
+ has_prev: pagination.has_prev,
58
+ next_cursor: pagination.next_cursor,
59
+ prev_cursor: pagination.prev_cursor,
60
+ };
61
+ }
62
+
63
+ export interface TikTokProfileScrapeSubmissionJSON {
64
+ task_id: string;
65
+ task_status: 'processing';
66
+ profile_url: string;
67
+ expires_at?: string;
68
+ check_status_url?: string;
69
+ message?: string;
70
+ }
71
+
72
+ export class TikTokProfileScrapeSubmission {
73
+ task_id: string;
74
+ task_status: 'processing';
75
+ profile_url: string;
76
+ expires_at?: string;
77
+ check_status_url?: string;
78
+ message?: string;
79
+
80
+ constructor(data: TikTokProfileScrapeSubmissionJSON) {
81
+ this.task_id = data.task_id;
82
+ this.task_status = data.task_status;
83
+ this.profile_url = data.profile_url;
84
+ this.expires_at = data.expires_at;
85
+ this.check_status_url = data.check_status_url;
86
+ this.message = data.message;
87
+ }
88
+
89
+ static fromJSON(json: TikTokProfileScrapeSubmissionJSON): TikTokProfileScrapeSubmission {
90
+ return new TikTokProfileScrapeSubmission(json);
91
+ }
92
+ }
93
+
94
+ export interface TikTokVideoJSON {
95
+ id?: string;
96
+ track?: string | null;
97
+ artists?: string[];
98
+ duration?: number | null;
99
+ title?: string | null;
100
+ description?: string | null;
101
+ timestamp?: number | null;
102
+ published_at?: string | null;
103
+ views?: number | null;
104
+ likes?: number | null;
105
+ reposts?: number | null;
106
+ comments?: number | null;
107
+ thumbnails?: Array<Record<string, unknown>>;
108
+ url?: string;
109
+ }
110
+
111
+ export class TikTokVideo {
112
+ id?: string;
113
+ track?: string | null;
114
+ artists?: string[];
115
+ duration?: number | null;
116
+ title?: string | null;
117
+ description?: string | null;
118
+ timestamp?: number | null;
119
+ published_at?: Date | null;
120
+ views?: number | null;
121
+ likes?: number | null;
122
+ reposts?: number | null;
123
+ comments?: number | null;
124
+ thumbnails?: Array<Record<string, unknown>>;
125
+ url?: string;
126
+
127
+ constructor(data: TikTokVideoJSON) {
128
+ this.id = data.id;
129
+ this.track = data.track;
130
+ this.artists = data.artists;
131
+ this.duration = toInteger(data.duration);
132
+ this.title = data.title;
133
+ this.description = data.description;
134
+ this.timestamp = toInteger(data.timestamp);
135
+ this.published_at = toNullableDate(data.published_at);
136
+ this.views = toInteger(data.views);
137
+ this.likes = toInteger(data.likes);
138
+ this.reposts = toInteger(data.reposts);
139
+ this.comments = toInteger(data.comments);
140
+ this.thumbnails = data.thumbnails;
141
+ this.url = data.url;
142
+ }
143
+
144
+ static fromJSON(json: TikTokVideoJSON): TikTokVideo {
145
+ return new TikTokVideo(json);
146
+ }
147
+ }
148
+
149
+ export interface TikTokProfileFilters {
150
+ max_posts?: number | null;
151
+ after_datetime?: string | null;
152
+ before_datetime?: string | null;
153
+ min_likes?: number | null;
154
+ max_likes?: number | null;
155
+ }
156
+
157
+ export interface TikTokProfileStats {
158
+ videos_scanned?: number;
159
+ videos_matched?: number;
160
+ pages_consumed?: number;
161
+ }
162
+
163
+ export interface TikTokProfilePagination {
164
+ limit?: number;
165
+ offset?: number;
166
+ total_items?: number;
167
+ has_next?: boolean;
168
+ has_prev?: boolean;
169
+ next_cursor?: string | null;
170
+ prev_cursor?: string | null;
171
+ }
172
+
173
+ export interface TikTokProfileTaskJSON {
174
+ task_id: string;
175
+ task_status: 'processing' | 'completed' | 'failed';
176
+ profile_url?: string;
177
+ profile?: Record<string, unknown> | null;
178
+ filters?: TikTokProfileFilters;
179
+ stats?: TikTokProfileStats;
180
+ videos?: TikTokVideoJSON[];
181
+ pagination?: TikTokProfilePagination;
182
+ download_url?: string | null;
183
+ error_message?: string | null;
184
+ created_at?: string | null;
185
+ completed_at?: string | null;
186
+ expires_at?: string | null;
187
+ }
188
+
189
+ export class TikTokProfileTask {
190
+ task_id: string;
191
+ task_status: 'processing' | 'completed' | 'failed';
192
+ profile_url?: string;
193
+ profile?: Record<string, unknown> | null;
194
+ filters?: TikTokProfileFilters;
195
+ stats?: TikTokProfileStats;
196
+ videos: TikTokVideo[];
197
+ pagination?: TikTokProfilePagination;
198
+ download_url?: string | null;
199
+ error_message?: string | null;
200
+ created_at?: string | null;
201
+ completed_at?: string | null;
202
+ expires_at?: string | null;
203
+
204
+ constructor(data: TikTokProfileTaskJSON) {
205
+ this.task_id = data.task_id;
206
+ this.task_status = data.task_status;
207
+ this.profile_url = data.profile_url;
208
+ this.profile = data.profile;
209
+ this.filters = normalizeFilters(data.filters);
210
+ this.stats = normalizeStats(data.stats);
211
+ this.videos = data.videos?.map(TikTokVideo.fromJSON) ?? [];
212
+ this.pagination = normalizePagination(data.pagination);
213
+ this.download_url = data.download_url;
214
+ this.error_message = data.error_message;
215
+ this.created_at = data.created_at;
216
+ this.completed_at = data.completed_at;
217
+ this.expires_at = data.expires_at;
218
+ }
219
+
220
+ static fromJSON(json: TikTokProfileTaskJSON): TikTokProfileTask {
221
+ return new TikTokProfileTask(json);
222
+ }
223
+ }
@@ -0,0 +1,84 @@
1
+ export type TweetClaimType =
2
+ | 'factual_claim'
3
+ | 'opinion'
4
+ | 'question'
5
+ | 'call_to_action'
6
+ | 'satire'
7
+ | 'news_sharing'
8
+ | 'personal_experience';
9
+
10
+ export type TweetIntent =
11
+ | 'educate'
12
+ | 'inform'
13
+ | 'analyze'
14
+ | 'persuade'
15
+ | 'entertain'
16
+ | 'inspire'
17
+ | 'challenge';
18
+
19
+ export type TweetTone =
20
+ | 'serious'
21
+ | 'humorous'
22
+ | 'provocative'
23
+ | 'neutral'
24
+ | 'warm'
25
+ | 'skeptical'
26
+ | 'inspirational';
27
+
28
+ export type TweetEmotion =
29
+ | 'curiosity'
30
+ | 'urgency'
31
+ | 'outrage'
32
+ | 'fear'
33
+ | 'hope_inspiration'
34
+ | 'confidence_reassurance'
35
+ | 'empathy_warmth'
36
+ | 'awe_wonder';
37
+
38
+ export type TweetAuthority =
39
+ | 'data_driven'
40
+ | 'expert_led'
41
+ | 'experience_based'
42
+ | 'speculative';
43
+
44
+ export interface TweetStatementJSON {
45
+ final_statement?: string;
46
+ statement_query?: string;
47
+ detailed_analysis?: string;
48
+ topics?: string[];
49
+ entities?: string[];
50
+ claim_type?: TweetClaimType;
51
+ intent?: TweetIntent;
52
+ tone?: TweetTone;
53
+ emotion?: TweetEmotion;
54
+ authority?: TweetAuthority;
55
+ tweet_text?: string | null;
56
+ tweet_media_summary?: string | null;
57
+ quoted_tweet_text?: string | null;
58
+ quoted_media_summary?: string | null;
59
+ }
60
+
61
+ export class TweetStatement {
62
+ final_statement?: string;
63
+ statement_query?: string;
64
+ detailed_analysis?: string;
65
+ topics?: string[];
66
+ entities?: string[];
67
+ claim_type?: TweetClaimType;
68
+ intent?: TweetIntent;
69
+ tone?: TweetTone;
70
+ emotion?: TweetEmotion;
71
+ authority?: TweetAuthority;
72
+ tweet_text?: string | null;
73
+ tweet_media_summary?: string | null;
74
+ quoted_tweet_text?: string | null;
75
+ quoted_media_summary?: string | null;
76
+
77
+ constructor(data: TweetStatementJSON) {
78
+ Object.assign(this, data);
79
+ }
80
+
81
+ static fromJSON(json: TweetStatementJSON): TweetStatement {
82
+ return new TweetStatement(json);
83
+ }
84
+ }
@@ -121,12 +121,17 @@ export interface UsageDataJSON {
121
121
  };
122
122
  credits: CreditsInfoJSON;
123
123
  usage: {
124
- video_transcripts: ActivityCountJSON;
125
- youtube_transcripts: ActivityCountJSON;
126
- video_searches: ActivityCountJSON;
127
- video_analyses: ActivityCountJSON;
128
- video_scene_analyses: ActivityCountJSON;
129
- video_uploads: ActivityCountJSON;
124
+ standard_request?: ActivityCountJSON;
125
+ residential_request?: ActivityCountJSON;
126
+ search_request?: ActivityCountJSON;
127
+ analysis_request?: ActivityCountJSON;
128
+ transcription_hour?: ActivityCountJSON;
129
+ video_scene_analyses?: ActivityCountJSON;
130
+ video_transcripts?: ActivityCountJSON;
131
+ youtube_transcripts?: ActivityCountJSON;
132
+ video_searches?: ActivityCountJSON;
133
+ video_analyses?: ActivityCountJSON;
134
+ video_uploads?: ActivityCountJSON;
130
135
  };
131
136
  channels_indexed: CapacityMetricJSON;
132
137
  storage: StorageUsageJSON;
@@ -152,12 +157,17 @@ export class UsageData {
152
157
  };
153
158
  public credits: CreditsInfo;
154
159
  public usage: {
155
- videoTranscripts: ActivityCount;
156
- youtubeTranscripts: ActivityCount;
157
- videoSearches: ActivityCount;
158
- videoAnalyses: ActivityCount;
159
- videoSceneAnalyses: ActivityCount;
160
- videoUploads: ActivityCount;
160
+ standardRequest?: ActivityCount;
161
+ residentialRequest?: ActivityCount;
162
+ searchRequest?: ActivityCount;
163
+ analysisRequest?: ActivityCount;
164
+ transcriptionHour?: ActivityCount;
165
+ videoSceneAnalyses?: ActivityCount;
166
+ videoTranscripts?: ActivityCount;
167
+ youtubeTranscripts?: ActivityCount;
168
+ videoSearches?: ActivityCount;
169
+ videoAnalyses?: ActivityCount;
170
+ videoUploads?: ActivityCount;
161
171
  };
162
172
  public channelsIndexed: CapacityMetric;
163
173
  public storage: StorageUsage;
@@ -182,12 +192,17 @@ export class UsageData {
182
192
  };
183
193
  this.credits = CreditsInfo.fromJSON(data.credits);
184
194
  this.usage = {
185
- videoTranscripts: ActivityCount.fromJSON(data.usage.video_transcripts),
186
- youtubeTranscripts: ActivityCount.fromJSON(data.usage.youtube_transcripts),
187
- videoSearches: ActivityCount.fromJSON(data.usage.video_searches),
188
- videoAnalyses: ActivityCount.fromJSON(data.usage.video_analyses),
189
- videoSceneAnalyses: ActivityCount.fromJSON(data.usage.video_scene_analyses),
190
- videoUploads: ActivityCount.fromJSON(data.usage.video_uploads),
195
+ standardRequest: data.usage.standard_request ? ActivityCount.fromJSON(data.usage.standard_request) : undefined,
196
+ residentialRequest: data.usage.residential_request ? ActivityCount.fromJSON(data.usage.residential_request) : undefined,
197
+ searchRequest: data.usage.search_request ? ActivityCount.fromJSON(data.usage.search_request) : undefined,
198
+ analysisRequest: data.usage.analysis_request ? ActivityCount.fromJSON(data.usage.analysis_request) : undefined,
199
+ transcriptionHour: data.usage.transcription_hour ? ActivityCount.fromJSON(data.usage.transcription_hour) : undefined,
200
+ videoSceneAnalyses: data.usage.video_scene_analyses ? ActivityCount.fromJSON(data.usage.video_scene_analyses) : undefined,
201
+ videoTranscripts: data.usage.video_transcripts ? ActivityCount.fromJSON(data.usage.video_transcripts) : undefined,
202
+ youtubeTranscripts: data.usage.youtube_transcripts ? ActivityCount.fromJSON(data.usage.youtube_transcripts) : undefined,
203
+ videoSearches: data.usage.video_searches ? ActivityCount.fromJSON(data.usage.video_searches) : undefined,
204
+ videoAnalyses: data.usage.video_analyses ? ActivityCount.fromJSON(data.usage.video_analyses) : undefined,
205
+ videoUploads: data.usage.video_uploads ? ActivityCount.fromJSON(data.usage.video_uploads) : undefined,
191
206
  };
192
207
  this.channelsIndexed = CapacityMetric.fromJSON(data.channels_indexed);
193
208
  this.storage = StorageUsage.fromJSON(data.storage);
@@ -5,6 +5,8 @@ export * from './Extraction';
5
5
  export * from './FileInfo';
6
6
  export * from './Namespace';
7
7
  export * from './SearchResult';
8
+ export * from './TikTok';
8
9
  export * from './TranscriptSegment';
10
+ export * from './TweetStatement';
9
11
  export * from './VideoInfo';
10
- export * from './Usage';
12
+ export * from './Usage';