@steipete/summarize-core 0.11.1 → 0.13.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/esm/content/bun.js +21 -0
- package/dist/esm/content/bun.js.map +1 -0
- package/dist/esm/content/direct-media.js +100 -0
- package/dist/esm/content/direct-media.js.map +1 -0
- package/dist/esm/content/index.js +2 -1
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/content/link-preview/client.js +6 -0
- package/dist/esm/content/link-preview/client.js.map +1 -1
- package/dist/esm/content/link-preview/content/fetcher.js +19 -2
- package/dist/esm/content/link-preview/content/fetcher.js.map +1 -1
- package/dist/esm/content/link-preview/content/firecrawl.js.map +1 -1
- package/dist/esm/content/link-preview/content/html.js.map +1 -1
- package/dist/esm/content/link-preview/content/index.js +29 -12
- package/dist/esm/content/link-preview/content/index.js.map +1 -1
- package/dist/esm/content/link-preview/content/utils.js.map +1 -1
- package/dist/esm/content/link-preview/content/video.js +1 -1
- package/dist/esm/content/link-preview/content/video.js.map +1 -1
- package/dist/esm/content/local-file.js +58 -0
- package/dist/esm/content/local-file.js.map +1 -0
- package/dist/esm/content/transcript/index.js +2 -0
- package/dist/esm/content/transcript/index.js.map +1 -1
- package/dist/esm/content/transcript/providers/generic-direct-media.js +47 -0
- package/dist/esm/content/transcript/providers/generic-direct-media.js.map +1 -0
- package/dist/esm/content/transcript/providers/generic-embedded.js +126 -0
- package/dist/esm/content/transcript/providers/generic-embedded.js.map +1 -0
- package/dist/esm/content/transcript/providers/generic-twitter.js +78 -0
- package/dist/esm/content/transcript/providers/generic-twitter.js.map +1 -0
- package/dist/esm/content/transcript/providers/generic.js +12 -248
- package/dist/esm/content/transcript/providers/generic.js.map +1 -1
- package/dist/esm/content/transcript/providers/podcast/apple-flow.js.map +1 -1
- package/dist/esm/content/transcript/providers/podcast/media.js +9 -1
- package/dist/esm/content/transcript/providers/podcast/media.js.map +1 -1
- package/dist/esm/content/transcript/providers/podcast/provider-flow.js +157 -0
- package/dist/esm/content/transcript/providers/podcast/provider-flow.js.map +1 -0
- package/dist/esm/content/transcript/providers/podcast/rss-feed.js +123 -0
- package/dist/esm/content/transcript/providers/podcast/rss-feed.js.map +1 -0
- package/dist/esm/content/transcript/providers/podcast/rss-transcript.js +113 -0
- package/dist/esm/content/transcript/providers/podcast/rss-transcript.js.map +1 -0
- package/dist/esm/content/transcript/providers/podcast/rss.js +2 -226
- package/dist/esm/content/transcript/providers/podcast/rss.js.map +1 -1
- package/dist/esm/content/transcript/providers/podcast/spotify-flow.js.map +1 -1
- package/dist/esm/content/transcript/providers/podcast.js +26 -155
- package/dist/esm/content/transcript/providers/podcast.js.map +1 -1
- package/dist/esm/content/transcript/providers/transcription-capability.js +22 -0
- package/dist/esm/content/transcript/providers/transcription-capability.js.map +1 -0
- package/dist/esm/content/transcript/providers/transcription-start.js +43 -32
- package/dist/esm/content/transcript/providers/transcription-start.js.map +1 -1
- package/dist/esm/content/transcript/providers/youtube/api.js +3 -2
- package/dist/esm/content/transcript/providers/youtube/api.js.map +1 -1
- package/dist/esm/content/transcript/providers/youtube/captions-player.js +173 -0
- package/dist/esm/content/transcript/providers/youtube/captions-player.js.map +1 -0
- package/dist/esm/content/transcript/providers/youtube/captions-shared.js +8 -0
- package/dist/esm/content/transcript/providers/youtube/captions-shared.js.map +1 -0
- package/dist/esm/content/transcript/providers/youtube/captions-transcript.js +361 -0
- package/dist/esm/content/transcript/providers/youtube/captions-transcript.js.map +1 -0
- package/dist/esm/content/transcript/providers/youtube/captions.js +2 -557
- package/dist/esm/content/transcript/providers/youtube/captions.js.map +1 -1
- package/dist/esm/content/transcript/providers/youtube/provider-flow.js +217 -0
- package/dist/esm/content/transcript/providers/youtube/provider-flow.js.map +1 -0
- package/dist/esm/content/transcript/providers/youtube/yt-dlp.js +33 -9
- package/dist/esm/content/transcript/providers/youtube/yt-dlp.js.map +1 -1
- package/dist/esm/content/transcript/providers/youtube.js +42 -194
- package/dist/esm/content/transcript/providers/youtube.js.map +1 -1
- package/dist/esm/content/transcript/transcription-config.js +24 -4
- package/dist/esm/content/transcript/transcription-config.js.map +1 -1
- package/dist/esm/content/url.js +5 -33
- package/dist/esm/content/url.js.map +1 -1
- package/dist/esm/processes.js.map +1 -1
- package/dist/esm/prompts/format.js +6 -0
- package/dist/esm/prompts/format.js.map +1 -1
- package/dist/esm/prompts/link-summary.js +27 -3
- package/dist/esm/prompts/link-summary.js.map +1 -1
- package/dist/esm/transcription/onnx-cli.js.map +1 -1
- package/dist/esm/transcription/whisper/assemblyai.js +132 -0
- package/dist/esm/transcription/whisper/assemblyai.js.map +1 -0
- package/dist/esm/transcription/whisper/chunking.js +64 -0
- package/dist/esm/transcription/whisper/chunking.js.map +1 -0
- package/dist/esm/transcription/whisper/cloud-providers.js +69 -0
- package/dist/esm/transcription/whisper/cloud-providers.js.map +1 -0
- package/dist/esm/transcription/whisper/core.js +320 -390
- package/dist/esm/transcription/whisper/core.js.map +1 -1
- package/dist/esm/transcription/whisper/gemini.js +324 -0
- package/dist/esm/transcription/whisper/gemini.js.map +1 -0
- package/dist/esm/transcription/whisper/groq.js +62 -1
- package/dist/esm/transcription/whisper/groq.js.map +1 -1
- package/dist/esm/transcription/whisper/preferences.js +16 -0
- package/dist/esm/transcription/whisper/preferences.js.map +1 -0
- package/dist/esm/transcription/whisper/provider-setup.js +62 -0
- package/dist/esm/transcription/whisper/provider-setup.js.map +1 -0
- package/dist/esm/transcription/whisper/remote-provider-attempts.js +189 -0
- package/dist/esm/transcription/whisper/remote-provider-attempts.js.map +1 -0
- package/dist/esm/transcription/whisper/remote.js +220 -0
- package/dist/esm/transcription/whisper/remote.js.map +1 -0
- package/dist/esm/transcription/whisper/whisper-cpp.js +21 -18
- package/dist/esm/transcription/whisper/whisper-cpp.js.map +1 -1
- package/dist/types/content/bun.d.ts +6 -0
- package/dist/types/content/direct-media.d.ts +9 -0
- package/dist/types/content/index.d.ts +2 -1
- package/dist/types/content/link-preview/client.d.ts +3 -1
- package/dist/types/content/link-preview/content/fetcher.d.ts +1 -1
- package/dist/types/content/link-preview/content/html.d.ts +1 -1
- package/dist/types/content/link-preview/deps.d.ts +8 -2
- package/dist/types/content/link-preview/types.d.ts +1 -1
- package/dist/types/content/local-file.d.ts +16 -0
- package/dist/types/content/transcript/providers/generic-direct-media.d.ts +11 -0
- package/dist/types/content/transcript/providers/generic-embedded.d.ts +16 -0
- package/dist/types/content/transcript/providers/generic-twitter.d.ts +11 -0
- package/dist/types/content/transcript/providers/podcast/flow-context.d.ts +3 -0
- package/dist/types/content/transcript/providers/podcast/media.d.ts +4 -2
- package/dist/types/content/transcript/providers/podcast/provider-flow.d.ts +7 -0
- package/dist/types/content/transcript/providers/podcast/rss-feed.d.ts +15 -0
- package/dist/types/content/transcript/providers/podcast/rss-transcript.d.ts +12 -0
- package/dist/types/content/transcript/providers/podcast/rss.d.ts +2 -24
- package/dist/types/content/transcript/providers/transcription-capability.d.ts +18 -0
- package/dist/types/content/transcript/providers/transcription-start.d.ts +11 -3
- package/dist/types/content/transcript/providers/youtube/captions-player.d.ts +12 -0
- package/dist/types/content/transcript/providers/youtube/captions-shared.d.ts +42 -0
- package/dist/types/content/transcript/providers/youtube/captions-transcript.d.ts +4 -0
- package/dist/types/content/transcript/providers/youtube/captions.d.ts +2 -19
- package/dist/types/content/transcript/providers/youtube/provider-flow.d.ts +34 -0
- package/dist/types/content/transcript/providers/youtube/yt-dlp.d.ts +4 -2
- package/dist/types/content/transcript/transcription-config.d.ts +6 -0
- package/dist/types/content/transcript/types.d.ts +1 -0
- package/dist/types/content/url.d.ts +2 -3
- package/dist/types/prompts/format.d.ts +1 -0
- package/dist/types/prompts/link-summary.d.ts +2 -1
- package/dist/types/transcription/whisper/assemblyai.d.ts +17 -0
- package/dist/types/transcription/whisper/chunking.d.ts +11 -0
- package/dist/types/transcription/whisper/cloud-providers.d.ts +22 -0
- package/dist/types/transcription/whisper/core.d.ts +12 -14
- package/dist/types/transcription/whisper/gemini.d.ts +14 -0
- package/dist/types/transcription/whisper/preferences.d.ts +4 -0
- package/dist/types/transcription/whisper/provider-setup.d.ts +30 -0
- package/dist/types/transcription/whisper/remote-provider-attempts.d.ts +51 -0
- package/dist/types/transcription/whisper/remote.d.ts +51 -0
- package/dist/types/transcription/whisper/types.d.ts +1 -1
- package/dist/types/transcription/whisper/whisper-cpp.d.ts +4 -3
- package/package.json +14 -10
|
@@ -1,220 +1,79 @@
|
|
|
1
|
-
import { normalizeTranscriptText } from "../normalize.js";
|
|
2
1
|
import { resolveTranscriptionConfig } from "../transcription-config.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { extractYoutubeiTranscriptConfig, fetchTranscriptFromTranscriptEndpoint, } from "./youtube/api.js";
|
|
6
|
-
import { fetchTranscriptWithApify } from "./youtube/apify.js";
|
|
7
|
-
import { extractYoutubeDurationSeconds, fetchTranscriptFromCaptionTracks, fetchYoutubeDurationSecondsViaPlayer, } from "./youtube/captions.js";
|
|
8
|
-
import { fetchDurationSecondsWithYtDlp, fetchTranscriptWithYtDlp } from "./youtube/yt-dlp.js";
|
|
2
|
+
import { resolveTranscriptProviderCapabilities } from "./transcription-capability.js";
|
|
3
|
+
import { buildUnavailableResult, loadYoutubeHtml, resolveDurationMetadata, resolveEffectiveVideoId, tryApifyTranscript, tryManualCaptionTranscript, tryWebTranscript, tryYtDlpTranscript, } from "./youtube/provider-flow.js";
|
|
9
4
|
const YOUTUBE_URL_PATTERN = /youtube\.com|youtu\.be/i;
|
|
10
5
|
export const canHandle = ({ url }) => YOUTUBE_URL_PATTERN.test(url);
|
|
11
6
|
export const fetchTranscript = async (context, options) => {
|
|
12
|
-
// Diagnostics: used for logging/UX and for tests asserting provider order.
|
|
13
7
|
const attemptedProviders = [];
|
|
14
8
|
const notes = [];
|
|
15
9
|
const transcription = resolveTranscriptionConfig(options);
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
const hasYoutubeConfig = typeof html === "string" && /ytcfg\.set|ytInitialPlayerResponse/.test(html);
|
|
19
|
-
if (!hasYoutubeConfig) {
|
|
20
|
-
// Many callers don't pass through the raw watch page HTML. When we don't see the usual
|
|
21
|
-
// bootstrap tokens, do a best-effort fetch so downstream extractors can work.
|
|
22
|
-
try {
|
|
23
|
-
const response = await options.fetch(url, {
|
|
24
|
-
headers: {
|
|
25
|
-
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0 Safari/537.36",
|
|
26
|
-
Accept: "text/html,application/xhtml+xml",
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
if (response.ok) {
|
|
30
|
-
html = await response.text();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// ignore and fall back to existing html
|
|
35
|
-
}
|
|
36
|
-
}
|
|
10
|
+
const { url } = context;
|
|
11
|
+
const html = await loadYoutubeHtml(context, options);
|
|
37
12
|
const mode = options.youtubeTranscriptMode;
|
|
38
13
|
const progress = typeof options.onProgress === "function" ? options.onProgress : null;
|
|
39
|
-
const
|
|
14
|
+
const transcriptionCapabilities = await resolveTranscriptProviderCapabilities({
|
|
40
15
|
transcription,
|
|
16
|
+
ytDlpPath: options.ytDlpPath,
|
|
41
17
|
});
|
|
42
|
-
const
|
|
43
|
-
// yt-dlp fallback only makes sense if we have the binary *and* some transcription path.
|
|
44
|
-
const canRunYtDlp = Boolean(options.ytDlpPath && hasYtDlpCredentials);
|
|
18
|
+
const canRunYtDlp = transcriptionCapabilities.canRunYtDlp;
|
|
45
19
|
const pushHint = (hint) => {
|
|
46
20
|
progress?.({ kind: "transcript-start", url, service: "youtube", hint });
|
|
47
21
|
};
|
|
48
22
|
if (mode === "yt-dlp" && !options.ytDlpPath) {
|
|
49
23
|
throw new Error("Missing yt-dlp binary for --youtube yt-dlp (set YT_DLP_PATH or install yt-dlp)");
|
|
50
24
|
}
|
|
51
|
-
if (mode === "yt-dlp" && !
|
|
52
|
-
throw new Error("Missing transcription provider for --youtube yt-dlp (install whisper-cpp or set OPENAI_API_KEY/FAL_KEY)");
|
|
25
|
+
if (mode === "yt-dlp" && !transcriptionCapabilities.canTranscribe) {
|
|
26
|
+
throw new Error("Missing transcription provider for --youtube yt-dlp (install whisper-cpp or set GROQ_API_KEY/ASSEMBLYAI_API_KEY/GEMINI_API_KEY/OPENAI_API_KEY/FAL_KEY)");
|
|
53
27
|
}
|
|
54
28
|
// In explicit apify mode we can continue without HTML.
|
|
55
29
|
if (!html && mode !== "apify") {
|
|
56
30
|
return { text: null, source: null, attemptedProviders };
|
|
57
31
|
}
|
|
58
|
-
const
|
|
59
|
-
if (!options.apifyApiToken)
|
|
60
|
-
return null;
|
|
61
|
-
pushHint(hint);
|
|
62
|
-
attemptedProviders.push("apify");
|
|
63
|
-
const apifyTranscript = await fetchTranscriptWithApify(options.fetch, options.apifyApiToken, url);
|
|
64
|
-
if (!apifyTranscript)
|
|
65
|
-
return null;
|
|
66
|
-
return {
|
|
67
|
-
text: normalizeTranscriptText(apifyTranscript),
|
|
68
|
-
source: "apify",
|
|
69
|
-
metadata: { provider: "apify", ...(durationMetadata ?? {}) },
|
|
70
|
-
attemptedProviders,
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const effectiveVideoIdCandidate = context.resourceKey ?? extractYouTubeVideoId(url);
|
|
74
|
-
// Prefer the caller-provided resource key (e.g. from cache routing) over URL parsing.
|
|
75
|
-
const effectiveVideoId = typeof effectiveVideoIdCandidate === "string" && effectiveVideoIdCandidate.trim().length > 0
|
|
76
|
-
? effectiveVideoIdCandidate.trim()
|
|
77
|
-
: null;
|
|
32
|
+
const effectiveVideoId = resolveEffectiveVideoId(context);
|
|
78
33
|
const htmlText = html ?? "";
|
|
79
34
|
// In explicit apify mode we can continue without a parsed video id.
|
|
80
35
|
if (!effectiveVideoId && mode !== "apify") {
|
|
81
36
|
return { text: null, source: null, attemptedProviders };
|
|
82
37
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
38
|
+
const durationMetadata = await resolveDurationMetadata({
|
|
39
|
+
htmlText,
|
|
40
|
+
effectiveVideoId,
|
|
41
|
+
url,
|
|
42
|
+
options,
|
|
43
|
+
});
|
|
44
|
+
const flow = {
|
|
45
|
+
context,
|
|
46
|
+
options,
|
|
47
|
+
transcription,
|
|
48
|
+
htmlText,
|
|
49
|
+
attemptedProviders,
|
|
50
|
+
notes,
|
|
51
|
+
effectiveVideoId,
|
|
52
|
+
durationMetadata,
|
|
53
|
+
canRunYtDlp,
|
|
54
|
+
pushHint,
|
|
55
|
+
};
|
|
99
56
|
// Try no-auto mode (skip auto-generated captions, fall back to yt-dlp)
|
|
100
57
|
if (mode === "no-auto") {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// "no-auto" is intentionally strict: only accept creator captions (and skip ASR/auto tracks).
|
|
105
|
-
// We *only* require yt-dlp once we know captions aren't available.
|
|
106
|
-
pushHint("YouTube: checking creator captions only (skipping auto-generated)");
|
|
107
|
-
attemptedProviders.push("captionTracks");
|
|
108
|
-
const manualTranscript = await fetchTranscriptFromCaptionTracks(options.fetch, {
|
|
109
|
-
html: htmlText,
|
|
110
|
-
originalUrl: url,
|
|
111
|
-
videoId: effectiveVideoId,
|
|
112
|
-
skipAutoGenerated: true,
|
|
113
|
-
});
|
|
114
|
-
if (manualTranscript?.text) {
|
|
115
|
-
return {
|
|
116
|
-
text: normalizeTranscriptText(manualTranscript.text),
|
|
117
|
-
source: "captionTracks",
|
|
118
|
-
segments: options.transcriptTimestamps ? (manualTranscript.segments ?? null) : null,
|
|
119
|
-
metadata: { provider: "captionTracks", manualOnly: true, ...(durationMetadata ?? {}) },
|
|
120
|
-
attemptedProviders,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
// No creator captions found, fall through to yt-dlp below
|
|
58
|
+
const manualTranscript = await tryManualCaptionTranscript(flow);
|
|
59
|
+
if (manualTranscript)
|
|
60
|
+
return manualTranscript;
|
|
124
61
|
notes.push("No creator captions found, using yt-dlp transcription");
|
|
125
62
|
}
|
|
126
63
|
// Try web methods (youtubei, captionTracks) if mode is 'auto' or 'web'
|
|
127
64
|
if (mode === "auto" || mode === "web") {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// youtubei is preferred when available: it returns a clean transcript payload without having
|
|
132
|
-
// to download/parse caption track formats.
|
|
133
|
-
pushHint("YouTube: checking captions (youtubei)");
|
|
134
|
-
const config = extractYoutubeiTranscriptConfig(htmlText);
|
|
135
|
-
if (config) {
|
|
136
|
-
attemptedProviders.push("youtubei");
|
|
137
|
-
const transcript = await fetchTranscriptFromTranscriptEndpoint(options.fetch, {
|
|
138
|
-
config,
|
|
139
|
-
originalUrl: url,
|
|
140
|
-
});
|
|
141
|
-
if (transcript?.text) {
|
|
142
|
-
return {
|
|
143
|
-
text: normalizeTranscriptText(transcript.text),
|
|
144
|
-
source: "youtubei",
|
|
145
|
-
segments: options.transcriptTimestamps ? (transcript.segments ?? null) : null,
|
|
146
|
-
metadata: { provider: "youtubei", ...(durationMetadata ?? {}) },
|
|
147
|
-
attemptedProviders,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (!config) {
|
|
152
|
-
pushHint("YouTube: youtubei unavailable; checking caption tracks");
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
pushHint("YouTube: youtubei empty; checking caption tracks");
|
|
156
|
-
}
|
|
157
|
-
attemptedProviders.push("captionTracks");
|
|
158
|
-
const captionTranscript = await fetchTranscriptFromCaptionTracks(options.fetch, {
|
|
159
|
-
html: htmlText,
|
|
160
|
-
originalUrl: url,
|
|
161
|
-
videoId: effectiveVideoId,
|
|
162
|
-
});
|
|
163
|
-
if (captionTranscript?.text) {
|
|
164
|
-
return {
|
|
165
|
-
text: normalizeTranscriptText(captionTranscript.text),
|
|
166
|
-
source: "captionTracks",
|
|
167
|
-
segments: options.transcriptTimestamps ? (captionTranscript.segments ?? null) : null,
|
|
168
|
-
metadata: { provider: "captionTracks", ...(durationMetadata ?? {}) },
|
|
169
|
-
attemptedProviders,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
65
|
+
const transcript = await tryWebTranscript(flow);
|
|
66
|
+
if (transcript)
|
|
67
|
+
return transcript;
|
|
172
68
|
}
|
|
173
|
-
// Try yt-dlp (audio download + OpenAI/FAL transcription) if mode is 'auto', 'no-auto', or 'yt-dlp'
|
|
69
|
+
// Try yt-dlp (audio download + Groq/AssemblyAI/Gemini/OpenAI/FAL transcription) if mode is 'auto', 'no-auto', or 'yt-dlp'
|
|
174
70
|
if (mode === "yt-dlp" || mode === "no-auto" || (mode === "auto" && canRunYtDlp)) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (mode === "auto") {
|
|
179
|
-
pushHint("YouTube: captions unavailable; falling back to yt-dlp audio");
|
|
180
|
-
}
|
|
181
|
-
else if (mode === "no-auto") {
|
|
182
|
-
pushHint("YouTube: no creator captions; falling back to yt-dlp audio");
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
pushHint("YouTube: downloading audio (yt-dlp)");
|
|
186
|
-
}
|
|
187
|
-
attemptedProviders.push("yt-dlp");
|
|
188
|
-
const ytdlpResult = await fetchTranscriptWithYtDlp({
|
|
189
|
-
ytDlpPath: options.ytDlpPath,
|
|
190
|
-
transcription,
|
|
191
|
-
mediaCache: options.mediaCache ?? null,
|
|
192
|
-
url,
|
|
193
|
-
onProgress: progress,
|
|
194
|
-
mediaKind: "video",
|
|
195
|
-
});
|
|
196
|
-
if (ytdlpResult.notes.length > 0) {
|
|
197
|
-
notes.push(...ytdlpResult.notes);
|
|
198
|
-
}
|
|
199
|
-
if (ytdlpResult.text) {
|
|
200
|
-
return {
|
|
201
|
-
text: normalizeTranscriptText(ytdlpResult.text),
|
|
202
|
-
source: "yt-dlp",
|
|
203
|
-
metadata: {
|
|
204
|
-
provider: "yt-dlp",
|
|
205
|
-
transcriptionProvider: ytdlpResult.provider,
|
|
206
|
-
...(durationMetadata ?? {}),
|
|
207
|
-
},
|
|
208
|
-
attemptedProviders,
|
|
209
|
-
notes: notes.length > 0 ? notes.join("; ") : null,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
if (mode === "yt-dlp" && ytdlpResult.error) {
|
|
213
|
-
throw ytdlpResult.error;
|
|
214
|
-
}
|
|
71
|
+
const transcript = await tryYtDlpTranscript({ flow, mode });
|
|
72
|
+
if (transcript)
|
|
73
|
+
return transcript;
|
|
215
74
|
// Auto mode: only try Apify after yt-dlp fails (last resort).
|
|
216
75
|
if (mode === "auto") {
|
|
217
|
-
const apifyResult = await
|
|
76
|
+
const apifyResult = await tryApifyTranscript(flow, "YouTube: yt-dlp transcription failed; trying Apify");
|
|
218
77
|
if (apifyResult)
|
|
219
78
|
return apifyResult;
|
|
220
79
|
}
|
|
@@ -224,27 +83,16 @@ export const fetchTranscript = async (context, options) => {
|
|
|
224
83
|
if (!options.apifyApiToken) {
|
|
225
84
|
throw new Error("Missing APIFY_API_TOKEN for --youtube apify");
|
|
226
85
|
}
|
|
227
|
-
const apifyResult = await
|
|
86
|
+
const apifyResult = await tryApifyTranscript(flow, "YouTube: fetching transcript (Apify)");
|
|
228
87
|
if (apifyResult)
|
|
229
88
|
return apifyResult;
|
|
230
89
|
}
|
|
231
90
|
// Auto mode: if yt-dlp cannot run (no binary/credentials), fall back to Apify last-last.
|
|
232
91
|
if (mode === "auto" && !canRunYtDlp) {
|
|
233
|
-
const apifyResult = await
|
|
92
|
+
const apifyResult = await tryApifyTranscript(flow, "YouTube: captions unavailable; trying Apify");
|
|
234
93
|
if (apifyResult)
|
|
235
94
|
return apifyResult;
|
|
236
95
|
}
|
|
237
|
-
|
|
238
|
-
return {
|
|
239
|
-
text: null,
|
|
240
|
-
source: "unavailable",
|
|
241
|
-
metadata: {
|
|
242
|
-
provider: "youtube",
|
|
243
|
-
reason: "no_transcript_available",
|
|
244
|
-
...(durationMetadata ?? {}),
|
|
245
|
-
},
|
|
246
|
-
attemptedProviders,
|
|
247
|
-
notes: notes.length > 0 ? notes.join("; ") : null,
|
|
248
|
-
};
|
|
96
|
+
return buildUnavailableResult(flow);
|
|
249
97
|
};
|
|
250
98
|
//# sourceMappingURL=youtube.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"youtube.js","sourceRoot":"","sources":["../../../../../src/content/transcript/providers/youtube.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"youtube.js","sourceRoot":"","sources":["../../../../../src/content/transcript/providers/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAEtD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,GAAG,EAAmB,EAAW,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,OAAwB,EACxB,OAA6B,EACJ,EAAE;IAC3B,MAAM,kBAAkB,GAAyC,EAAE,CAAC;IACpE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,aAAa,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;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W,CAAC;QACtC,CAAC;IACH,CAAC;IAED,8DAA8D;IAC9D,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;QAC3F,IAAI,WAAW;YAAE,OAAO,WAAW,CAAC;IACtC,CAAC;IAED,yFAAyF;IACzF,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAC1C,IAAI,EACJ,6CAA6C,CAC9C,CAAC;QACF,IAAI,WAAW;YAAE,OAAO,WAAW,CAAC;IACtC,CAAC;IAED,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -1,14 +1,34 @@
|
|
|
1
|
+
import { resolveAssemblyAiApiKey, resolveFalApiKey, resolveGeminiApiKey, resolveGroqApiKey, resolveOpenAiTranscriptionApiKey, } from "../../transcription/whisper/provider-setup.js";
|
|
1
2
|
function normalizeKey(raw) {
|
|
2
3
|
const trimmed = typeof raw === "string" ? raw.trim() : "";
|
|
3
4
|
return trimmed.length > 0 ? trimmed : null;
|
|
4
5
|
}
|
|
5
6
|
export function resolveTranscriptionConfig(input) {
|
|
6
7
|
const fromObject = input.transcription ?? null;
|
|
8
|
+
const env = fromObject?.env ?? input.env;
|
|
7
9
|
return {
|
|
8
|
-
env
|
|
9
|
-
groqApiKey:
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
env,
|
|
11
|
+
groqApiKey: resolveGroqApiKey({
|
|
12
|
+
env,
|
|
13
|
+
groqApiKey: fromObject?.groqApiKey ?? input.groqApiKey,
|
|
14
|
+
}),
|
|
15
|
+
assemblyaiApiKey: resolveAssemblyAiApiKey({
|
|
16
|
+
env,
|
|
17
|
+
assemblyaiApiKey: fromObject?.assemblyaiApiKey ?? input.assemblyaiApiKey,
|
|
18
|
+
}),
|
|
19
|
+
geminiApiKey: resolveGeminiApiKey({
|
|
20
|
+
env,
|
|
21
|
+
geminiApiKey: fromObject?.geminiApiKey ?? input.geminiApiKey,
|
|
22
|
+
}),
|
|
23
|
+
openaiApiKey: resolveOpenAiTranscriptionApiKey({
|
|
24
|
+
env,
|
|
25
|
+
openaiApiKey: fromObject?.openaiApiKey ?? input.openaiApiKey,
|
|
26
|
+
}),
|
|
27
|
+
falApiKey: resolveFalApiKey({
|
|
28
|
+
env,
|
|
29
|
+
falApiKey: fromObject?.falApiKey ?? input.falApiKey,
|
|
30
|
+
}),
|
|
31
|
+
geminiModel: normalizeKey(fromObject?.geminiModel ?? input.geminiModel),
|
|
12
32
|
};
|
|
13
33
|
}
|
|
14
34
|
//# sourceMappingURL=transcription-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcription-config.js","sourceRoot":"","sources":["../../../../src/content/transcript/transcription-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transcription-config.js","sourceRoot":"","sources":["../../../../src/content/transcript/transcription-config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gCAAgC,GACjC,MAAM,+CAA+C,CAAC;AAuBvD,SAAS,YAAY,CAAC,GAA8B;IAClD,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAA+B;IACxE,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC;IAC/C,MAAM,GAAG,GAAG,UAAU,EAAE,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC;IACzC,OAAO;QACL,GAAG;QACH,UAAU,EAAE,iBAAiB,CAAC;YAC5B,GAAG;YACH,UAAU,EAAE,UAAU,EAAE,UAAU,IAAI,KAAK,CAAC,UAAU;SACvD,CAAC;QACF,gBAAgB,EAAE,uBAAuB,CAAC;YACxC,GAAG;YACH,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,IAAI,KAAK,CAAC,gBAAgB;SACzE,CAAC;QACF,YAAY,EAAE,mBAAmB,CAAC;YAChC,GAAG;YACH,YAAY,EAAE,UAAU,EAAE,YAAY,IAAI,KAAK,CAAC,YAAY;SAC7D,CAAC;QACF,YAAY,EAAE,gCAAgC,CAAC;YAC7C,GAAG;YACH,YAAY,EAAE,UAAU,EAAE,YAAY,IAAI,KAAK,CAAC,YAAY;SAC7D,CAAC;QACF,SAAS,EAAE,gBAAgB,CAAC;YAC1B,GAAG;YACH,SAAS,EAAE,UAAU,EAAE,SAAS,IAAI,KAAK,CAAC,SAAS;SACpD,CAAC;QACF,WAAW,EAAE,YAAY,CAAC,UAAU,EAAE,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
package/dist/esm/content/url.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { DIRECT_MEDIA_EXTENSIONS, inferDirectMediaKind, isDirectMediaExtension, isDirectMediaUrl, isDirectVideoInput, } from "./direct-media.js";
|
|
1
2
|
import { isPodcastHost } from "./link-preview/content/podcast-utils.js";
|
|
2
3
|
import { isTwitterBroadcastUrl, isTwitterStatusUrl } from "./link-preview/content/twitter-utils.js";
|
|
3
4
|
export const isYouTubeUrl = (rawUrl) => {
|
|
4
5
|
try {
|
|
5
6
|
const hostname = new URL(rawUrl).hostname.toLowerCase();
|
|
6
|
-
return hostname.
|
|
7
|
+
return (hostname === "youtube.com" || hostname.endsWith(".youtube.com") || hostname === "youtu.be");
|
|
7
8
|
}
|
|
8
9
|
catch {
|
|
9
10
|
const lower = rawUrl.toLowerCase();
|
|
@@ -11,29 +12,6 @@ export const isYouTubeUrl = (rawUrl) => {
|
|
|
11
12
|
}
|
|
12
13
|
};
|
|
13
14
|
const YOUTUBE_VIDEO_ID_PATTERN = /^[a-zA-Z0-9_-]{11}$/;
|
|
14
|
-
export const DIRECT_MEDIA_EXTENSIONS = [
|
|
15
|
-
"mp4",
|
|
16
|
-
"mov",
|
|
17
|
-
"m4v",
|
|
18
|
-
"mkv",
|
|
19
|
-
"webm",
|
|
20
|
-
"mpeg",
|
|
21
|
-
"mpg",
|
|
22
|
-
"avi",
|
|
23
|
-
"wmv",
|
|
24
|
-
"flv",
|
|
25
|
-
"mp3",
|
|
26
|
-
"m4a",
|
|
27
|
-
"wav",
|
|
28
|
-
"flac",
|
|
29
|
-
"aac",
|
|
30
|
-
"ogg",
|
|
31
|
-
"opus",
|
|
32
|
-
"aiff",
|
|
33
|
-
"wma",
|
|
34
|
-
];
|
|
35
|
-
const DIRECT_MEDIA_EXTENSION_SET = new Set(DIRECT_MEDIA_EXTENSIONS);
|
|
36
|
-
const DIRECT_MEDIA_URL_PATTERN = new RegExp(`\\.(${DIRECT_MEDIA_EXTENSIONS.join("|")})(\\?|#|$)`, "i");
|
|
37
15
|
export function isYouTubeVideoUrl(rawUrl) {
|
|
38
16
|
try {
|
|
39
17
|
const url = new URL(rawUrl);
|
|
@@ -41,7 +19,7 @@ export function isYouTubeVideoUrl(rawUrl) {
|
|
|
41
19
|
if (hostname === "youtu.be") {
|
|
42
20
|
return Boolean(url.pathname.split("/").filter(Boolean)[0]);
|
|
43
21
|
}
|
|
44
|
-
if (!hostname.
|
|
22
|
+
if (hostname !== "youtube.com" && !hostname.endsWith(".youtube.com")) {
|
|
45
23
|
return false;
|
|
46
24
|
}
|
|
47
25
|
if (url.pathname === "/watch") {
|
|
@@ -64,7 +42,7 @@ export function extractYouTubeVideoId(rawUrl) {
|
|
|
64
42
|
if (hostname === "youtu.be") {
|
|
65
43
|
candidate = url.pathname.split("/")[1] ?? null;
|
|
66
44
|
}
|
|
67
|
-
if (hostname.
|
|
45
|
+
if (hostname === "youtube.com" || hostname.endsWith(".youtube.com")) {
|
|
68
46
|
if (url.pathname.startsWith("/watch")) {
|
|
69
47
|
candidate = url.searchParams.get("v");
|
|
70
48
|
}
|
|
@@ -89,13 +67,6 @@ export function extractYouTubeVideoId(rawUrl) {
|
|
|
89
67
|
}
|
|
90
68
|
return null;
|
|
91
69
|
}
|
|
92
|
-
export function isDirectMediaUrl(url) {
|
|
93
|
-
return DIRECT_MEDIA_URL_PATTERN.test(url);
|
|
94
|
-
}
|
|
95
|
-
export function isDirectMediaExtension(ext) {
|
|
96
|
-
const normalized = ext.trim().replace(/^\./, "").toLowerCase();
|
|
97
|
-
return DIRECT_MEDIA_EXTENSION_SET.has(normalized);
|
|
98
|
-
}
|
|
99
70
|
export function shouldPreferUrlMode(url) {
|
|
100
71
|
return (isYouTubeVideoUrl(url) ||
|
|
101
72
|
isTwitterStatusUrl(url) ||
|
|
@@ -104,4 +75,5 @@ export function shouldPreferUrlMode(url) {
|
|
|
104
75
|
isPodcastHost(url));
|
|
105
76
|
}
|
|
106
77
|
export { isTwitterBroadcastUrl, isTwitterStatusUrl, isPodcastHost };
|
|
78
|
+
export { DIRECT_MEDIA_EXTENSIONS, inferDirectMediaKind, isDirectMediaExtension, isDirectMediaUrl, isDirectVideoInput, };
|
|
107
79
|
//# sourceMappingURL=url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/content/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAEpG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAW,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;QACrB,aAAa,CAAC,GAAG,CAAC,CACnB,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processes.js","sourceRoot":"","sources":["../../src/processes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processes.js","sourceRoot":"","sources":["../../src/processes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAOrD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAiDrD,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAkB,CAAC;AAC/D,IAAI,eAAe,GAA2B,IAAI,CAAC;AAEnD,MAAM,UAAU,kBAAkB,CAAC,IAA4B;IAC7D,eAAe,GAAG,IAAI,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAI,GAAmB,EAAE,EAAW;IACvE,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,eAAe,CAAC,IAAyB;IAChD,IAAI,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;IAChC,OAAO,eAAe,CAAC,QAAQ,CAAC;QAC9B,GAAG,IAAI;QACP,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI;QACtC,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI;KAC1C,C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,CACf,IAAI,EACJ;QACE,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;QAC9B,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;QAC7D,GAAG,EAAE,eAAe,CAAC,GAAG,IAAI,IAAI;KACjC,EACD,EAAE,aAAa,EAAE,IAAI,EAAE,CACxB,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -9,6 +9,12 @@ export function buildInstructions({ base, overrides, }) {
|
|
|
9
9
|
if (trimmedBase)
|
|
10
10
|
lines.push(trimmedBase);
|
|
11
11
|
}
|
|
12
|
+
const requiredInstructions = overrides?.requiredInstructions ?? [];
|
|
13
|
+
for (const instruction of requiredInstructions) {
|
|
14
|
+
const trimmed = instruction.trim();
|
|
15
|
+
if (trimmed)
|
|
16
|
+
lines.push(trimmed);
|
|
17
|
+
}
|
|
12
18
|
const lengthInstruction = overrides?.lengthInstruction?.trim();
|
|
13
19
|
if (lengthInstruction)
|
|
14
20
|
lines.push(lengthInstruction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/prompts/format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/prompts/format.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,iBAAiB,CAAC,EAChC,IAAI,EACJ,SAAS,GAIV;IACC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;IACnD,IAAI,QAAQ,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,WAAW;YAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,oBAAoB,GAAG,SAAS,EAAE,oBAAoB,IAAI,EAAE,CAAC;IACnE,KAAK,MAAM,WAAW,IAAI,oBAAoB,EAAE,CAAC;QAC/C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,iBAAiB,GAAG,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAC/D,IAAI,iBAAiB;QAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAErD,MAAM,mBAAmB,GAAG,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;IACnE,IAAI,mBAAmB;QAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,YAAY,EACZ,OAAO,EACP,OAAO,GAKR;IACC,MAAM,gBAAgB,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,WAAW,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,OAAO,mBAAmB,gBAAgB,mCAAmC,WAAW,8BAA8B,WAAW,gBAAgB,CAAC;AACpJ,CAAC"}
|
|
@@ -19,7 +19,7 @@ export function estimateMaxCompletionTokensForCharacters(maxCharacters) {
|
|
|
19
19
|
return Math.max(256, estimate);
|
|
20
20
|
}
|
|
21
21
|
const formatCount = (value) => value.toLocaleString();
|
|
22
|
-
export function buildLinkSummaryPrompt({ url, title, siteName, description, content, truncated, hasTranscript, hasTranscriptTimestamps = false, slides, outputLanguage, summaryLength, shares, promptOverride, lengthInstruction, languageInstruction, }) {
|
|
22
|
+
export function buildLinkSummaryPrompt({ url, title, siteName, description, content, truncated, hasTranscript, hasTranscriptTimestamps = false, timestampLimitInstruction, slides, outputLanguage, summaryLength, shares, promptOverride, lengthInstruction, languageInstruction, }) {
|
|
23
23
|
const slidesText = slides?.text?.trim() ?? "";
|
|
24
24
|
const contentWithSlides = slidesText.length > 0
|
|
25
25
|
? `${content}\n\nSlide timeline (transcript excerpts):\n${slidesText}`
|
|
@@ -91,7 +91,12 @@ export function buildLinkSummaryPrompt({ url, title, siteName, description, cont
|
|
|
91
91
|
: 'You are not given any quotes from people who shared this link. Do not fabricate reactions or add a "What sharers are saying" subsection.';
|
|
92
92
|
const shareBlock = shares.length > 0 ? `Tweets from sharers:\n${shareLines.join("\n")}` : "";
|
|
93
93
|
const timestampInstruction = hasTranscriptTimestamps && !(slides && slides.count > 0)
|
|
94
|
-
?
|
|
94
|
+
? [
|
|
95
|
+
'Add a "Key moments" section with 3-6 bullets (2-4 if the summary is short). Start each bullet with a [mm:ss] (or [hh:mm:ss]) timestamp from the transcript. Keep the rest of the summary readable and follow the normal formatting guidance; do not prepend timestamps outside the Key moments section. Do not invent timestamps or use ranges.',
|
|
96
|
+
timestampLimitInstruction ?? "",
|
|
97
|
+
]
|
|
98
|
+
.filter((line) => line.trim().length > 0)
|
|
99
|
+
.join(" ")
|
|
95
100
|
: "";
|
|
96
101
|
const slideMarkers = slides && slides.count > 0
|
|
97
102
|
? Array.from({ length: slides.count }, (_, index) => `[slide:${index + 1}]`).join(" ")
|
|
@@ -123,6 +128,20 @@ export function buildLinkSummaryPrompt({ url, title, siteName, description, cont
|
|
|
123
128
|
const sponsorInstruction = hasTranscript || (slides && slides.count > 0)
|
|
124
129
|
? "Omit sponsor messages, ads, promos, and calls-to-action (including podcast ad reads), even if they appear in the transcript or slide timeline. Do not mention or acknowledge them, and do not say you skipped or ignored anything. Avoid sponsor/ad/promo language, brand names like Squarespace, or CTA phrases like discount code. Treat them as if they do not exist. If a slide segment is purely sponsor/ad content, leave that slide marker with no text."
|
|
125
130
|
: "";
|
|
131
|
+
const requiredOverrideInstructions = promptOverride && slides && slides.count > 0
|
|
132
|
+
? [
|
|
133
|
+
sponsorInstruction,
|
|
134
|
+
formattingLine,
|
|
135
|
+
headingInstruction,
|
|
136
|
+
"Keep the response compact by avoiding blank lines between sentences or list items; use only the single newlines required by the formatting instructions.",
|
|
137
|
+
"Do not use emojis, disclaimers, or speculation.",
|
|
138
|
+
"Write in direct, factual language.",
|
|
139
|
+
"Format the answer in Markdown.",
|
|
140
|
+
"Base everything strictly on the provided content and never invent details.",
|
|
141
|
+
slideInstruction,
|
|
142
|
+
'Final check for slides: every [slide:N] must be immediately followed by a line that starts with "## ". Remove any "Title:" or "Slide" label lines.',
|
|
143
|
+
].filter((line) => typeof line === "string" && line.trim().length > 0)
|
|
144
|
+
: [];
|
|
126
145
|
const baseInstructions = [
|
|
127
146
|
"Hard rules: never mention sponsor/ads; use straight quotation marks only (no curly quotes).",
|
|
128
147
|
"Apostrophes in contractions are OK.",
|
|
@@ -152,7 +171,12 @@ export function buildLinkSummaryPrompt({ url, title, siteName, description, cont
|
|
|
152
171
|
.join("\n");
|
|
153
172
|
const instructions = buildInstructions({
|
|
154
173
|
base: baseInstructions,
|
|
155
|
-
overrides: {
|
|
174
|
+
overrides: {
|
|
175
|
+
promptOverride,
|
|
176
|
+
requiredInstructions: requiredOverrideInstructions,
|
|
177
|
+
lengthInstruction,
|
|
178
|
+
languageInstruction,
|
|
179
|
+
},
|
|
156
180
|
});
|
|
157
181
|
const context = [contextHeader, shareBlock]
|
|
158
182
|
.filter((line) => typeof line === "string" && line.trim().length > 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-summary.js","sourceRoot":"","sources":["../../../src/prompts/link-summary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"link-summary.js","sourceRoot":"","sources":["../../../src/prompts/link-summary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAwB,MAAM,aAAa,CAAC;AACzF,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,CAAC;AAIpC,MAAM,UAAU,8BAA8B,CAAC,aAAqB;IAClE,IAAI,aAAa,IAAI,6BAA6B,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IACzE,IAAI,aAAa,IAAI,6BAA6B,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IAC3E,IAAI,aAAa,IAAI,6BAA6B,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC;IACvE,IAAI,aAAa,IAAI,6BAA6B,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACnE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,wCAAwC,CAAC,aAAqB;IAC5E,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;AAYtE,MAAM,UAAU,sBAAsB,CAAC,EACrC,GAAG,EACH,KAAK,EACL,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,aAAa,EACb,uBAAuB,GAAG,KAAK,EAC/B,yBAAyB,EACzB,MAAM,EACN,cAAc,EACd,aAAa,EACb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