@clipwright/core 0.68.0 → 0.69.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/dist/ads.d.ts +2 -0
- package/dist/ads.js +2 -1
- package/dist/cuts.d.ts +1 -0
- package/dist/design.d.ts +12 -0
- package/dist/design.js +2 -0
- package/dist/edit-music.js +2 -1
- package/dist/film-cut.js +4 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/own-agent-price.d.ts +2 -1
- package/dist/own-agent-price.js +2 -1
- package/dist/own-agent-runs.d.ts +5 -0
- package/dist/own-agent-runs.js +12 -3
- package/dist/trend-keywords.d.ts +20 -0
- package/dist/trend-keywords.js +13 -0
- package/dist/trend-niches.js +3 -1
- package/dist/trend-search.js +3 -3
- package/package.json +1 -1
package/dist/ads.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export declare const adTake: z.ZodObject<{
|
|
|
99
99
|
finding: z.ZodNullable<z.ZodString>;
|
|
100
100
|
shake: z.ZodNullable<z.ZodString>;
|
|
101
101
|
}, z.core.$strict>>;
|
|
102
|
+
speech: z.ZodOptional<z.ZodBoolean>;
|
|
102
103
|
against: z.ZodOptional<z.ZodEnum<{
|
|
103
104
|
motion: "motion";
|
|
104
105
|
picture: "picture";
|
|
@@ -183,6 +184,7 @@ export declare const adRecord: z.ZodObject<{
|
|
|
183
184
|
finding: z.ZodNullable<z.ZodString>;
|
|
184
185
|
shake: z.ZodNullable<z.ZodString>;
|
|
185
186
|
}, z.core.$strict>>;
|
|
187
|
+
speech: z.ZodOptional<z.ZodBoolean>;
|
|
186
188
|
against: z.ZodOptional<z.ZodEnum<{
|
|
187
189
|
motion: "motion";
|
|
188
190
|
picture: "picture";
|
package/dist/ads.js
CHANGED
|
@@ -2,13 +2,14 @@ import { z } from "zod";
|
|
|
2
2
|
import { adId, adSlotId } from "./ad-ids.js";
|
|
3
3
|
import { assetId } from "./asset-identity.js";
|
|
4
4
|
import { diyBlocked, diyNext } from "./diy-next.js";
|
|
5
|
+
import { OWN_CUT_MAX_BEATS } from "./own-agent-price.js";
|
|
5
6
|
import { FILM_EDIT_MAX_CLIPS, takeCheckVerdict } from "./own-agent-runs.js";
|
|
6
7
|
import { runId } from "./runs.js";
|
|
7
8
|
export { adId, adSlotId } from "./ad-ids.js";
|
|
8
9
|
export const ADS_PATH = "/v1/ads";
|
|
9
10
|
export const AD_PATH = "/v1/ads/:id";
|
|
10
11
|
export const DIY_RECORD_KINDS = ["ad", "faceless"];
|
|
11
|
-
export const DIY_MAX_SLOTS = { ad: FILM_EDIT_MAX_CLIPS, faceless:
|
|
12
|
+
export const DIY_MAX_SLOTS = { ad: FILM_EDIT_MAX_CLIPS, faceless: OWN_CUT_MAX_BEATS };
|
|
12
13
|
export const AD_MAX_SLOTS = DIY_MAX_SLOTS.ad;
|
|
13
14
|
export const AD_RECORDS_PER_DAY = 50;
|
|
14
15
|
export const adBrief = z.strictObject({
|
package/dist/cuts.d.ts
CHANGED
|
@@ -172,6 +172,7 @@ export declare const cutRecord: z.ZodObject<{
|
|
|
172
172
|
finding: z.ZodNullable<z.ZodString>;
|
|
173
173
|
shake: z.ZodNullable<z.ZodString>;
|
|
174
174
|
}, z.core.$strict>>;
|
|
175
|
+
speech: z.ZodOptional<z.ZodBoolean>;
|
|
175
176
|
against: z.ZodOptional<z.ZodEnum<{
|
|
176
177
|
motion: "motion";
|
|
177
178
|
picture: "picture";
|
package/dist/design.d.ts
CHANGED
|
@@ -941,6 +941,18 @@ export declare const extractBrandResponse: z.ZodObject<{
|
|
|
941
941
|
}, z.core.$strict>>;
|
|
942
942
|
brand_name: z.ZodOptional<z.ZodString>;
|
|
943
943
|
prompt_block: z.ZodOptional<z.ZodString>;
|
|
944
|
+
niches: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
945
|
+
keywords: z.ZodString;
|
|
946
|
+
platform: z.ZodLiteral<"mix">;
|
|
947
|
+
language: z.ZodOptional<z.ZodString>;
|
|
948
|
+
from: z.ZodEnum<{
|
|
949
|
+
category: "category";
|
|
950
|
+
description: "description";
|
|
951
|
+
heading: "heading";
|
|
952
|
+
keywords: "keywords";
|
|
953
|
+
title: "title";
|
|
954
|
+
}>;
|
|
955
|
+
}, z.core.$strict>>>;
|
|
944
956
|
evidence: z.ZodObject<{
|
|
945
957
|
colors: z.ZodArray<z.ZodObject<{
|
|
946
958
|
hex: z.ZodString;
|
package/dist/design.js
CHANGED
|
@@ -4,6 +4,7 @@ import { filmLookDescription, filmLookTag } from "./film-look.js";
|
|
|
4
4
|
import { MOTION_STYLE_IDS } from "./motion-styles.js";
|
|
5
5
|
import { scriptVoice } from "./script-voice.js";
|
|
6
6
|
import { contrastRatio } from "./templates/theme.js";
|
|
7
|
+
import { SITE_NICHES_DESCRIPTION, SITE_NICHES_MAX, siteTrendNiche } from "./trend-keywords.js";
|
|
7
8
|
const HEX = /^#[0-9A-Fa-f]{6}$/;
|
|
8
9
|
export const DESIGN_MIN_CONTRAST = 4.5;
|
|
9
10
|
export const CAPTION_ACCENT_GROUND = "#000000";
|
|
@@ -154,6 +155,7 @@ export const extractBrandResponse = z.object({
|
|
|
154
155
|
"brand_kit saves it."),
|
|
155
156
|
prompt_block: brandPromptBlock.optional().describe("A proposed prompt block from that name and the proposed palette: third-party text, " +
|
|
156
157
|
"for the user to confirm before brand_kit saves it."),
|
|
158
|
+
niches: z.array(siteTrendNiche).max(SITE_NICHES_MAX).optional().describe(SITE_NICHES_DESCRIPTION),
|
|
157
159
|
evidence: z.object({
|
|
158
160
|
colors: z.array(z.object({ hex, count: z.number().int().positive() })).max(12),
|
|
159
161
|
fonts: z.array(z.string()).max(8),
|
package/dist/edit-music.js
CHANGED
|
@@ -68,7 +68,8 @@ export const editMusic = z.strictObject({
|
|
|
68
68
|
'delivery: "auto" takes the mood from the captions and the voice, { mood } says it in your words, such as "moody deep house"; it may ' +
|
|
69
69
|
"carry an invisible watermark"),
|
|
70
70
|
volume: z.number().min(EDIT_MUSIC_MIN_VOLUME_DB).max(EDIT_MUSIC_MAX_VOLUME_DB).default(0)
|
|
71
|
-
.describe("dB from the music's own level: 0 plays it at full level where no voice
|
|
71
|
+
.describe("dB from the music's own level, against the voice and the clips' own sound: 0 plays it at full level where no voice " +
|
|
72
|
+
"speaks, -6 half as loud. Every cut is delivered at one loudness, so music with nothing else to sound under plays the same at any volume"),
|
|
72
73
|
at: z.number().min(0).max(600).default(0).describe("The second of the edit the music starts at"),
|
|
73
74
|
fade_out: z.number().min(0).max(EDIT_MUSIC_LONGEST_FADE_OUT).default(EDIT_MUSIC_DEFAULT_FADE_OUT)
|
|
74
75
|
.describe("Seconds the music fades out over at the cut's end"),
|
package/dist/film-cut.js
CHANGED
|
@@ -5,6 +5,7 @@ import { diyBlocked, diyNext } from "./diy-next.js";
|
|
|
5
5
|
import { FACELESS_BEAT_KINDS, FACELESS_CAMERA_MOVES, FACELESS_CUT_LOOKS, FACELESS_SHOT_SIZES, FACELESS_SPEEDS } from "./faceless-direction-summary.js";
|
|
6
6
|
import { filmLookDescription, filmLookTag } from "./film-look.js";
|
|
7
7
|
import { maxCreditsField } from "./max-credits.js";
|
|
8
|
+
import { OWN_CUT_MAX_BEATS } from "./own-agent-price.js";
|
|
8
9
|
import { runId } from "./runs.js";
|
|
9
10
|
import { uploadId } from "./uploads.js";
|
|
10
11
|
export const FILM_CUT_CHECK_PATH = "/v1/film-cuts/check";
|
|
@@ -65,7 +66,7 @@ const beat = z.strictObject({
|
|
|
65
66
|
.describe("Where a push, pull or punch-in closes, as shares of the picture's width and height from its top-left; the centre when omitted"),
|
|
66
67
|
punch_ins: z.array(z.strictObject({ word, scale: z.number().min(1.1).max(2), hold_s: z.number().min(0.2).max(2) })).max(3).default([])
|
|
67
68
|
.describe("Quick zooms on words of this beat"),
|
|
68
|
-
priority: z.number().int().min(1).max(
|
|
69
|
+
priority: z.number().int().min(1).max(OWN_CUT_MAX_BEATS).default(20).describe("1 is the beat that matters most"),
|
|
69
70
|
why,
|
|
70
71
|
technique_ids: z.array(line(64)).min(1).max(6).describe("Short names of the techniques this beat uses"),
|
|
71
72
|
text_visible: z.boolean().optional().describe("On a live beat: its frame shows readable text, a logo or a sign"),
|
|
@@ -107,7 +108,7 @@ export const filmCutInput = z.strictObject({
|
|
|
107
108
|
palette: z.array(z.string().regex(/^#[0-9a-f]{6}$/iu)).min(3).max(5).describe("3 to 5 colours as #rrggbb: cards and outlines take theirs from it"),
|
|
108
109
|
effect_colours: line(240).describe("The colours of sparkles, glows and outlines, named"),
|
|
109
110
|
}),
|
|
110
|
-
beats: z.array(beat).min(2).max(
|
|
111
|
+
beats: z.array(beat).min(2).max(OWN_CUT_MAX_BEATS).describe("The beats in order, covering every word of the voice once"),
|
|
111
112
|
events: z.array(z.strictObject({ word, device: line(64).describe("The text's style: headline, badge, stamp or label; any other device draws a headline"),
|
|
112
113
|
text: z.string().trim().max(40).optional().describe("Drawn as big text on its word, such as a number; without text the event is a timing note for sound"),
|
|
113
114
|
why: line(160) })).max(160).default([])
|
|
@@ -115,7 +116,7 @@ export const filmCutInput = z.strictObject({
|
|
|
115
116
|
captions: z.strictObject({ on: z.boolean().default(true).describe("Burn the captions in; false for none"),
|
|
116
117
|
accents: z.array(word).max(80).default([]).describe("The word of each caption phrase that carries its point") })
|
|
117
118
|
.default({ on: true, accents: [] }),
|
|
118
|
-
transitions: z.array(z.strictObject({ after_word: word.describe("A beat's last word"), look: z.enum(FACELESS_CUT_LOOKS) })).max(
|
|
119
|
+
transitions: z.array(z.strictObject({ after_word: word.describe("A beat's last word"), look: z.enum(FACELESS_CUT_LOOKS) })).max(OWN_CUT_MAX_BEATS).default([])
|
|
119
120
|
.describe("Cuts other than hard, after a beat's last word"),
|
|
120
121
|
sound: z.strictObject({
|
|
121
122
|
bed: filmCutBed.nullable().describe(`One ambience under the whole voice, or null; ${FILM_CUT_BED_RULE}`),
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -26,7 +26,8 @@ export declare const OWN_CUT_MIN_SECONDS = 10;
|
|
|
26
26
|
export declare const OWN_CUT_BED_CREDITS = 35;
|
|
27
27
|
export declare const OWN_CUT_TAKE_SOUND_CREDITS_PER_SECOND = 4;
|
|
28
28
|
export declare const OWN_CUT_MAX_NEW_SOUNDS = 8;
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const OWN_CUT_MAX_BEATS = 96;
|
|
30
|
+
export declare const OWN_CUT_MAX_SOURCES = 96, OWN_CUT_MAX_SOURCE_BYTES = 1000000000;
|
|
30
31
|
export declare const ownCutParts: z.ZodObject<{
|
|
31
32
|
bed: z.ZodBoolean;
|
|
32
33
|
take_sound_seconds: z.ZodNumber;
|
package/dist/own-agent-price.js
CHANGED
|
@@ -28,7 +28,8 @@ export const OWN_CUT_MIN_SECONDS = 10;
|
|
|
28
28
|
export const OWN_CUT_BED_CREDITS = 35;
|
|
29
29
|
export const OWN_CUT_TAKE_SOUND_CREDITS_PER_SECOND = 4;
|
|
30
30
|
export const OWN_CUT_MAX_NEW_SOUNDS = 8;
|
|
31
|
-
export const
|
|
31
|
+
export const OWN_CUT_MAX_BEATS = 96;
|
|
32
|
+
export const OWN_CUT_MAX_SOURCES = 96, OWN_CUT_MAX_SOURCE_BYTES = 1_000_000_000;
|
|
32
33
|
export const ownCutParts = z.strictObject({ bed: z.boolean(), take_sound_seconds: z.number().nonnegative(), music: z.boolean() });
|
|
33
34
|
export const ownAgentTerms = z.strictObject({
|
|
34
35
|
tariff: z.enum([OWN_AGENT_TARIFF_V1, OWN_AGENT_TARIFF]),
|
package/dist/own-agent-runs.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare const FILM_EDIT_MAX_CLIPS = 24, FILM_EDIT_MAX_PIECES = 24, FILM_E
|
|
|
90
90
|
export declare const FILM_EDIT_CAPTION_POSITIONS: readonly ["top", "middle", "bottom", "low"];
|
|
91
91
|
export declare const FILM_EDIT_CAPTION_STYLES: readonly ["outline", "banner", "badge"];
|
|
92
92
|
export declare const FILM_EDIT_CAPTION_ALIGNS: readonly ["center", "left"];
|
|
93
|
+
export declare const EDIT_CLIP_MIN_VOLUME_DB = -24, EDIT_CLIP_MAX_VOLUME_DB = 3;
|
|
93
94
|
export declare const filmEditInput: z.ZodObject<{
|
|
94
95
|
clips: z.ZodArray<z.ZodObject<{
|
|
95
96
|
run_id: z.ZodOptional<z.ZodString>;
|
|
@@ -98,6 +99,8 @@ export declare const filmEditInput: z.ZodObject<{
|
|
|
98
99
|
to: z.ZodNumber;
|
|
99
100
|
speed: z.ZodDefault<z.ZodNumber>;
|
|
100
101
|
sound: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
speech: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
volume: z.ZodOptional<z.ZodNumber>;
|
|
101
104
|
slot: z.ZodOptional<z.ZodString>;
|
|
102
105
|
}, z.core.$strict>>;
|
|
103
106
|
voice: z.ZodOptional<z.ZodObject<{
|
|
@@ -353,6 +356,7 @@ export declare const takeCheckVerdict: z.ZodObject<{
|
|
|
353
356
|
finding: z.ZodNullable<z.ZodString>;
|
|
354
357
|
shake: z.ZodNullable<z.ZodString>;
|
|
355
358
|
}, z.core.$strict>>;
|
|
359
|
+
speech: z.ZodOptional<z.ZodBoolean>;
|
|
356
360
|
against: z.ZodOptional<z.ZodEnum<{
|
|
357
361
|
motion: "motion";
|
|
358
362
|
picture: "picture";
|
|
@@ -583,6 +587,7 @@ export declare const filmRun: z.ZodObject<{
|
|
|
583
587
|
finding: z.ZodNullable<z.ZodString>;
|
|
584
588
|
shake: z.ZodNullable<z.ZodString>;
|
|
585
589
|
}, z.core.$strict>>;
|
|
590
|
+
speech: z.ZodOptional<z.ZodBoolean>;
|
|
586
591
|
against: z.ZodOptional<z.ZodEnum<{
|
|
587
592
|
motion: "motion";
|
|
588
593
|
picture: "picture";
|
package/dist/own-agent-runs.js
CHANGED
|
@@ -67,20 +67,27 @@ export const FILM_EDIT_CAPTION_POSITIONS = ["top", "middle", "bottom", "low"];
|
|
|
67
67
|
export const FILM_EDIT_CAPTION_STYLES = ["outline", "banner", "badge"];
|
|
68
68
|
export const FILM_EDIT_CAPTION_ALIGNS = ["center", "left"];
|
|
69
69
|
const editSecond = z.number().min(0).max(600);
|
|
70
|
+
export const EDIT_CLIP_MIN_VOLUME_DB = -24, EDIT_CLIP_MAX_VOLUME_DB = 3;
|
|
70
71
|
const editClip = z.strictObject({
|
|
71
72
|
run_id: runId.optional().describe("A delivered generate_video run of this account"),
|
|
72
73
|
asset_id: assetId.optional().describe("Instead of run_id: a video asset of this account"),
|
|
73
74
|
from: editSecond.describe("The second of the clip the cut starts at"),
|
|
74
75
|
to: editSecond.describe("The second of the clip the cut ends at, after from"),
|
|
75
76
|
speed: z.number().min(0.5).max(2).default(1).describe("Play speed; the clip lasts (to - from) / speed in the edit. 1.2 lifts a slow beat"),
|
|
76
|
-
sound: z.boolean().optional().describe("Play this window's own sound (a clip made with audio: true) at
|
|
77
|
-
"
|
|
77
|
+
sound: z.boolean().optional().describe("Play this window's own sound (a clip made with audio: true); at speed 1, never over the voice's " +
|
|
78
|
+
"words. speech and volume say how it sits in the mix"),
|
|
79
|
+
speech: z.boolean().optional().describe("With sound: true. true: the window's sound is someone speaking, so it plays at the level of " +
|
|
80
|
+
"speech and the music goes lower under it as under the voice. false: room sound or effects, which never lower the music. Omitted: " +
|
|
81
|
+
"what the clip's latest check_take heard, else false"),
|
|
82
|
+
volume: z.number().min(EDIT_CLIP_MIN_VOLUME_DB).max(EDIT_CLIP_MAX_VOLUME_DB).optional()
|
|
83
|
+
.describe("With sound: true. dB from the level the edit gives this window's sound: 0 (the default) near the voice, -10 well under it"),
|
|
78
84
|
slot: adSlotId.optional().describe("With ad_id: the slot of the ad this clip fills. A clip made with generate_video must have passed " +
|
|
79
85
|
"check_take in that slot; your own footage needs no check"),
|
|
80
86
|
}).refine(clip => (clip.run_id === undefined) !== (clip.asset_id === undefined), "name the clip by run_id or by asset_id, one of them")
|
|
81
87
|
.refine(clip => clip.to > clip.from, "to must be after from")
|
|
82
88
|
.refine(clip => clip.sound !== true || clip.run_id !== undefined, { path: ["sound"], message: "a clip's own sound is kept only from a generate_video run made with audio: true" })
|
|
83
|
-
.refine(clip => clip.sound !== true || clip.speed === 1, { path: ["sound"], message: "a clip's own sound plays at speed 1 only" })
|
|
89
|
+
.refine(clip => clip.sound !== true || clip.speed === 1, { path: ["sound"], message: "a clip's own sound plays at speed 1 only" })
|
|
90
|
+
.refine(clip => clip.sound === true || (clip.speech === undefined && clip.volume === undefined), { path: ["sound"], message: "speech and volume describe a clip's own sound: they need sound: true" });
|
|
84
91
|
const voicePiece = z.strictObject({
|
|
85
92
|
from: editSecond.describe("The second of the take the piece starts at (make_voice words give each word's start and end)"),
|
|
86
93
|
to: editSecond.describe("The second of the take the piece ends at, after from"),
|
|
@@ -225,6 +232,8 @@ export const takeCheckVerdict = z.strictObject({ duration_sec: z.number().positi
|
|
|
225
232
|
whole_take: z.boolean(), why: z.string().nullable() })),
|
|
226
233
|
clean: z.array(takeWindow),
|
|
227
234
|
motion: takeMotion.optional(),
|
|
235
|
+
speech: z.boolean().optional().describe("A take with its own sound: whether someone speaks in it, on screen or off. render_edit plays " +
|
|
236
|
+
"a window of this take as speech when its speech is not given"),
|
|
228
237
|
against: z.enum(TAKE_CHECK_AGAINST).optional(),
|
|
229
238
|
action_at_s: z.number().min(0).nullable().optional().describe("Against picture: the second the first asked change shows; null when it never does"),
|
|
230
239
|
subject: z.strictObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1), w: z.number().min(0).max(1), h: z.number().min(0).max(1) })
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const trendKeywords: z.ZodString;
|
|
3
|
+
export declare const trendLanguageCode: z.ZodString;
|
|
4
|
+
export declare const SITE_NICHES_MAX = 3;
|
|
5
|
+
export declare const SITE_NICHE_SOURCES: readonly ["title", "keywords", "category", "heading", "description"];
|
|
6
|
+
export type SiteNicheSource = (typeof SITE_NICHE_SOURCES)[number];
|
|
7
|
+
export declare const siteTrendNiche: z.ZodObject<{
|
|
8
|
+
keywords: z.ZodString;
|
|
9
|
+
platform: z.ZodLiteral<"mix">;
|
|
10
|
+
language: z.ZodOptional<z.ZodString>;
|
|
11
|
+
from: z.ZodEnum<{
|
|
12
|
+
category: "category";
|
|
13
|
+
description: "description";
|
|
14
|
+
heading: "heading";
|
|
15
|
+
keywords: "keywords";
|
|
16
|
+
title: "title";
|
|
17
|
+
}>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export type SiteTrendNiche = z.infer<typeof siteTrendNiche>;
|
|
20
|
+
export declare const SITE_NICHES_DESCRIPTION: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const trendKeywords = z.string().min(2).max(100).refine((value) => value.trim().length >= 2, "keywords needs at least 2 characters besides spaces");
|
|
3
|
+
export const trendLanguageCode = z.string().regex(/^[a-z]{2}$/);
|
|
4
|
+
export const SITE_NICHES_MAX = 3;
|
|
5
|
+
export const SITE_NICHE_SOURCES = ["title", "keywords", "category", "heading", "description"];
|
|
6
|
+
export const siteTrendNiche = z.strictObject({
|
|
7
|
+
keywords: trendKeywords.describe("The niche's words, read from the site."),
|
|
8
|
+
platform: z.literal("mix").describe("mix: TikTok and Instagram together."),
|
|
9
|
+
language: trendLanguageCode.optional().describe("The page's language, ISO 639-1; absent when the page names none."),
|
|
10
|
+
from: z.enum(SITE_NICHE_SOURCES).describe("Where the words stand: the page title, its keywords, a product category, a heading or the description."),
|
|
11
|
+
});
|
|
12
|
+
export const SITE_NICHES_DESCRIPTION = `Up to ${SITE_NICHES_MAX} proposed trend niches from the page's own words: third-party text. ` +
|
|
13
|
+
"Show them; save only the ones the user confirms, with trend_niches as {keywords, platform, language}, from left out.";
|
package/dist/trend-niches.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { CREATOR_PLATFORMS } from "./creator-profile.js";
|
|
3
3
|
import { findTrendsRequest, TREND_FREE_PAGES_PER_DAY, TREND_LANGUAGE_DESCRIPTION, TREND_PAGE_PAID_CREDITS, TREND_PAGE_WINDOW_SECONDS, TREND_PLATFORMS, TREND_SEARCH_DEFAULT_DAYS, TREND_SEARCH_MAX_DAYS, TREND_SEARCH_MAX_PAGES, TREND_SEARCH_MIN_DAYS, trendPage, trendSearchId, } from "./trend-search.js";
|
|
4
4
|
import { maxCreditsField } from "./max-credits.js";
|
|
5
|
+
import { SITE_NICHES_MAX } from "./trend-keywords.js";
|
|
5
6
|
export const TREND_NICHES_PATH = "/v1/trend-niches";
|
|
6
7
|
export const TREND_NICHES_MAX = 3;
|
|
7
8
|
const keywords = findTrendsRequest.shape.keywords;
|
|
@@ -130,4 +131,5 @@ export const digestReels = (reels) => reels.filter((reel) => reel.top || reel.ta
|
|
|
130
131
|
export const TREND_NICHES_DESCRIPTION = "Free. With no niches: the account's saved niches, the first the primary. niches: save the user's confirmed list " +
|
|
131
132
|
`(at most ${TREND_NICHES_MAX}, it replaces the saved one; [] clears it). find_trends and quote_trends with no keywords search the primary niche. ` +
|
|
132
133
|
`The read also answers suggested: up to ${TREND_NICHE_SUGGESTIONS_MAX} niches from the hashtags of creators this account analysed. Show them; ` +
|
|
133
|
-
"a niche is saved only once the user confirms it. With no suggestions,
|
|
134
|
+
"a niche is saved only once the user confirms it. With no suggestions, ask for the user's site: extract_brand answers niches, up to " +
|
|
135
|
+
`${SITE_NICHES_MAX} read from its own words.`;
|
package/dist/trend-search.js
CHANGED
|
@@ -3,6 +3,7 @@ import { CAPTION_FUNNEL_MAX_CHARS, captionFunnelWord } from "./caption-funnel.js
|
|
|
3
3
|
import { CREATOR_CAPTION_MAX_CHARS, CREATOR_PLATFORMS, CREATOR_TOP_X, creatorAuthorUrl, medianOf, xToMedian } from "./creator-profile.js";
|
|
4
4
|
import { quoteThirdParty as quote } from "./markdown-quote.js";
|
|
5
5
|
import { REFERENCE_WAIT_MAX_SECONDS } from "./reference-analysis.js";
|
|
6
|
+
import { trendKeywords, trendLanguageCode } from "./trend-keywords.js";
|
|
6
7
|
export const TREND_SEARCHES_PATH = "/v1/trend-searches";
|
|
7
8
|
export const TREND_SEARCH_PATH = "/v1/trend-searches/:id";
|
|
8
9
|
export const TREND_SEARCH_QUOTE_PATH = "/v1/trend-searches/quote";
|
|
@@ -82,10 +83,9 @@ export const findTrendsPayload = z.strictObject({ searchId: trendSearchId, accou
|
|
|
82
83
|
export const TREND_LANGUAGE_DESCRIPTION = "ISO 639-1: keeps reels in this language, read from the platform's label or the caption; " +
|
|
83
84
|
"a reel whose language cannot be told is kept.";
|
|
84
85
|
export const findTrendsRequest = z.strictObject({
|
|
85
|
-
keywords:
|
|
86
|
-
.describe("The topic in a few words."),
|
|
86
|
+
keywords: trendKeywords.describe("The topic in a few words."),
|
|
87
87
|
platform: z.enum(TREND_PLATFORMS).default("mix"),
|
|
88
|
-
language:
|
|
88
|
+
language: trendLanguageCode.optional().describe(TREND_LANGUAGE_DESCRIPTION),
|
|
89
89
|
posted_within_days: z.number().int().min(TREND_SEARCH_MIN_DAYS).max(TREND_SEARCH_MAX_DAYS).default(TREND_SEARCH_DEFAULT_DAYS)
|
|
90
90
|
.describe(`Reels posted within this many days: ${TREND_SEARCH_MIN_DAYS} is the last 24 hours, ${TREND_SEARCH_DEFAULT_DAYS} by default, ` +
|
|
91
91
|
`at most ${TREND_SEARCH_MAX_DAYS}.`),
|