ugcinc 4.19.1 → 4.20.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 +125 -8
- package/dist/automations/nodes/index.d.ts +1 -1
- package/dist/automations/nodes/remotion-composition.d.ts +2 -2
- package/dist/base.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/media.d.ts +5 -0
- package/dist/media.js +16 -0
- package/dist/render/types/remotion-composition.d.ts +8 -8
- package/dist/social-acquisition.d.ts +85 -0
- package/dist/social-acquisition.js +2 -0
- package/dist/tools/media.js +12 -0
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ if (res.ok) {
|
|
|
43
43
|
|
|
44
44
|
- `client.accounts`: list, create, update, troubleshoot, quarantine/release, and manage account lifecycle
|
|
45
45
|
- `client.posts`: create video/slideshow posts, update them, retry failures, and preview schedule conflicts
|
|
46
|
-
- `client.media`: upload media, create media records, manage tags/names, and work with social audio
|
|
46
|
+
- `client.media`: upload media, create media records, search profile-picture candidates, search images and videos by keyword (`media.imageSearch`, cursor-paged), manage tags/names, and work with social audio
|
|
47
47
|
- `client.stats`: fetch account/post analytics, daily aggregates, top performers, and refresh stats
|
|
48
48
|
- `client.org`: manage organizations, API keys, and integration keys
|
|
49
49
|
- `client.billing`: inspect subscription state and handle account deactivation, replacements, and refunds
|
|
@@ -74,6 +74,20 @@ if (posts.ok) {
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
## Posting failure quick reference
|
|
78
|
+
|
|
79
|
+
`posts.getStatus()` returns `failure`; both `getPosts()` and `getPostsPage()` include it on each post. It is `null` when there is no current posting issue. A successful lookup still returns HTTP 200 even if the post failed.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const result = await client.posts.getStatus({ postId: "post_123" });
|
|
83
|
+
if (result.ok && result.data.failure) {
|
|
84
|
+
const { code, message, recovery, next_action } = result.data.failure;
|
|
85
|
+
console.log(code, message, recovery, next_action);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See the posting failure reference below for recovery states and messages.
|
|
90
|
+
|
|
77
91
|
## Pagination
|
|
78
92
|
|
|
79
93
|
`accounts.getAccounts()` and `posts.getPosts()` support keyset pagination via `limit`/`cursor`.
|
|
@@ -93,6 +107,28 @@ do {
|
|
|
93
107
|
} while (cursor);
|
|
94
108
|
```
|
|
95
109
|
|
|
110
|
+
For interactive tables, `posts.getPostsPage()` keeps filtering and sorting on the server and
|
|
111
|
+
returns page-scoped latest stats plus `totalCount`, organization-wide `postTags`,
|
|
112
|
+
`anyHasTitle`, and `matchingAccountIds`. It supports caption/title/account search; platform,
|
|
113
|
+
post type, status, account, account-tag, post-tag, social-audio, and phone-type filters; and
|
|
114
|
+
sorting by account, status, title, caption, tag, audio presence, scheduled time, or engagement:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
const page = await client.posts.getPostsPage({
|
|
118
|
+
search: "launch",
|
|
119
|
+
statuses: ["complete"],
|
|
120
|
+
postTags: ["fall-campaign"],
|
|
121
|
+
sortBy: "views",
|
|
122
|
+
sortDirection: "desc",
|
|
123
|
+
limit: 200,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
if (page.ok) {
|
|
127
|
+
console.log(page.data.posts, page.data.stats, page.data.totalCount);
|
|
128
|
+
const next = page.data.nextCursor;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
96
132
|
## Caption Overlays
|
|
97
133
|
|
|
98
134
|
Video posts can carry text overlays to display on the video. Pass `captionOverlays` to
|
|
@@ -144,6 +180,28 @@ await client.posts.createVideo({
|
|
|
144
180
|
await client.posts.updatePost({ postId: "post_123", post_tag: "campaign-august" });
|
|
145
181
|
```
|
|
146
182
|
|
|
183
|
+
When a post fails, its category is appended to the tag as `fail reason: <fail_category>` (for
|
|
184
|
+
example `campaign-july fail reason: device_error`), so a post list shows why without a status call
|
|
185
|
+
per post. The suffix is removed again when the post is retried.
|
|
186
|
+
|
|
187
|
+
## Backup Audio
|
|
188
|
+
|
|
189
|
+
A post can carry a second sound. If the platform refuses the primary sound at posting time, the
|
|
190
|
+
backup becomes the post's `social_audio_id`, the post is re-attempted once, ` switched to backup
|
|
191
|
+
audio` is appended to its `tag`, and `backup_audio_used_at` is set. With no backup left the post
|
|
192
|
+
fails as `audio_unavailable` and is not retried. Set it with `backupSocialAudioId` on
|
|
193
|
+
`posts.createVideo()`, `posts.createSlideshow()`, `posts.createDraft()`, and `posts.updatePost()`
|
|
194
|
+
(`null` clears it on update).
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
await client.posts.createSlideshow({
|
|
198
|
+
accountId: "acc_123",
|
|
199
|
+
imageUrls: ["https://example.com/img1.jpg"],
|
|
200
|
+
socialAudioId: "audio_primary",
|
|
201
|
+
backupSocialAudioId: "audio_fallback",
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
147
205
|
## Useful Exports
|
|
148
206
|
|
|
149
207
|
- `UGCClient` for API access
|
|
@@ -162,6 +220,33 @@ For the full endpoint reference, all method signatures, data structures, and wor
|
|
|
162
220
|
|
|
163
221
|
MIT
|
|
164
222
|
|
|
223
|
+
## Posting failure reference
|
|
224
|
+
|
|
225
|
+
The same `failure` object is returned by status and list responses. It contains a stable `code`, a fixed `message`, a `recovery` state, and `next_action`.
|
|
226
|
+
|
|
227
|
+
| Recovery | Meaning |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `retry_pending` | The existing post is waiting for another attempt; no execution time is guaranteed. |
|
|
230
|
+
| `waiting` | The existing post is paused until a publishing issue is resolved. |
|
|
231
|
+
| `verifying_publication` | Publication is being checked before another attempt is allowed. |
|
|
232
|
+
| `stopped` | No automatic recovery is indicated. Follow `next_action`. |
|
|
233
|
+
|
|
234
|
+
`next_action` is `wait`, `change_audio`, `change_audio_or_contact_support`, or `contact_support`. When it is `wait`, do not submit another copy. Account and publishing operations are handled by the service; these messages never ask customers to manage them.
|
|
235
|
+
|
|
236
|
+
| Code | Message |
|
|
237
|
+
|---|---|
|
|
238
|
+
| `AUDIO_UNAVAILABLE` | The selected sound is unavailable. Choose another sound and retry. |
|
|
239
|
+
| `BACKUP_AUDIO_RETRY_PENDING` | The selected sound was unavailable. Your post is waiting to be retried with its backup sound. |
|
|
240
|
+
| `AUDIO_RETRY_PENDING` | The selected sound could not be loaded. Your post is waiting to be retried. |
|
|
241
|
+
| `AUDIO_PREPARATION_FAILED` | The selected sound could not be prepared for this post. Choose another sound or contact support before retrying. |
|
|
242
|
+
| `PUBLISHING_RETRY_PENDING` | Publishing was temporarily interrupted. Your post is waiting to be retried. No action is needed. |
|
|
243
|
+
| `PUBLISHING_BLOCKED` | A publishing issue prevented this post from proceeding. Contact support for help with this post. |
|
|
244
|
+
| `POST_PROCESSING_FAILED` | A processing error prevented this posting attempt from completing. Contact support before retrying. |
|
|
245
|
+
| `PUBLICATION_CHECK_IN_PROGRESS` | We’re checking whether your post published. Please wait before submitting it again to avoid a duplicate. |
|
|
246
|
+
| `PUBLICATION_UNCONFIRMED` | We couldn’t confirm whether your post published. Contact support before submitting it again to avoid a duplicate. |
|
|
247
|
+
| `POST_RETRY_PENDING` | The previous posting attempt did not complete. Your post is waiting to be retried. No action is needed. |
|
|
248
|
+
| `POST_FAILED` | The posting attempt failed, but we couldn’t determine the cause. Contact support before submitting it again. |
|
|
249
|
+
|
|
165
250
|
### Render a supplied Remotion composition
|
|
166
251
|
|
|
167
252
|
`remotion-composition` accepts a TSX module whose default export is a React
|
|
@@ -196,11 +281,43 @@ status/logs to inspect failures and the returned video for preview.
|
|
|
196
281
|
Server integrations can also call `submitRemotionCompositionRenderJob` and
|
|
197
282
|
`getRenderJobStatus` with the configured render-worker origin.
|
|
198
283
|
|
|
199
|
-
|
|
284
|
+
## Social reference acquisition
|
|
285
|
+
|
|
286
|
+
Quick reference:
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
const page = await client.media.listProfilePosts({ url: profileUrl, limit: 20 });
|
|
290
|
+
const post = await client.media.downloadSocialPost({ url: postUrl });
|
|
291
|
+
```
|
|
200
292
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
293
|
+
`media.listProfilePosts({url, limit?, cursor?})` calls `POST /media/social/list-profile-posts`.
|
|
294
|
+
Supported profiles are TikTok and Instagram. Limit defaults to 20 (1–50). Results include
|
|
295
|
+
`profile`, `posts`, `nextCursor`, `coverage` and `warnings`. Pass `nextCursor` back with
|
|
296
|
+
the same profile URL. Cursors expire after one hour and belong to the authenticated
|
|
297
|
+
organization. Short pages may still have a cursor. Instagram combines posts and reels;
|
|
298
|
+
ordering follows those feeds, not a guaranteed chronological snapshot. `exhausted`
|
|
299
|
+
means the available feeds ended, not that all historical posts are visible. Thumbnail
|
|
300
|
+
URLs are upstream references and may expire. Listing does not import media.
|
|
301
|
+
|
|
302
|
+
`media.downloadSocialPost({url})` calls `POST /media/social/download-post` until the
|
|
303
|
+
checkpointed import finishes. Inputs are TikTok video/photo or Instagram post/reel
|
|
304
|
+
URLs, including supported share redirects. The raw HTTP endpoint returns `processing`
|
|
305
|
+
while another continuation is needed; call it again with the same URL. The SDK/tool
|
|
306
|
+
handles these calls. Imports have `complete`, `partial` or `failed` status, ordered
|
|
307
|
+
`assets`, `failedAssets`, post metadata, sound attribution, provenance and an owned
|
|
308
|
+
JSON `manifestUrl`. Assets contain owned URLs, media IDs, SHA-256 hashes, probed
|
|
309
|
+
format/dimensions/duration and embedded audio presence. A successful API response can
|
|
310
|
+
contain a partial/failed import; check `data.status` and `data.failedAssets`.
|
|
311
|
+
|
|
312
|
+
Repeat a partial/failed import to retry missing assets. Successful imports are reused
|
|
313
|
+
within the organization while their records/files remain available; import state is
|
|
314
|
+
retained for 30 days. Original downloaded video bytes/audio are preserved. Photo
|
|
315
|
+
carousels stay ordered images: this does not generate a slideshow video or download
|
|
316
|
+
an attributed full music track. Absent metadata is null. Supported acquired formats
|
|
317
|
+
are JPEG/PNG/WebP images and MP4/WebM video, limited to 50 assets, 100 MB per asset
|
|
318
|
+
and 30 minutes per video. Limits are checked before accepting an asset. No guarantee
|
|
319
|
+
of original upload quality or watermark removal is made.
|
|
320
|
+
|
|
321
|
+
Both operations require an organization and `content:analyze` for scoped keys.
|
|
322
|
+
Errors may include `errorCode` and `retryable`. Existing scraper credit/rate safeguards
|
|
323
|
+
apply. Storage/provider errors do not imply that a post or profile was deleted.
|
|
@@ -338,7 +338,7 @@ export declare const nodeDefinitions: {
|
|
|
338
338
|
selectionMode: null;
|
|
339
339
|
outputType: "video" | "image";
|
|
340
340
|
inputs: {
|
|
341
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
341
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
342
342
|
id: string;
|
|
343
343
|
isArray: boolean;
|
|
344
344
|
required: boolean;
|
|
@@ -9,7 +9,7 @@ declare const defaults: {
|
|
|
9
9
|
selectionMode: null;
|
|
10
10
|
outputType: "video" | "image";
|
|
11
11
|
inputs: {
|
|
12
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
12
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
13
13
|
id: string;
|
|
14
14
|
isArray: boolean;
|
|
15
15
|
required: boolean;
|
|
@@ -26,7 +26,7 @@ declare const _default: import("./types").NodeDefinition<"remotion-composition",
|
|
|
26
26
|
selectionMode: null;
|
|
27
27
|
outputType: "video" | "image";
|
|
28
28
|
inputs: {
|
|
29
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
29
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
30
30
|
id: string;
|
|
31
31
|
isArray: boolean;
|
|
32
32
|
required: boolean;
|
package/dist/base.js
CHANGED
|
@@ -52,6 +52,8 @@ class BaseClient {
|
|
|
52
52
|
ok: false,
|
|
53
53
|
code: rawData.code,
|
|
54
54
|
message: rawData.message ?? 'Request failed',
|
|
55
|
+
...(typeof rawData.errorCode === 'string' ? { errorCode: rawData.errorCode } : {}),
|
|
56
|
+
...(typeof rawData.retryable === 'boolean' ? { retryable: rawData.retryable } : {}),
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -85,3 +85,4 @@ export type { SelectionMode, ExhaustionBehavior, SelectionConfig, SelectionState
|
|
|
85
85
|
export type { SuccessResponse, ErrorResponse, ApiResponse, } from './types';
|
|
86
86
|
export type { CropBoundary, CropAxisConfig, DynamicCropConfig, BorderRadiusConfig, VerticalAnchor, HorizontalAnchor, HorizontalSelfAnchor, VerticalSelfAnchor, RelativePositionConfigX, RelativePositionConfigY, } from './render/types';
|
|
87
87
|
export type { PublicPostFailureCode, PublicPostRecovery, PublicPostNextAction, PublicPostFailure } from './post-failure';
|
|
88
|
+
export type { ListProfilePostsParams, ListProfilePostsResult, DownloadSocialPostParams, DownloadSocialPostResult, SocialReferencePost, SocialReferenceAsset } from './social-acquisition';
|
package/dist/media.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from './base';
|
|
2
|
+
import type { ListProfilePostsParams, ListProfilePostsResult, DownloadSocialPostParams, DownloadSocialPostResult } from './social-acquisition';
|
|
2
3
|
import type { ApiResponse } from './types';
|
|
3
4
|
export interface UserMedia {
|
|
4
5
|
id: string;
|
|
@@ -198,6 +199,10 @@ export interface OwnedUploadResponse {
|
|
|
198
199
|
* Client for managing media files
|
|
199
200
|
*/
|
|
200
201
|
export declare class MediaClient extends BaseClient {
|
|
202
|
+
/** List a bounded page of TikTok/Instagram references; does not download media. */
|
|
203
|
+
listProfilePosts(params: ListProfilePostsParams): Promise<ApiResponse<ListProfilePostsResult>>;
|
|
204
|
+
/** Import actual post assets to owned media. Continuations are checkpointed server-side. */
|
|
205
|
+
downloadSocialPost(params: DownloadSocialPostParams): Promise<ApiResponse<DownloadSocialPostResult>>;
|
|
201
206
|
/**
|
|
202
207
|
* Get media for the organization
|
|
203
208
|
* Returns both user_media and social_audio combined
|
package/dist/media.js
CHANGED
|
@@ -6,6 +6,22 @@ const base_1 = require("./base");
|
|
|
6
6
|
* Client for managing media files
|
|
7
7
|
*/
|
|
8
8
|
class MediaClient extends base_1.BaseClient {
|
|
9
|
+
/** List a bounded page of TikTok/Instagram references; does not download media. */
|
|
10
|
+
async listProfilePosts(params) {
|
|
11
|
+
return this.post('/media/social/list-profile-posts', params);
|
|
12
|
+
}
|
|
13
|
+
/** Import actual post assets to owned media. Continuations are checkpointed server-side. */
|
|
14
|
+
async downloadSocialPost(params) {
|
|
15
|
+
for (let step = 0; step < 120; step++) {
|
|
16
|
+
const response = await this.post('/media/social/download-post', params);
|
|
17
|
+
if (!response.ok)
|
|
18
|
+
return response;
|
|
19
|
+
if (response.data.status !== 'processing')
|
|
20
|
+
return { ...response, data: response.data };
|
|
21
|
+
await new Promise(resolve => setTimeout(resolve, Math.min(5000, Math.max(100, response.data.status === 'processing' ? response.data.retryAfterMs ?? 250 : 250))));
|
|
22
|
+
}
|
|
23
|
+
return { ok: false, code: 504, message: 'Import is still pending. Repeat downloadSocialPost with the same URL to resume.', errorCode: 'IMPORT_PENDING', retryable: true };
|
|
24
|
+
}
|
|
9
25
|
/**
|
|
10
26
|
* Get media for the organization
|
|
11
27
|
* Returns both user_media and social_audio combined
|
|
@@ -29,12 +29,12 @@ export declare const remotionCompositionPortSchema: z.ZodObject<{
|
|
|
29
29
|
isArray: z.ZodBoolean;
|
|
30
30
|
required: z.ZodBoolean;
|
|
31
31
|
}, "strict", z.ZodTypeAny, {
|
|
32
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
32
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
33
33
|
id: string;
|
|
34
34
|
isArray: boolean;
|
|
35
35
|
required: boolean;
|
|
36
36
|
}, {
|
|
37
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
37
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
38
38
|
id: string;
|
|
39
39
|
isArray: boolean;
|
|
40
40
|
required: boolean;
|
|
@@ -54,22 +54,22 @@ export declare const remotionCompositionNodeSchema: z.ZodObject<{
|
|
|
54
54
|
isArray: z.ZodBoolean;
|
|
55
55
|
required: z.ZodBoolean;
|
|
56
56
|
}, "strict", z.ZodTypeAny, {
|
|
57
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
57
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
58
58
|
id: string;
|
|
59
59
|
isArray: boolean;
|
|
60
60
|
required: boolean;
|
|
61
61
|
}, {
|
|
62
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
62
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
63
63
|
id: string;
|
|
64
64
|
isArray: boolean;
|
|
65
65
|
required: boolean;
|
|
66
66
|
}>, "many">, {
|
|
67
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
67
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
68
68
|
id: string;
|
|
69
69
|
isArray: boolean;
|
|
70
70
|
required: boolean;
|
|
71
71
|
}[], {
|
|
72
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
72
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
73
73
|
id: string;
|
|
74
74
|
isArray: boolean;
|
|
75
75
|
required: boolean;
|
|
@@ -82,7 +82,7 @@ export declare const remotionCompositionNodeSchema: z.ZodObject<{
|
|
|
82
82
|
selectionMode: null;
|
|
83
83
|
outputType: "video" | "image";
|
|
84
84
|
inputs: {
|
|
85
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
85
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
86
86
|
id: string;
|
|
87
87
|
isArray: boolean;
|
|
88
88
|
required: boolean;
|
|
@@ -97,7 +97,7 @@ export declare const remotionCompositionNodeSchema: z.ZodObject<{
|
|
|
97
97
|
outputMode: "per-input" | "single";
|
|
98
98
|
selectionMode: null;
|
|
99
99
|
inputs: {
|
|
100
|
-
type: "number" | "boolean" | "object" | "video" | "
|
|
100
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
|
|
101
101
|
id: string;
|
|
102
102
|
isArray: boolean;
|
|
103
103
|
required: boolean;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** Reference acquisition; these operations use the organization's content:analyze permission. */
|
|
2
|
+
export interface ListProfilePostsParams {
|
|
3
|
+
url: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
cursor?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DownloadSocialPostParams {
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SocialReferencePost {
|
|
11
|
+
id: string;
|
|
12
|
+
url: string;
|
|
13
|
+
type: 'video' | 'image' | 'carousel' | 'unknown';
|
|
14
|
+
caption: string | null;
|
|
15
|
+
publishedAt: string | null;
|
|
16
|
+
thumbnailUrl: string | null;
|
|
17
|
+
metrics: {
|
|
18
|
+
views: number | null;
|
|
19
|
+
likes: number | null;
|
|
20
|
+
comments: number | null;
|
|
21
|
+
shares: number | null;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface SocialReferenceWarning {
|
|
25
|
+
code: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ListProfilePostsResult {
|
|
29
|
+
profile: {
|
|
30
|
+
platform: 'tiktok' | 'instagram';
|
|
31
|
+
username: string;
|
|
32
|
+
url: string;
|
|
33
|
+
};
|
|
34
|
+
posts: SocialReferencePost[];
|
|
35
|
+
nextCursor: string | null;
|
|
36
|
+
coverage: 'partial' | 'exhausted';
|
|
37
|
+
warnings: SocialReferenceWarning[];
|
|
38
|
+
}
|
|
39
|
+
export interface SocialReferenceAsset {
|
|
40
|
+
index: number;
|
|
41
|
+
mediaId: string;
|
|
42
|
+
url: string;
|
|
43
|
+
type: 'image' | 'video';
|
|
44
|
+
mimeType: string;
|
|
45
|
+
width: number;
|
|
46
|
+
height: number;
|
|
47
|
+
durationMs: number | null;
|
|
48
|
+
audio: 'present' | 'absent' | 'not_applicable';
|
|
49
|
+
sha256: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DownloadSocialPostResult {
|
|
52
|
+
status: 'complete' | 'partial' | 'failed';
|
|
53
|
+
post: SocialReferencePost & {
|
|
54
|
+
platform: 'tiktok' | 'instagram';
|
|
55
|
+
author: {
|
|
56
|
+
username: string | null;
|
|
57
|
+
profileUrl: string | null;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
assets: SocialReferenceAsset[];
|
|
61
|
+
failedAssets: {
|
|
62
|
+
index: number;
|
|
63
|
+
code: string;
|
|
64
|
+
message: string;
|
|
65
|
+
retryable: boolean;
|
|
66
|
+
}[];
|
|
67
|
+
sound: {
|
|
68
|
+
id: string | null;
|
|
69
|
+
title: string | null;
|
|
70
|
+
artist: string | null;
|
|
71
|
+
sourceUrl: string | null;
|
|
72
|
+
} | null;
|
|
73
|
+
provenance: {
|
|
74
|
+
requestedUrl: string;
|
|
75
|
+
canonicalUrl: string;
|
|
76
|
+
retrievedAt: string;
|
|
77
|
+
};
|
|
78
|
+
manifestUrl: string | null;
|
|
79
|
+
warnings: SocialReferenceWarning[];
|
|
80
|
+
}
|
|
81
|
+
export interface SocialDownloadProgress {
|
|
82
|
+
status: 'processing';
|
|
83
|
+
retryAfterMs?: number;
|
|
84
|
+
}
|
|
85
|
+
export type SocialDownloadStep = DownloadSocialPostResult | SocialDownloadProgress;
|
package/dist/tools/media.js
CHANGED
|
@@ -3,6 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.mediaTools = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.mediaTools = [
|
|
6
|
+
{
|
|
7
|
+
name: 'list_profile_posts',
|
|
8
|
+
description: 'List a page of TikTok or Instagram profile posts, with metadata and an opaque continuation cursor. Does not download files; provider-visible history may be incomplete.',
|
|
9
|
+
schema: zod_1.z.object({ url: zod_1.z.string().url(), limit: zod_1.z.number().int().min(1).max(50).optional(), cursor: zod_1.z.string().uuid().optional() }).strict(),
|
|
10
|
+
execute: async (client, params) => client.media.listProfilePosts(params),
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'download_social_post',
|
|
14
|
+
description: 'Download a TikTok or Instagram post into owned UGC media, preserving ordered photo/video assets and embedded video audio. Returns partial failures explicitly. Repeat the same URL to resume failed assets; sound attribution is not a separately downloaded soundtrack.',
|
|
15
|
+
schema: zod_1.z.object({ url: zod_1.z.string().url() }).strict(),
|
|
16
|
+
execute: async (client, params) => client.media.downloadSocialPost(params),
|
|
17
|
+
},
|
|
6
18
|
{
|
|
7
19
|
name: 'list_media',
|
|
8
20
|
description: 'List all media (user media + social audio). Can filter by IDs or tag.',
|
package/dist/types.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ export interface ErrorResponse {
|
|
|
14
14
|
message: string;
|
|
15
15
|
ok: false;
|
|
16
16
|
data?: never;
|
|
17
|
+
errorCode?: string;
|
|
18
|
+
retryable?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export type ApiResponse<T> = SuccessResponse<T> | ErrorResponse;
|
|
19
21
|
export type { PublicPostFailureCode, PublicPostRecovery, PublicPostNextAction, PublicPostFailure } from './post-failure';
|
|
22
|
+
export type { ListProfilePostsParams, ListProfilePostsResult, DownloadSocialPostParams, DownloadSocialPostResult, SocialReferencePost, SocialReferenceAsset } from './social-acquisition';
|