vidnavigator 2.0.0 → 2.2.0

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
@@ -1,6 +1,6 @@
1
1
  # VidNavigator SDK for JavaScript
2
2
 
3
- The official JavaScript/TypeScript SDK for the [VidNavigator Developer API](https://vidnavigator.com). Transcribe, analyze, search, and extract structured data from video and audio — YouTube, Instagram, TikTok, X/Twitter, Vimeo, Facebook, Dailymotion, Loom, and your own uploaded files.
3
+ The official JavaScript/TypeScript SDK for the [VidNavigator Developer API](https://vidnavigator.com). Transcribe, analyze, search, and extract structured data from video and audio — YouTube, Instagram, TikTok, X/Twitter, Vimeo, Facebook, Dailymotion, Loom, Snapchat, and your own uploaded files.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/vidnavigator.svg)](https://www.npmjs.com/package/vidnavigator)
6
6
  [![License](https://img.shields.io/npm/l/vidnavigator.svg)](https://github.com/vidnavigator/vidnavigator-js/blob/main/LICENSE)
@@ -9,9 +9,9 @@ The official JavaScript/TypeScript SDK for the [VidNavigator Developer API](http
9
9
 
10
10
  ## Why VidNavigator?
11
11
 
12
- - **Multi-platform transcription** — YouTube, Instagram Reels & carousel posts, TikTok, X/Twitter, Vimeo, Facebook, Dailymotion, Loom, and more.
12
+ - **Multi-platform transcription** — YouTube, Instagram Reels & carousel posts, TikTok, X/Twitter, Vimeo, Facebook, Dailymotion, Loom, Snapchat, and more.
13
13
  - **Any video length** — transcription, extraction, and tweet analysis run as background jobs, so there is no duration limit. Get the result with one `await`, or submit many jobs and collect them as they finish.
14
- - **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`, optionally notified by webhook.
14
+ - **Async TikTok profile scraping, keyword search and LIVE search** — collect public TikTok videos, or LIVE rooms with their stream URLs, in the background, then read results via cursor pagination or a signed `download_url`, optionally notified by webhook.
15
15
  - **Instagram carousel support** — select a specific video by index, or transcribe every video in a carousel post with one call.
16
16
  - **AI-powered analysis** — get summaries, people mentioned, places, key subjects, and direct answers to questions about any video or audio.
17
17
  - **Structured data extraction** — define a JSON schema and receive typed, structured fields extracted from any transcript (powered by LLMs).
@@ -34,6 +34,7 @@ The official JavaScript/TypeScript SDK for the [VidNavigator Developer API](http
34
34
  | Facebook | Yes | Yes | - |
35
35
  | Dailymotion | Yes | Yes | - |
36
36
  | Loom | Yes | Yes | - |
37
+ | Snapchat | Yes, when Snapchat has a transcript | Yes | Yes (highlights: `img_index`, `all_videos`) |
37
38
  | Uploaded files | Yes | Yes | - |
38
39
 
39
40
  > **Transcript** = fast caption/subtitle extraction. **Transcribe** = speech-to-text via AI models (works when captions are unavailable).
@@ -90,9 +91,8 @@ const vn = new VidNavigatorClient({
90
91
 
91
92
  ### Upgrading from 1.x
92
93
 
93
- Transcription, structured extraction, and tweet analysis now always run as background jobs, so they work on videos of any length. Your existing calls keep working with the same arguments, with two differences:
94
+ Transcription, structured extraction, and tweet analysis now always run as background jobs, so they work on videos of any length. Your existing calls keep working with the same arguments, with one difference:
94
95
 
95
- - `extractVideoData()` no longer returns `video_info`. Use `getTranscript({ video_url, metadata_only: true })` if you need the metadata.
96
96
  - `getTweetStatement()` no longer returns `statement_query`, which was never part of the documented API.
97
97
 
98
98
  New in 2.0: `vn.transcribe`, `vn.extractVideo`, `vn.tweetStatement`, `vn.tiktokProfile`, and `vn.tiktokSearch`, each with `.submit()` for running many jobs at once (see [Background jobs](#3-background-jobs-one-call-or-many-at-once)), plus webhook signature helpers.
@@ -103,7 +103,7 @@ New in 2.0: `vn.transcribe`, `vn.extractVideo`, `vn.tweetStatement`, `vn.tiktokP
103
103
 
104
104
  ### 1. Get a transcript (any platform)
105
105
 
106
- There is a single `getTranscript` method that auto-detects the platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, and more) from the URL.
106
+ There is a single `getTranscript` method that auto-detects the platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, Snapchat, and more) from the URL.
107
107
 
108
108
  ```ts
109
109
  const { video_info, transcript } = await vn.getTranscript({
@@ -164,6 +164,7 @@ Each of these operations comes in two shapes:
164
164
  | Tweet claim analysis | `await vn.tweetStatement(tweetId)` | `await vn.tweetStatement.submit(tweetId)` |
165
165
  | TikTok profile scrape | `await vn.tiktokProfile(profileUrl)` | `await vn.tiktokProfile.submit(profileUrl)` |
166
166
  | TikTok keyword search | `await vn.tiktokSearch(query)` | `await vn.tiktokSearch.submit(query)` |
167
+ | TikTok LIVE search | `await vn.tiktokLiveSearch(query)` | `await vn.tiktokLiveSearch.submit(query)` |
167
168
 
168
169
  **Wait for the result.** The one-liner submits the job, checks on it until it finishes, and returns the result:
169
170
 
@@ -304,7 +305,7 @@ function pending(): string[] {
304
305
  }
305
306
  ```
306
307
 
307
- > The older methods `transcribeVideo()`, `extractVideoData()`, and `getTweetStatement()` still work with the same arguments. They now run as background jobs too, so they handle videos of any length. `extractVideoData()` no longer returns `video_info`; call `getTranscript({ video_url, metadata_only: true })` if you need it.
308
+ > The older methods `transcribeVideo()`, `extractVideoData()`, and `getTweetStatement()` still work with the same arguments. They now run as background jobs too, so they handle videos of any length.
308
309
 
309
310
  ### 4. Webhooks
310
311
 
@@ -467,6 +468,31 @@ for (const result of task.results) {
467
468
  - `sort_by` and `published_within` are applied by TikTok itself. If you leave out `sort_by`, results come back newest first. If you leave out `published_within` and set an `after_datetime` more than 24 hours ago, the smallest window that covers it is picked for you.
468
469
  - `parallel_search_slices` (`2` to `4`) runs several search chains in parallel to collect more results than TikTok's single-chain limit (about 115 to 140 items). Billing grows with the number of slices, so keep it at `1` unless you need the extra results, and especially when `published_within` is set, since every slice searches the same window.
469
470
 
471
+ - `country` picks whose TikTok results you get (`'fr'`, `'de'`, `'jp'`, ..., default `'gb'`). `'us'` is refused: TikTok asks US visitors to log in.
472
+ - Billing: 1 `residential_request` per 30 videos TikTok returned (`task.stats.videos_fetched`, including the ones your filters dropped), minimum 1 per search.
473
+
474
+ ### 6b. TikTok LIVE search (async)
475
+
476
+ `vn.tiktokLiveSearch()` finds TikTok LIVE rooms broadcasting right now for a keyword, with their stream URLs:
477
+
478
+ ```ts
479
+ const task = await vn.tiktokLiveSearch({ query: 'gaming', country: 'us' });
480
+
481
+ for (const room of task.results) {
482
+ console.log(room.title, room.author?.unique_id, room.stats?.viewers, room.category, room.hashtags);
483
+ const urls = room.stream_urls;
484
+ if (urls) {
485
+ const q = urls.default_quality ?? 'hd';
486
+ console.log('FLV:', urls.flv[q], 'HLS:', urls.hls[q], 'audio only:', urls.audio_only);
487
+ }
488
+ }
489
+ ```
490
+
491
+ - Each room has the same `id`, `url`, `author` and `stats` fields as a keyword search result, plus `started_at` (a `Date`), `stats.viewers` / `stats.total_viewers`, `hashtags` (the `#tags` of the title), `category` (the LIVE's category on TikTok, e.g. `'Gaming'`) and `game_tags`.
492
+ - `stream_urls` holds `flv` and `hls` URLs keyed by quality (`origin`, `uhd`, `hd`, `sd`, `ld`), `default_quality`, an `audio_only` stream and `expires_at`. The URLs play while the LIVE is on. They are returned by default; pass `include_stream_urls: false` to leave them out. Not every LIVE offers HLS, so `hls` can be empty.
493
+ - `country` defaults to `'us'`. Results keep TikTok's ranking; a keyword with no LIVE room in that country at that moment completes with zero results.
494
+ - Billing: 1 `residential_request` per 30 rooms TikTok returned (`task.stats.rooms_fetched`), minimum 1 per search.
495
+
470
496
  ### 7. Instagram carousel posts (multiple videos)
471
497
 
472
498
  Instagram carousel posts can contain multiple videos. You can select a specific video by index, or transcribe them all at once:
@@ -626,7 +652,7 @@ const { data } = await vn.extractVideoData({
626
652
 
627
653
  **Schema rules:** every field needs `type` and `description`. `Array` fields also need `items` (the schema of one element). `Object` fields list their sub-fields in `properties` (up to 10), and `Enum` fields list the allowed values in `enum`. At most 10 top-level fields and 3 levels of nesting. An invalid schema is rejected with a `BadRequestError` before anything runs.
628
654
 
629
- > `extractVideoData()` runs as a background job, so videos of any length work. For many extractions at once, use `vn.extractVideo.submit()` (see [Background jobs](#3-background-jobs-one-call-or-many-at-once)). The result has `data` and `usage`, but no `video_info`.
655
+ > `extractVideoData()` runs as a background job, so videos of any length work. For many extractions at once, use `vn.extractVideo.submit()` (see [Background jobs](#3-background-jobs-one-call-or-many-at-once)). The result has `data` (the extracted fields), `video_info` (the video's metadata), and `usage` when requested.
630
656
 
631
657
  ### 10. Semantic search
632
658
 
@@ -750,7 +776,7 @@ All methods return a `Promise`. Responses are automatically parsed into typed mo
750
776
 
751
777
  | Member | Description |
752
778
  |--------|-------------|
753
- | `vn.transcribe`, `vn.extractVideo`, `vn.tweetStatement`, `vn.tiktokProfile`, `vn.tiktokSearch` | Call directly to submit and wait for the result. Options: `include_usage`, `timeoutMs`, `intervalMs`, `fastStart`, `signal`, `onPoll` |
779
+ | `vn.transcribe`, `vn.extractVideo`, `vn.tweetStatement`, `vn.tiktokProfile`, `vn.tiktokSearch`, `vn.tiktokLiveSearch` | Call directly to submit and wait for the result. Options: `include_usage`, `timeoutMs`, `intervalMs`, `fastStart`, `signal`, `onPoll` |
754
780
  | `.submit(input, { include_usage? })` | Start the job and return a `Job` immediately |
755
781
  | `.resume(task_id, { include_usage? })` | Get a `Job` for a job you already started (no request is made) |
756
782
  | `job.task_id`, `job.job_type`, `job.check_status_url`, `job.webhook_url` | Job details from the submit response |
@@ -759,7 +785,7 @@ All methods return a `Promise`. Responses are automatically parsed into typed mo
759
785
  | `job.result(options?)` | Wait until finished and return the result. Throws on failure or timeout; every error carries `task_id` |
760
786
  | `job.wait(options?)` | Wait until finished and return the final task, without throwing on failure |
761
787
 
762
- Results: `transcribe` → same shape as `transcribeVideo()`; `extractVideo` → `{ data, usage? }`; `tweetStatement` → `TweetStatement`; `tiktokProfile` / `tiktokSearch` → the completed task with every page of `videos` / `results`.
788
+ Results: `transcribe` → same shape as `transcribeVideo()`; `extractVideo` → `{ data, video_info, usage? }`; `tweetStatement` → `TweetStatement`; `tiktokProfile` / `tiktokSearch` / `tiktokLiveSearch` → the completed task with every page of `videos` / `results`.
763
789
 
764
790
  ### Webhooks
765
791
 
@@ -769,7 +795,7 @@ Results: `transcribe` → same shape as `transcribeVideo()`; `extractVideo` →
769
795
  | `verifyWebhookSignature(rawBody, signatureHeader, secret, options?)` | Same check, returning `true` / `false` |
770
796
  | `WEBHOOK_HEADERS` | Header names: `signature`, `delivery`, `event`, `taskId` |
771
797
 
772
- `options`: `toleranceSeconds` (default `300`, `0` turns the check off). Event types: `transcribe.*`, `extract_video.*`, `tweet_statement.*`, `tiktok_profile.*`, `tiktok_search.*`, each with `.completed` or `.failed`.
798
+ `options`: `toleranceSeconds` (default `300`, `0` turns the check off). Event types: `transcribe.*`, `extract_video.*`, `tweet_statement.*`, `tiktok_profile.*`, `tiktok_search.*`, `tiktok_live_search.*`, each with `.completed` or `.failed`.
773
799
 
774
800
  ### TikTok
775
801
 
@@ -777,10 +803,13 @@ Results: `transcribe` → same shape as `transcribeVideo()`; `extractVideo` →
777
803
  |--------|-------------|
778
804
  | `tiktokProfile(urlOrInput, options?)` | Scrape a public profile and return the completed task with every video. See [Background jobs](#background-jobs) |
779
805
  | `tiktokSearch(queryOrInput, options?)` | Keyword search returning the completed task with every result |
806
+ | `tiktokLiveSearch(queryOrInput, options?)` | LIVE search returning the completed task with every room and its stream URLs |
780
807
  | `submitTikTokProfileScrape(payload)` | Lower-level: start a public TikTok profile scrape. Returns a `task_id` immediately. Options: `max_posts`, `after_datetime`, `before_datetime`, `min_likes`, `max_likes`, `webhook_url` |
781
808
  | `getTikTokProfileScrape(task_id, query?)` | Poll task status and retrieve a page of videos. Options: `cursor`, `limit`, `include_usage` |
782
- | `submitTikTokSearch(payload)` | Start an async TikTok keyword search. Returns a `task_id` immediately. Options: `max_results`, `parallel_search_slices`, `sort_by`, `published_within`, `after_datetime`, `before_datetime`, `min_likes`, `max_likes`, `min_views`, `max_views`, `webhook_url` |
809
+ | `submitTikTokSearch(payload)` | Start an async TikTok keyword search. Returns a `task_id` immediately. Options: `max_results`, `parallel_search_slices`, `sort_by`, `published_within`, `after_datetime`, `before_datetime`, `min_likes`, `max_likes`, `min_views`, `max_views`, `country`, `webhook_url` |
783
810
  | `getTikTokSearch(task_id, query?)` | Poll search status and retrieve a page of results. Options: `cursor`, `limit`, `include_usage` |
811
+ | `submitTikTokLiveSearch(payload)` | Start an async TikTok LIVE search. Returns a `task_id` immediately. Options: `max_results`, `country`, `include_stream_urls`, `webhook_url` |
812
+ | `getTikTokLiveSearch(task_id, query?)` | Poll LIVE search status and retrieve a page of rooms. Options: `cursor`, `limit`, `include_usage` |
784
813
 
785
814
  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. Failed tasks include `error` (`{ error, message, http_status }`); the older `error_message` string still works but is deprecated. 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.
786
815
 
@@ -828,7 +857,7 @@ Returns `transcript_analysis` containing:
828
857
 
829
858
  | Method | Description |
830
859
  |--------|-------------|
831
- | `extractVideo(input, options?)` | Structured data from an online video of any length. Input: `video_url`, `schema` or `schemaFilePath`, `what_to_extract`, `transcribe`, `webhook_url`. Returns `{ data, usage? }` |
860
+ | `extractVideo(input, options?)` | Structured data from an online video of any length. Input: `video_url`, `schema` or `schemaFilePath`, `what_to_extract`, `transcribe`, `webhook_url`. Returns `{ data, video_info, usage? }` |
832
861
  | `extractVideoData(payload, options?)` | Same as `extractVideo()`, with the original payload shape (`include_usage` in the payload) |
833
862
  | `extractFileData(payload)` | Extract structured data from an uploaded file transcript |
834
863
 
@@ -926,6 +955,9 @@ All API responses are parsed into typed classes with static `fromJSON()` constru
926
955
  | `TikTokSearchSubmission` | Async TikTok keyword search submission: `task_id`, query, slice count, expiry, `webhook_url` |
927
956
  | `TikTokSearchTask` | TikTok keyword search task with status, results, pagination, `download_url`, `error`, `webhook`; `stats` shows the `sort_by` / `published_within` the search ran with |
928
957
  | `TikTokSearchResult` | Normalized TikTok keyword result, including `published_at` as a `Date` and integer counters |
958
+ | `TikTokLiveSearchSubmission` | Async TikTok LIVE search submission: `task_id`, query, country, `include_stream_urls`, expiry, `webhook_url` |
959
+ | `TikTokLiveSearchTask` | TikTok LIVE search task with status, rooms, pagination, `download_url`, `error`, `webhook`; `stats.rooms_fetched` is what is billed |
960
+ | `TikTokLiveRoom` | A LIVE room: author, `stats.viewers`, `hashtags`, `category`, `game_tags`, `started_at` as a `Date`, and `stream_urls` (FLV / HLS by quality, audio only) |
929
961
  | `TweetStatement` | Structured X/Twitter claim analysis, topics, entities, tone, intent, and source text |
930
962
 
931
963
  ## Links
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
- import { VideoInfo, TranscriptOutput, FileInfo, AnalysisResult, VideoSearchResult, FileSearchResult, UsageData, Namespace, NamespaceRef, ExtractionSchema, UsageBlock, CarouselInfo, CarouselVideoResult, TikTokProfileScrapeRequest, TikTokProfileScrapeSubmission, TikTokProfileTask, TikTokSearchRequest, TikTokSearchSubmission, TikTokSearchTask, TweetStatement, AsyncJob } from './models';
2
+ import { VideoInfo, TranscriptOutput, FileInfo, AnalysisResult, VideoSearchResult, FileSearchResult, UsageData, Namespace, NamespaceRef, ExtractionSchema, UsageBlock, CarouselInfo, CarouselVideoResult, TikTokProfileScrapeRequest, TikTokProfileScrapeSubmission, TikTokProfileTask, TikTokSearchRequest, TikTokSearchSubmission, TikTokSearchTask, TikTokLiveSearchRequest, TikTokLiveSearchSubmission, TikTokLiveSearchTask, TweetStatement, AsyncJob } from './models';
3
3
  import { Job, JobOperation, PollOptions, RunOptions, SubmitOptions } from './jobs';
4
4
  export * from './models';
5
5
  export * from './errors';
@@ -7,7 +7,7 @@ export * from './webhooks';
7
7
  export { Job } from './jobs';
8
8
  export type { TaskStatus, PollableTask, PollOptions, JobOperation, SubmitOptions, RunOptions, JobInfo } from './jobs';
9
9
  /** SDK version (keep in sync with package.json) */
10
- export declare const SDK_VERSION = "2.0.0";
10
+ export declare const SDK_VERSION = "2.2.0";
11
11
  export interface SDKConfig {
12
12
  apiKey: string;
13
13
  baseURL?: string;
@@ -103,6 +103,8 @@ export type TweetStatementJob = Job<TweetStatementAsyncJob, TweetStatement>;
103
103
  export type TikTokProfileJob = Job<TikTokProfileTask, TikTokProfileTask>;
104
104
  /** `result()` resolves to the completed task with **all** pages of `results` collected. */
105
105
  export type TikTokSearchJob = Job<TikTokSearchTask, TikTokSearchTask>;
106
+ /** `result()` resolves to the completed task with **all** pages of rooms collected. */
107
+ export type TikTokLiveSearchJob = Job<TikTokLiveSearchTask, TikTokLiveSearchTask>;
106
108
  export type UploadFileSuccessResult = {
107
109
  status: 'success';
108
110
  file_id: string;
@@ -247,6 +249,12 @@ export declare class VidNavigatorClient {
247
249
  * every page of `results` collected. Same shapes as {@link VidNavigatorClient.transcribe}.
248
250
  */
249
251
  readonly tiktokSearch: JobOperation<string | TikTokSearchRequest, TikTokSearchTask, TikTokSearchTask>;
252
+ /**
253
+ * TikTok LIVE search, built on `POST /tiktok/live/search`: rooms broadcasting now for a keyword,
254
+ * with their FLV / HLS / audio-only stream URLs. The result is the completed task with every
255
+ * page of `results` collected. Same shapes as {@link VidNavigatorClient.transcribe}.
256
+ */
257
+ readonly tiktokLiveSearch: JobOperation<string | TikTokLiveSearchRequest, TikTokLiveSearchTask, TikTokLiveSearchTask>;
250
258
  constructor(config: SDKConfig);
251
259
  private defineOperation;
252
260
  private submitAsyncJob;
@@ -255,7 +263,7 @@ export declare class VidNavigatorClient {
255
263
  private request;
256
264
  /**
257
265
  * Get a transcript for any supported video. The endpoint auto-detects the
258
- * platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, etc.)
266
+ * platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, Snapchat, etc.)
259
267
  * from `video_url`. For Instagram, use {@link VidNavigatorClient.transcribeVideo}.
260
268
  */
261
269
  getTranscript(payload: TranscriptRequestPayload): Promise<TranscriptResult>;
@@ -282,6 +290,12 @@ export declare class VidNavigatorClient {
282
290
  limit?: number;
283
291
  include_usage?: boolean;
284
292
  }): Promise<TikTokSearchTask>;
293
+ submitTikTokLiveSearch(payload: TikTokLiveSearchRequest): Promise<TikTokLiveSearchSubmission>;
294
+ getTikTokLiveSearch(task_id: string, query?: {
295
+ cursor?: string;
296
+ limit?: number;
297
+ include_usage?: boolean;
298
+ }): Promise<TikTokLiveSearchTask>;
285
299
  getFiles(query?: {
286
300
  limit?: number;
287
301
  offset?: number;
@@ -354,8 +368,7 @@ export declare class VidNavigatorClient {
354
368
  /**
355
369
  * Structured-data extraction from an online video. Blocking convenience wrapper around
356
370
  * {@link VidNavigatorClient.extractVideo}: submits to `POST /extract/video/async` and polls, so
357
- * media of any length works. The async API does not return `video_info`; use
358
- * {@link VidNavigatorClient.getTranscript} with `metadata_only: true` if you need it.
371
+ * media of any length works. The result carries the extracted `data` and the video's `video_info`.
359
372
  */
360
373
  extractVideoData(payload: ExtractVideoDataPayload | ExtractVideoDataMultipartPayload, options?: PollOptions<ExtractVideoAsyncJob>): Promise<ExtractDataResult>;
361
374
  extractFileData(payload: ExtractFileDataPayload | ExtractFileDataMultipartPayload): Promise<ExtractDataResult>;
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ __exportStar(require("./webhooks"), exports);
31
31
  var jobs_2 = require("./jobs");
32
32
  Object.defineProperty(exports, "Job", { enumerable: true, get: function () { return jobs_2.Job; } });
33
33
  /** SDK version (keep in sync with package.json) */
34
- exports.SDK_VERSION = '2.0.0';
34
+ exports.SDK_VERSION = '2.2.0';
35
35
  //endregion
36
36
  function parseTranscribeData(inner, usage) {
37
37
  if ('videos' in inner && 'carousel_info' in inner) {
@@ -127,7 +127,7 @@ class VidNavigatorClient {
127
127
  jobType: 'extract_video',
128
128
  submit: (input) => this.submitExtractVideo(input),
129
129
  fetchTask: (task_id, options) => this.getAsyncJob(`/extract/video/${encodeURIComponent(task_id)}`, options, (raw) => raw),
130
- toResult: async (task) => ({ data: requireResult(task), usage: task.usage }),
130
+ toResult: async (task) => ({ data: requireResult(task), video_info: task.video_info, usage: task.usage }),
131
131
  });
132
132
  this.tweetStatement = this.defineOperation({
133
133
  jobType: 'tweet_statement',
@@ -158,6 +158,15 @@ class VidNavigatorClient {
158
158
  fetchTask: (task_id) => this.getTikTokSearch(task_id, { limit: 1 }),
159
159
  toResult: (task, options) => collectAllPages((query) => this.getTikTokSearch(task.task_id, query), (page) => page.results, (page, all) => { page.results = all; }, options.include_usage),
160
160
  });
161
+ this.tiktokLiveSearch = this.defineOperation({
162
+ jobType: 'tiktok_live_search',
163
+ submit: async (input) => {
164
+ const sub = await this.submitTikTokLiveSearch(typeof input === 'string' ? { query: input } : input);
165
+ return { ...sub, job_type: 'tiktok_live_search' };
166
+ },
167
+ fetchTask: (task_id) => this.getTikTokLiveSearch(task_id, { limit: 1 }),
168
+ toResult: (task, options) => collectAllPages((query) => this.getTikTokLiveSearch(task.task_id, query), (page) => page.results, (page, all) => { page.results = all; }, options.include_usage),
169
+ });
161
170
  }
162
171
  defineOperation(spec) {
163
172
  const makeJob = (info, options = {}) => new jobs_1.Job(info, () => spec.fetchTask(info.task_id, options), (task) => spec.toResult(task, options));
@@ -217,7 +226,7 @@ class VidNavigatorClient {
217
226
  //region --- Transcripts ---
218
227
  /**
219
228
  * Get a transcript for any supported video. The endpoint auto-detects the
220
- * platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, etc.)
229
+ * platform (YouTube, Vimeo, X/Twitter, TikTok, Facebook, Dailymotion, Loom, Snapchat, etc.)
221
230
  * from `video_url`. For Instagram, use {@link VidNavigatorClient.transcribeVideo}.
222
231
  */
223
232
  async getTranscript(payload) {
@@ -269,6 +278,17 @@ class VidNavigatorClient {
269
278
  task.usage = models_1.UsageBlock.fromJSON(response.usage);
270
279
  return task;
271
280
  }
281
+ async submitTikTokLiveSearch(payload) {
282
+ const response = await this.request('POST', '/tiktok/live/search', payload);
283
+ return models_1.TikTokLiveSearchSubmission.fromJSON(response.data);
284
+ }
285
+ async getTikTokLiveSearch(task_id, query) {
286
+ const response = await this.request('GET', `/tiktok/live/search/${task_id}`, undefined, buildTikTokPollParams(query));
287
+ const task = models_1.TikTokLiveSearchTask.fromJSON(response.data);
288
+ if (response.usage)
289
+ task.usage = models_1.UsageBlock.fromJSON(response.usage);
290
+ return task;
291
+ }
272
292
  //endregion
273
293
  //region --- Files ---
274
294
  async getFiles(query) {
@@ -402,8 +422,7 @@ class VidNavigatorClient {
402
422
  /**
403
423
  * Structured-data extraction from an online video. Blocking convenience wrapper around
404
424
  * {@link VidNavigatorClient.extractVideo}: submits to `POST /extract/video/async` and polls, so
405
- * media of any length works. The async API does not return `video_info`; use
406
- * {@link VidNavigatorClient.getTranscript} with `metadata_only: true` if you need it.
425
+ * media of any length works. The result carries the extracted `data` and the video's `video_info`.
407
426
  */
408
427
  async extractVideoData(payload, options) {
409
428
  const { include_usage, ...input } = payload;
@@ -1,4 +1,5 @@
1
1
  import { UsageBlock } from './Usage';
2
+ import { VideoInfo, VideoInfoJSON } from './VideoInfo';
2
3
  /** Async job kinds returned by the `/transcribe/async`, `/extract/video/async` and `/tweet/statement/async` endpoints. */
3
4
  export type AsyncJobType = 'transcribe' | 'extract_video' | 'tweet_statement';
4
5
  /** `processing` = accepted and being worked on. `completed` and `failed` are terminal. */
@@ -63,6 +64,8 @@ export interface AsyncJobJSON {
63
64
  check_status_url?: string;
64
65
  webhook?: AsyncJobWebhookStatus | null;
65
66
  result?: any;
67
+ /** `extract_video` jobs, once completed: the `video_info` the synchronous endpoint returns. */
68
+ video_info?: VideoInfoJSON;
66
69
  error?: AsyncJobError | null;
67
70
  }
68
71
  /**
@@ -84,6 +87,8 @@ export declare class AsyncJob<TResult> {
84
87
  check_status_url?: string;
85
88
  webhook?: AsyncJobWebhookStatus | null;
86
89
  result: TResult | null;
90
+ /** `extract_video` jobs, once completed: metadata of the video the data was extracted from. */
91
+ video_info?: VideoInfo;
87
92
  error: AsyncJobError | null;
88
93
  /** Per-call usage, populated only when polled with `include_usage: true` and `task_status === 'completed'`. */
89
94
  usage?: UsageBlock;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AsyncJob = exports.AsyncJobAccepted = void 0;
4
+ const VideoInfo_1 = require("./VideoInfo");
4
5
  /** 202 response from an async submit endpoint. Poll with the matching `get...AsyncJob(task_id)` method. */
5
6
  class AsyncJobAccepted {
6
7
  constructor(data) {
@@ -36,6 +37,7 @@ class AsyncJob {
36
37
  this.check_status_url = data.check_status_url;
37
38
  this.webhook = data.webhook;
38
39
  this.result = data.result !== undefined && data.result !== null ? parseResult(data.result) : null;
40
+ this.video_info = data.video_info ? VideoInfo_1.VideoInfo.fromJSON(data.video_info) : undefined;
39
41
  this.error = data.error ?? null;
40
42
  }
41
43
  static fromJSON(json, parseResult) {
@@ -37,6 +37,11 @@ export interface TikTokSearchRequest {
37
37
  max_likes?: number;
38
38
  min_views?: number;
39
39
  max_views?: number;
40
+ /**
41
+ * Two-letter country code (`'fr'`, `'de'`, `'jp'`, ...) whose TikTok results you get. Default `'gb'`.
42
+ * `'us'` is refused: TikTok asks US visitors to log in. The API lists the accepted codes.
43
+ */
44
+ country?: string;
40
45
  /**
41
46
  * Where to POST a notification when the task finishes. Overrides the account-level default
42
47
  * configured in Studio → API; pass an empty string to opt this task out of that default.
@@ -70,6 +75,7 @@ export interface TikTokSearchSubmissionJSON {
70
75
  task_id: string;
71
76
  task_status: 'processing';
72
77
  query: string;
78
+ country?: string;
73
79
  max_results?: number;
74
80
  parallel_search_slices?: number;
75
81
  filters?: Record<string, unknown>;
@@ -82,6 +88,8 @@ export declare class TikTokSearchSubmission {
82
88
  task_id: string;
83
89
  task_status: 'processing';
84
90
  query: string;
91
+ /** Country whose TikTok results the search returns. */
92
+ country?: string;
85
93
  max_results?: number;
86
94
  parallel_search_slices?: number;
87
95
  filters?: Record<string, unknown>;
@@ -207,12 +215,27 @@ export interface TikTokSearchFilters {
207
215
  }
208
216
  export interface TikTokSearchStats {
209
217
  pages_fetched?: number;
218
+ /**
219
+ * Distinct videos TikTok returned, including those your filters dropped. Billed at
220
+ * 1 `residential_request` per 30, minimum 1 per search.
221
+ */
222
+ videos_fetched?: number;
210
223
  results_count?: number;
211
224
  next_search_cursor?: number | null;
225
+ /** Slice count the search actually ran with. */
226
+ parallel_search_slices?: number;
212
227
  /** Sort order the search ran with (`relevance` when `sort_by` was omitted). */
213
228
  sort_by?: TikTokSearchSortBy;
214
229
  /** Date window the search ran with; `all` means no window. */
215
230
  published_within?: TikTokPublishedWithin;
231
+ /** Country whose TikTok results the search returned. */
232
+ country?: string;
233
+ /** Only when filters were set: videos checked against them. */
234
+ items_examined?: number;
235
+ /** Only when filters were set: videos they dropped. */
236
+ items_filtered_out?: number;
237
+ /** Only with `parallel_search_slices` > 1: videos several slices returned, counted once. */
238
+ items_deduplicated?: number;
216
239
  }
217
240
  export interface TikTokProfileTaskJSON {
218
241
  task_id: string;
@@ -259,6 +282,7 @@ export interface TikTokSearchTaskJSON {
259
282
  task_id: string;
260
283
  task_status: 'processing' | 'completed' | 'failed';
261
284
  query?: string;
285
+ country?: string;
262
286
  parallel_search_slices?: number;
263
287
  filters?: TikTokSearchFilters;
264
288
  stats?: TikTokSearchStats;
@@ -276,6 +300,8 @@ export declare class TikTokSearchTask {
276
300
  task_id: string;
277
301
  task_status: 'processing' | 'completed' | 'failed';
278
302
  query?: string;
303
+ /** Country whose TikTok results the search returned (`gb` by default). */
304
+ country?: string;
279
305
  parallel_search_slices?: number;
280
306
  filters?: TikTokSearchFilters;
281
307
  stats?: TikTokSearchStats;
@@ -296,3 +322,175 @@ export declare class TikTokSearchTask {
296
322
  constructor(data: TikTokSearchTaskJSON);
297
323
  static fromJSON(json: TikTokSearchTaskJSON): TikTokSearchTask;
298
324
  }
325
+ export interface TikTokLiveSearchRequest {
326
+ query: string;
327
+ /** Cap on rooms. `0` or omitted means as many as TikTok serves, about 50 per keyword. */
328
+ max_results?: number;
329
+ /** Two-letter country code whose LIVE rooms you get. Default `'us'`. The API lists the accepted codes. */
330
+ country?: string;
331
+ /**
332
+ * The API returns each room's playback URLs by default (FLV and HLS by quality, plus an
333
+ * audio-only stream). Pass `false` to leave them out.
334
+ */
335
+ include_stream_urls?: boolean;
336
+ /**
337
+ * Where to POST a notification when the task finishes. Overrides the account-level default
338
+ * configured in Studio → API; pass an empty string to opt this task out of that default.
339
+ * The event's `data.result` is a summary; read the rooms with `vn.tiktokLiveSearch.resume(task_id).result()`.
340
+ */
341
+ webhook_url?: string;
342
+ }
343
+ export interface TikTokLiveSearchSubmissionJSON {
344
+ task_id: string;
345
+ task_status: 'processing';
346
+ query: string;
347
+ country?: string;
348
+ max_results?: number;
349
+ include_stream_urls?: boolean;
350
+ expires_at?: string;
351
+ check_status_url?: string;
352
+ message?: string;
353
+ webhook_url?: string | null;
354
+ }
355
+ export declare class TikTokLiveSearchSubmission {
356
+ task_id: string;
357
+ task_status: 'processing';
358
+ query: string;
359
+ country?: string;
360
+ max_results?: number;
361
+ include_stream_urls?: boolean;
362
+ expires_at?: string;
363
+ check_status_url?: string;
364
+ message?: string;
365
+ /** The URL this task's result notification will be POSTed to, or `null`. */
366
+ webhook_url?: string | null;
367
+ constructor(data: TikTokLiveSearchSubmissionJSON);
368
+ static fromJSON(json: TikTokLiveSearchSubmissionJSON): TikTokLiveSearchSubmission;
369
+ }
370
+ export interface TikTokLiveAuthor {
371
+ id?: string | null;
372
+ /** Username, without @. */
373
+ unique_id?: string | null;
374
+ nickname?: string | null;
375
+ sec_uid?: string | null;
376
+ followers?: number | null;
377
+ avatar_url?: string | null;
378
+ }
379
+ export interface TikTokLiveStats {
380
+ /** Watching when the search ran. */
381
+ viewers?: number | null;
382
+ /** Since the LIVE started. */
383
+ total_viewers?: number | null;
384
+ likes?: number | null;
385
+ comments?: number | null;
386
+ shares?: number | null;
387
+ }
388
+ /** Quality keys of the playback URLs: those the LIVE offers, best first. */
389
+ export type TikTokLiveQuality = 'origin' | 'uhd' | 'hd' | 'sd' | 'ld' | (string & {});
390
+ export interface TikTokLiveStreamUrlsJSON {
391
+ default_quality?: TikTokLiveQuality | null;
392
+ flv?: Record<string, string>;
393
+ hls?: Record<string, string>;
394
+ audio_only?: string | null;
395
+ expires_at?: string | null;
396
+ }
397
+ /** Playback URLs of a LIVE room. They stop working when the LIVE ends. */
398
+ export interface TikTokLiveStreamUrls {
399
+ /** The quality TikTok plays by default (a key of `flv`). */
400
+ default_quality: TikTokLiveQuality | null;
401
+ /** HTTP-FLV URLs keyed by quality. */
402
+ flv: Record<string, string>;
403
+ /** HLS (`.m3u8`) URLs keyed by quality, when TikTok provides them. Can be empty. */
404
+ hls: Record<string, string>;
405
+ /** HTTP-FLV URL of the audio-only stream. */
406
+ audio_only: string | null;
407
+ /** Expiry of the URL signatures. */
408
+ expires_at: Date | null;
409
+ }
410
+ export interface TikTokLiveRoomJSON {
411
+ id?: string | null;
412
+ title?: string | null;
413
+ url?: string | null;
414
+ started_at?: string | null;
415
+ author?: TikTokLiveAuthor;
416
+ stats?: TikTokLiveStats;
417
+ hashtags?: string[];
418
+ category?: string | null;
419
+ game_tags?: string[];
420
+ cover_url?: string | null;
421
+ stream_urls?: TikTokLiveStreamUrlsJSON;
422
+ }
423
+ /** A TikTok LIVE room that was broadcasting when the search ran. */
424
+ export declare class TikTokLiveRoom {
425
+ id?: string | null;
426
+ title?: string | null;
427
+ /** `https://www.tiktok.com/@username/live` */
428
+ url?: string | null;
429
+ started_at?: Date | null;
430
+ author?: TikTokLiveAuthor;
431
+ stats?: TikTokLiveStats;
432
+ /** `#tags` written in the title, without `#`. */
433
+ hashtags: string[];
434
+ /** The LIVE's category on TikTok, e.g. `'Gaming'`. */
435
+ category?: string | null;
436
+ game_tags: string[];
437
+ cover_url?: string | null;
438
+ /** Absent when the search was submitted with `include_stream_urls: false`. */
439
+ stream_urls?: TikTokLiveStreamUrls;
440
+ constructor(data: TikTokLiveRoomJSON);
441
+ static fromJSON(json: TikTokLiveRoomJSON): TikTokLiveRoom;
442
+ }
443
+ export interface TikTokLiveSearchStats {
444
+ /** TikTok pages fetched (up to 50 rooms each). */
445
+ pages_fetched?: number;
446
+ /**
447
+ * Distinct rooms TikTok returned, including any past `max_results`. Billed at
448
+ * 1 `residential_request` per 30, minimum 1 per search.
449
+ */
450
+ rooms_fetched?: number;
451
+ results_count?: number;
452
+ /** Whether TikTok had more rooms when the search stopped. */
453
+ has_more?: boolean;
454
+ country?: string;
455
+ }
456
+ export interface TikTokLiveSearchTaskJSON {
457
+ task_id: string;
458
+ task_status: 'processing' | 'completed' | 'failed';
459
+ query?: string;
460
+ country?: string;
461
+ stats?: TikTokLiveSearchStats;
462
+ results?: TikTokLiveRoomJSON[];
463
+ pagination?: TikTokProfilePagination;
464
+ download_url?: string | null;
465
+ error_message?: string | null;
466
+ created_at?: string | null;
467
+ completed_at?: string | null;
468
+ expires_at?: string | null;
469
+ error?: AsyncJobError | null;
470
+ webhook?: AsyncJobWebhookStatus | null;
471
+ }
472
+ export declare class TikTokLiveSearchTask {
473
+ task_id: string;
474
+ task_status: 'processing' | 'completed' | 'failed';
475
+ query?: string;
476
+ /** Country whose LIVE rooms the search returned (`us` by default). */
477
+ country?: string;
478
+ stats?: TikTokLiveSearchStats;
479
+ /** Rooms in TikTok's ranking. */
480
+ results: TikTokLiveRoom[];
481
+ pagination?: TikTokProfilePagination;
482
+ download_url?: string | null;
483
+ /** @deprecated Use `error`, which carries a machine-readable code. */
484
+ error_message?: string | null;
485
+ created_at?: string | null;
486
+ completed_at?: string | null;
487
+ expires_at?: string | null;
488
+ /** Present when `task_status === 'failed'`: error code, message and HTTP status. */
489
+ error: AsyncJobError | null;
490
+ /** Webhook delivery state, or `null` when no webhook was configured. */
491
+ webhook?: AsyncJobWebhookStatus | null;
492
+ /** Per-call usage, populated only when polled with `include_usage=true` and `task_status=completed`. */
493
+ usage?: UsageBlock;
494
+ constructor(data: TikTokLiveSearchTaskJSON);
495
+ static fromJSON(json: TikTokLiveSearchTaskJSON): TikTokLiveSearchTask;
496
+ }