@dream_engine/search 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/crawler.d.ts +165 -0
- package/dist/crawler.d.ts.map +1 -0
- package/dist/crawler.js +454 -0
- package/dist/crawler.js.map +1 -0
- package/dist/fetcher.d.ts +45 -0
- package/dist/fetcher.d.ts.map +1 -0
- package/dist/fetcher.js +161 -0
- package/dist/fetcher.js.map +1 -0
- package/dist/index-store.d.ts +162 -0
- package/dist/index-store.d.ts.map +1 -0
- package/dist/index-store.js +350 -0
- package/dist/index-store.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/postgres-index.d.ts +66 -0
- package/dist/postgres-index.d.ts.map +1 -0
- package/dist/postgres-index.js +335 -0
- package/dist/postgres-index.js.map +1 -0
- package/dist/robots.d.ts +46 -0
- package/dist/robots.d.ts.map +1 -0
- package/dist/robots.js +161 -0
- package/dist/robots.js.map +1 -0
- package/dist/service.d.ts +203 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +570 -0
- package/dist/service.js.map +1 -0
- package/dist/sitemap.d.ts +21 -0
- package/dist/sitemap.d.ts.map +1 -0
- package/dist/sitemap.js +75 -0
- package/dist/sitemap.js.map +1 -0
- package/dist/sources.d.ts +78 -0
- package/dist/sources.d.ts.map +1 -0
- package/dist/sources.js +146 -0
- package/dist/sources.js.map +1 -0
- package/package.json +44 -3
- package/README.md +0 -3
package/dist/crawler.js
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { CancelledError, CrawlError, createId, getDomain, isSameSite, normalizeUrl, redactUrl, retry, sleep, } from '@dream_engine/core';
|
|
3
|
+
import { extractDocument, extractLinks, parseHtml } from '@dream_engine/extraction';
|
|
4
|
+
import { discoverSitemapUrls } from './sitemap.js';
|
|
5
|
+
function matches(patterns, url) {
|
|
6
|
+
return patterns.some((p) => (p instanceof RegExp ? p.test(url) : url.includes(p)));
|
|
7
|
+
}
|
|
8
|
+
const NON_HTML_EXT = /\.(jpg|jpeg|png|gif|webp|svg|ico|pdf|zip|gz|tgz|rar|7z|exe|dmg|msi|mp3|mp4|avi|mov|webm|woff2?|ttf|eot|css|js|json|xml|rss|atom|csv|xlsx?|docx?|pptx?)(\?|$)/i;
|
|
9
|
+
/** A running crawl. Await `done` for the final report; call `cancel()` to stop early, `pause()`/`resume()` to suspend and restart. */
|
|
10
|
+
export class CrawlJob {
|
|
11
|
+
crawler;
|
|
12
|
+
options;
|
|
13
|
+
id = createId('crawl');
|
|
14
|
+
report;
|
|
15
|
+
done;
|
|
16
|
+
controller = new AbortController();
|
|
17
|
+
paused = false;
|
|
18
|
+
resumeWaiters = [];
|
|
19
|
+
constructor(crawler, options) {
|
|
20
|
+
this.crawler = crawler;
|
|
21
|
+
this.options = options;
|
|
22
|
+
this.report = {
|
|
23
|
+
id: this.id,
|
|
24
|
+
seeds: options.seeds.map(redactUrl),
|
|
25
|
+
status: 'running',
|
|
26
|
+
startedAt: new Date().toISOString(),
|
|
27
|
+
finishedAt: null,
|
|
28
|
+
durationMs: 0,
|
|
29
|
+
visited: 0,
|
|
30
|
+
fetched: 0,
|
|
31
|
+
failed: 0,
|
|
32
|
+
skipped: 0,
|
|
33
|
+
blocked: 0,
|
|
34
|
+
unchanged: 0,
|
|
35
|
+
queued: 0,
|
|
36
|
+
pages: [],
|
|
37
|
+
robots: [],
|
|
38
|
+
error: null,
|
|
39
|
+
};
|
|
40
|
+
if (options.signal) {
|
|
41
|
+
if (options.signal.aborted)
|
|
42
|
+
this.controller.abort();
|
|
43
|
+
else
|
|
44
|
+
options.signal.addEventListener('abort', () => this.controller.abort(), { once: true });
|
|
45
|
+
}
|
|
46
|
+
this.done = this.crawler.run(this, options, this.controller.signal);
|
|
47
|
+
}
|
|
48
|
+
cancel() {
|
|
49
|
+
this.controller.abort();
|
|
50
|
+
}
|
|
51
|
+
/** Suspends the crawl at the next page boundary. In-flight pages finish; no new pages start until `resume()`. */
|
|
52
|
+
async pause() {
|
|
53
|
+
if (this.paused || this.report.status !== 'running')
|
|
54
|
+
return;
|
|
55
|
+
this.paused = true;
|
|
56
|
+
this.report.status = 'paused';
|
|
57
|
+
this.crawler.persist(this.report);
|
|
58
|
+
}
|
|
59
|
+
/** Resumes a paused crawl. */
|
|
60
|
+
resume() {
|
|
61
|
+
if (!this.paused)
|
|
62
|
+
return;
|
|
63
|
+
this.paused = false;
|
|
64
|
+
this.report.status = 'running';
|
|
65
|
+
const waiters = this.resumeWaiters.splice(0);
|
|
66
|
+
for (const w of waiters)
|
|
67
|
+
w();
|
|
68
|
+
}
|
|
69
|
+
get isPaused() {
|
|
70
|
+
return this.paused;
|
|
71
|
+
}
|
|
72
|
+
async waitIfPaused() {
|
|
73
|
+
if (this.paused) {
|
|
74
|
+
await new Promise((resolve) => this.resumeWaiters.push(resolve));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
get signal() {
|
|
78
|
+
return this.controller.signal;
|
|
79
|
+
}
|
|
80
|
+
progress() {
|
|
81
|
+
return { visited: this.report.visited, queued: this.report.queued, failed: this.report.failed, fetched: this.report.fetched, status: this.report.status };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Polite, policy-aware crawler: robots.txt, sitemaps, per-domain rate limiting, depth/page limits,
|
|
86
|
+
* URL normalisation and dedupe, retries for transient failures, cancellation and persisted history.
|
|
87
|
+
*/
|
|
88
|
+
export class Crawler {
|
|
89
|
+
deps;
|
|
90
|
+
lastRequestAt = new Map();
|
|
91
|
+
hostLocks = new Map();
|
|
92
|
+
jobs = new Map();
|
|
93
|
+
constructor(deps) {
|
|
94
|
+
this.deps = deps;
|
|
95
|
+
deps.db?.exec(`
|
|
96
|
+
CREATE TABLE IF NOT EXISTS crawl_history (
|
|
97
|
+
id TEXT PRIMARY KEY, seeds TEXT NOT NULL, status TEXT NOT NULL, started_at TEXT NOT NULL, finished_at TEXT,
|
|
98
|
+
visited INTEGER NOT NULL DEFAULT 0, fetched INTEGER NOT NULL DEFAULT 0, failed INTEGER NOT NULL DEFAULT 0,
|
|
99
|
+
skipped INTEGER NOT NULL DEFAULT 0, blocked INTEGER NOT NULL DEFAULT 0, report TEXT NOT NULL
|
|
100
|
+
);
|
|
101
|
+
CREATE TABLE IF NOT EXISTS crawl_fingerprints (
|
|
102
|
+
url TEXT PRIMARY KEY, content_hash TEXT NOT NULL, fetched_at TEXT NOT NULL
|
|
103
|
+
);
|
|
104
|
+
`);
|
|
105
|
+
}
|
|
106
|
+
/** Starts a crawl and returns the job immediately. */
|
|
107
|
+
start(options) {
|
|
108
|
+
if (!options.seeds?.length)
|
|
109
|
+
throw new CrawlError('At least one seed URL is required');
|
|
110
|
+
for (const s of options.seeds) {
|
|
111
|
+
if (!/^https?:\/\//i.test(s))
|
|
112
|
+
throw new CrawlError(`Seed must be an http(s) URL: ${s}`);
|
|
113
|
+
}
|
|
114
|
+
const job = new CrawlJob(this, options);
|
|
115
|
+
this.jobs.set(job.id, job);
|
|
116
|
+
void job.done.finally(() => {
|
|
117
|
+
// Keep the 50 most recent jobs in memory.
|
|
118
|
+
if (this.jobs.size > 50)
|
|
119
|
+
this.jobs.delete(this.jobs.keys().next().value);
|
|
120
|
+
});
|
|
121
|
+
return job;
|
|
122
|
+
}
|
|
123
|
+
/** Crawls and waits for the report. */
|
|
124
|
+
async crawl(options) {
|
|
125
|
+
return this.start(options).done;
|
|
126
|
+
}
|
|
127
|
+
/** Crawl history from SQLite (most recent first). */
|
|
128
|
+
history(limit = 20) {
|
|
129
|
+
if (!this.deps.db)
|
|
130
|
+
return [...this.jobs.values()].map((j) => ({ ...j.report, pageCount: j.report.pages.length }));
|
|
131
|
+
const rows = this.deps.db.prepare('SELECT report FROM crawl_history ORDER BY started_at DESC LIMIT ?').all(limit);
|
|
132
|
+
return rows.map((r) => {
|
|
133
|
+
const rep = JSON.parse(r.report);
|
|
134
|
+
const { pages, ...rest } = rep;
|
|
135
|
+
return { ...rest, pageCount: pages.length };
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
getReport(id) {
|
|
139
|
+
const job = this.jobs.get(id);
|
|
140
|
+
if (job)
|
|
141
|
+
return job.report;
|
|
142
|
+
const row = this.deps.db?.prepare('SELECT report FROM crawl_history WHERE id = ?').get(id);
|
|
143
|
+
return row ? JSON.parse(row.report) : null;
|
|
144
|
+
}
|
|
145
|
+
persist(report) {
|
|
146
|
+
this.deps.db
|
|
147
|
+
?.prepare('INSERT INTO crawl_history (id, seeds, status, started_at, finished_at, visited, fetched, failed, skipped, blocked, report) VALUES (?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET status=excluded.status, finished_at=excluded.finished_at, visited=excluded.visited, fetched=excluded.fetched, failed=excluded.failed, skipped=excluded.skipped, blocked=excluded.blocked, report=excluded.report')
|
|
148
|
+
.run(report.id, JSON.stringify(report.seeds), report.status, report.startedAt, report.finishedAt, report.visited, report.fetched, report.failed, report.skipped, report.blocked, JSON.stringify(report));
|
|
149
|
+
}
|
|
150
|
+
/** Waits until the host may be requested again (per-domain rate limiting, serialized per host). */
|
|
151
|
+
/** Stable content fingerprint for change detection. */
|
|
152
|
+
fingerprint(html) {
|
|
153
|
+
return createHash('sha256').update(html).digest('hex');
|
|
154
|
+
}
|
|
155
|
+
/** Returns the stored fingerprint hash for a URL, or null. */
|
|
156
|
+
getFingerprint(url) {
|
|
157
|
+
const row = this.deps.db?.prepare('SELECT content_hash FROM crawl_fingerprints WHERE url = ?').get(url);
|
|
158
|
+
return row?.content_hash ?? null;
|
|
159
|
+
}
|
|
160
|
+
/** Records the fingerprint for a URL (change detection). */
|
|
161
|
+
setFingerprint(url, hash) {
|
|
162
|
+
this.deps.db
|
|
163
|
+
?.prepare('INSERT INTO crawl_fingerprints (url, content_hash, fetched_at) VALUES (?,?,?) ON CONFLICT(url) DO UPDATE SET content_hash=excluded.content_hash, fetched_at=excluded.fetched_at')
|
|
164
|
+
.run(url, hash, new Date().toISOString());
|
|
165
|
+
}
|
|
166
|
+
/** Drops fingerprints (e.g. for a full re-crawl). */
|
|
167
|
+
clearFingerprints() {
|
|
168
|
+
this.deps.db?.exec('DELETE FROM crawl_fingerprints');
|
|
169
|
+
}
|
|
170
|
+
async throttle(host, delay, signal) {
|
|
171
|
+
const prev = this.hostLocks.get(host) ?? Promise.resolve();
|
|
172
|
+
let release;
|
|
173
|
+
const next = new Promise((r) => (release = r));
|
|
174
|
+
this.hostLocks.set(host, prev.then(() => next));
|
|
175
|
+
await prev;
|
|
176
|
+
try {
|
|
177
|
+
const wait = (this.lastRequestAt.get(host) ?? 0) + delay - Date.now();
|
|
178
|
+
if (wait > 0)
|
|
179
|
+
await sleep(wait, signal);
|
|
180
|
+
this.lastRequestAt.set(host, Date.now());
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
release();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/** @internal */
|
|
187
|
+
async run(job, options, signal) {
|
|
188
|
+
const d = this.deps.defaults;
|
|
189
|
+
const maxDepth = options.maxDepth ?? d.maxDepth;
|
|
190
|
+
const maxPages = options.maxPages ?? d.maxPages;
|
|
191
|
+
const concurrency = Math.max(1, options.concurrency ?? d.concurrency);
|
|
192
|
+
const perDomainDelay = options.perDomainDelay ?? d.perDomainDelay;
|
|
193
|
+
const respectRobots = options.respectRobots ?? d.respectRobots;
|
|
194
|
+
const sameSite = options.sameSite ?? d.sameSite;
|
|
195
|
+
const useSitemaps = options.useSitemaps ?? d.useSitemaps;
|
|
196
|
+
const retries = options.retries ?? d.retries;
|
|
197
|
+
const report = job.report;
|
|
198
|
+
const started = Date.now();
|
|
199
|
+
const seen = new Set();
|
|
200
|
+
const queue = [];
|
|
201
|
+
const seeds = options.seeds.map((s) => normalizeUrl(s));
|
|
202
|
+
const enqueue = (url, depth) => {
|
|
203
|
+
let n;
|
|
204
|
+
try {
|
|
205
|
+
n = normalizeUrl(url);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (seen.has(n) || depth > maxDepth)
|
|
211
|
+
return;
|
|
212
|
+
if (!/^https?:/i.test(n) || NON_HTML_EXT.test(new URL(n).pathname))
|
|
213
|
+
return;
|
|
214
|
+
if (sameSite && !seeds.some((s) => isSameSite(s, n, false)))
|
|
215
|
+
return;
|
|
216
|
+
if (options.include?.length && depth > 0 && !matches(options.include, n))
|
|
217
|
+
return;
|
|
218
|
+
if (options.exclude?.length && matches(options.exclude, n))
|
|
219
|
+
return;
|
|
220
|
+
seen.add(n);
|
|
221
|
+
queue.push({ url: n, depth });
|
|
222
|
+
};
|
|
223
|
+
this.deps.events.emit('crawler:started', { crawlId: job.id, seeds: report.seeds });
|
|
224
|
+
this.persist(report);
|
|
225
|
+
try {
|
|
226
|
+
for (const s of seeds)
|
|
227
|
+
enqueue(s, 0);
|
|
228
|
+
if (useSitemaps) {
|
|
229
|
+
for (const s of seeds) {
|
|
230
|
+
let status = null;
|
|
231
|
+
try {
|
|
232
|
+
status = respectRobots ? await this.deps.robots.get(s) : null;
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
// Seed blocked by the network policy: it is recorded as "blocked" when visited.
|
|
236
|
+
if (error.name === 'SecurityError')
|
|
237
|
+
continue;
|
|
238
|
+
throw error;
|
|
239
|
+
}
|
|
240
|
+
const declared = status?.robots.sitemaps ?? [];
|
|
241
|
+
const entries = await discoverSitemapUrls(this.deps.fetcher, declared.length ? declared : [`${new URL(s).origin}/sitemap.xml`], {
|
|
242
|
+
maxUrls: maxPages * 2,
|
|
243
|
+
signal,
|
|
244
|
+
});
|
|
245
|
+
for (const e of entries)
|
|
246
|
+
enqueue(e.url, 1);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
let active = 0;
|
|
250
|
+
let processed = 0;
|
|
251
|
+
let settled = false;
|
|
252
|
+
const done = new Promise((resolve, reject) => {
|
|
253
|
+
const finish = () => {
|
|
254
|
+
if (!settled) {
|
|
255
|
+
settled = true;
|
|
256
|
+
resolve();
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const fail = (err) => {
|
|
260
|
+
if (!settled) {
|
|
261
|
+
settled = true;
|
|
262
|
+
reject(err);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const pump = async () => {
|
|
266
|
+
if (settled)
|
|
267
|
+
return;
|
|
268
|
+
if (signal.aborted) {
|
|
269
|
+
if (active === 0)
|
|
270
|
+
finish();
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
// Pause gate: suspend at a page boundary until resume() is called.
|
|
274
|
+
await job.waitIfPaused();
|
|
275
|
+
if (settled || signal.aborted)
|
|
276
|
+
return;
|
|
277
|
+
while (!settled && active < concurrency && queue.length && processed < maxPages) {
|
|
278
|
+
const item = queue.shift();
|
|
279
|
+
processed++;
|
|
280
|
+
active++;
|
|
281
|
+
report.queued = queue.length;
|
|
282
|
+
this.processUrl(item, options, report, retries, perDomainDelay, respectRobots, signal, (links) => {
|
|
283
|
+
if (item.depth < maxDepth)
|
|
284
|
+
for (const l of links)
|
|
285
|
+
enqueue(l, item.depth + 1);
|
|
286
|
+
})
|
|
287
|
+
.catch((error) => {
|
|
288
|
+
if (!(error instanceof CancelledError))
|
|
289
|
+
this.deps.logger.debug('crawl page error', { error: error.message });
|
|
290
|
+
})
|
|
291
|
+
.finally(() => {
|
|
292
|
+
active--;
|
|
293
|
+
report.queued = queue.length;
|
|
294
|
+
this.deps.events.emit('crawler:progress', { crawlId: job.id, visited: report.visited, queued: queue.length, failed: report.failed });
|
|
295
|
+
if ((queue.length === 0 || processed >= maxPages || signal.aborted) && active === 0)
|
|
296
|
+
finish();
|
|
297
|
+
else
|
|
298
|
+
void pump();
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (active === 0 && (queue.length === 0 || processed >= maxPages))
|
|
302
|
+
finish();
|
|
303
|
+
};
|
|
304
|
+
void pump().catch(fail);
|
|
305
|
+
});
|
|
306
|
+
await done;
|
|
307
|
+
report.status = signal.aborted ? 'cancelled' : 'completed';
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
report.status = signal.aborted ? 'cancelled' : 'failed';
|
|
311
|
+
report.error = error.message;
|
|
312
|
+
}
|
|
313
|
+
report.finishedAt = new Date().toISOString();
|
|
314
|
+
report.durationMs = Date.now() - started;
|
|
315
|
+
report.queued = queue.length;
|
|
316
|
+
report.robots = this.deps.robots.snapshot().map((r) => ({ origin: r.origin, status: r.status }));
|
|
317
|
+
this.persist(report);
|
|
318
|
+
this.deps.events.emit('crawler:completed', { crawlId: job.id, visited: report.visited, failed: report.failed, duration: report.durationMs });
|
|
319
|
+
return report;
|
|
320
|
+
}
|
|
321
|
+
async processUrl(item, options, report, retries, perDomainDelay, respectRobots, signal, onLinks) {
|
|
322
|
+
const record = {
|
|
323
|
+
url: redactUrl(item.url),
|
|
324
|
+
depth: item.depth,
|
|
325
|
+
status: null,
|
|
326
|
+
outcome: 'fetched',
|
|
327
|
+
reason: null,
|
|
328
|
+
title: null,
|
|
329
|
+
durationMs: null,
|
|
330
|
+
links: 0,
|
|
331
|
+
};
|
|
332
|
+
report.pages.push(record);
|
|
333
|
+
report.visited++;
|
|
334
|
+
const host = getDomain(item.url);
|
|
335
|
+
try {
|
|
336
|
+
if (respectRobots) {
|
|
337
|
+
const verdict = await this.deps.robots.isAllowed(item.url);
|
|
338
|
+
if (!verdict.allowed) {
|
|
339
|
+
record.outcome = 'skipped';
|
|
340
|
+
record.reason = verdict.reason;
|
|
341
|
+
report.skipped++;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const robotsDelay = respectRobots ? ((await this.deps.robots.crawlDelayMs(item.url)) ?? 0) : 0;
|
|
346
|
+
const started = Date.now();
|
|
347
|
+
let html;
|
|
348
|
+
let finalUrl;
|
|
349
|
+
let status;
|
|
350
|
+
let contentType = 'text/html';
|
|
351
|
+
let headers = {};
|
|
352
|
+
let rendered = false;
|
|
353
|
+
if (options.render && this.deps.renderer) {
|
|
354
|
+
await this.throttle(host, Math.max(perDomainDelay, robotsDelay), signal);
|
|
355
|
+
const r = await this.deps.renderer(item.url, signal);
|
|
356
|
+
html = r.html;
|
|
357
|
+
finalUrl = r.url;
|
|
358
|
+
status = r.status;
|
|
359
|
+
rendered = true;
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
const res = await retry(async () => {
|
|
363
|
+
await this.throttle(host, Math.max(perDomainDelay, robotsDelay), signal);
|
|
364
|
+
const r = await this.deps.fetcher.fetch(item.url, {
|
|
365
|
+
timeout: options.timeout ?? this.deps.defaults.timeout,
|
|
366
|
+
maxBytes: this.deps.defaults.maxBytes,
|
|
367
|
+
signal,
|
|
368
|
+
});
|
|
369
|
+
if (r.status === 429 || r.status >= 500)
|
|
370
|
+
throw new CrawlError(`HTTP ${r.status}`, { retryable: true, details: { status: r.status } });
|
|
371
|
+
return r;
|
|
372
|
+
}, { attempts: retries + 1, delay: 1000, signal });
|
|
373
|
+
html = res.body;
|
|
374
|
+
finalUrl = res.url;
|
|
375
|
+
status = res.status;
|
|
376
|
+
contentType = res.contentType;
|
|
377
|
+
headers = res.headers;
|
|
378
|
+
}
|
|
379
|
+
record.status = status;
|
|
380
|
+
record.durationMs = Date.now() - started;
|
|
381
|
+
if (status !== null && status >= 400) {
|
|
382
|
+
record.outcome = 'failed';
|
|
383
|
+
record.reason = `HTTP ${status}`;
|
|
384
|
+
report.failed++;
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (!rendered && !/html|xml/i.test(contentType)) {
|
|
388
|
+
record.outcome = 'skipped';
|
|
389
|
+
record.reason = `unsupported content type ${contentType.split(';')[0]}`;
|
|
390
|
+
report.skipped++;
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
// Change detection: compare the content hash against the stored fingerprint.
|
|
394
|
+
const hash = this.fingerprint(html);
|
|
395
|
+
const previous = this.getFingerprint(finalUrl);
|
|
396
|
+
if (options.incremental && previous === hash) {
|
|
397
|
+
record.outcome = 'unchanged';
|
|
398
|
+
record.reason = 'content unchanged since last crawl';
|
|
399
|
+
record.title = extractDocument(html, { url: finalUrl }).title || null;
|
|
400
|
+
report.unchanged++;
|
|
401
|
+
// Fingerprints are still refreshed so the next crawl has a recent baseline.
|
|
402
|
+
this.setFingerprint(finalUrl, hash);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const document = extractDocument(html, { url: finalUrl });
|
|
406
|
+
record.title = document.title || null;
|
|
407
|
+
const robotsMeta = `${document.metadata.robots ?? ''} ${headers['x-robots-tag'] ?? ''}`.toLowerCase();
|
|
408
|
+
const noindex = /noindex|none/.test(robotsMeta);
|
|
409
|
+
const nofollow = /nofollow|none/.test(robotsMeta);
|
|
410
|
+
let links = [];
|
|
411
|
+
if (!nofollow) {
|
|
412
|
+
// Discover links from the whole page (navigation included), not just the main content.
|
|
413
|
+
const $ = parseHtml(html);
|
|
414
|
+
links = extractLinks($, $.root(), finalUrl, 2000)
|
|
415
|
+
.filter((l) => l.url.startsWith('http') && (options.followNofollow || !l.nofollow))
|
|
416
|
+
.map((l) => l.url);
|
|
417
|
+
}
|
|
418
|
+
record.links = links.length;
|
|
419
|
+
report.fetched++;
|
|
420
|
+
this.setFingerprint(finalUrl, hash);
|
|
421
|
+
if (finalUrl !== item.url)
|
|
422
|
+
onLinks([finalUrl]);
|
|
423
|
+
onLinks(links);
|
|
424
|
+
await options.onPage?.({
|
|
425
|
+
url: finalUrl,
|
|
426
|
+
requestedUrl: item.url,
|
|
427
|
+
depth: item.depth,
|
|
428
|
+
status,
|
|
429
|
+
contentType,
|
|
430
|
+
document,
|
|
431
|
+
noindex,
|
|
432
|
+
fetchedAt: new Date().toISOString(),
|
|
433
|
+
durationMs: record.durationMs,
|
|
434
|
+
rendered,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
catch (error) {
|
|
438
|
+
if (error instanceof CancelledError || error.name === 'AbortError' || signal.aborted) {
|
|
439
|
+
record.outcome = 'skipped';
|
|
440
|
+
record.reason = 'cancelled';
|
|
441
|
+
report.skipped++;
|
|
442
|
+
throw new CancelledError();
|
|
443
|
+
}
|
|
444
|
+
const name = error.name;
|
|
445
|
+
record.outcome = name === 'SecurityError' ? 'blocked' : 'failed';
|
|
446
|
+
record.reason = error.message;
|
|
447
|
+
if (record.outcome === 'blocked')
|
|
448
|
+
report.blocked++;
|
|
449
|
+
else
|
|
450
|
+
report.failed++;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
//# sourceMappingURL=crawler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawler.js","sourceRoot":"","sources":["../src/crawler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,cAAc,EACd,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,YAAY,EACZ,SAAS,EACT,KAAK,EACL,KAAK,GAGN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAA0B,MAAM,0BAA0B,CAAC;AAI5G,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA+EnD,SAAS,OAAO,CAAC,QAAgC,EAAE,GAAW;IAC5D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,YAAY,GAChB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CAAC;YACf,IAAI,KAAK,YAAY,cAAc,IAAK,KAAe,CAAC,IAAI,KAAK,YAAY,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBAChG,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;gBAC3B,MAAM,CAAC,MAAM,GAAG,WAAW,CAAC;gBAC5B,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,MAAM,IAAI,cAAc,EAAE,CAAC;YAC7B,CAAC;YACD,MAAM,IAAI,GAAI,KAAe,CAAC,IAAI,CAAC;YACnC,MAAM,CAAC,OAAO,GAAG,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,MAAM,CAAC,MAAM,GAAI,KAAe,CAAC,OAAO,CAAC;YACzC,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS;gBAAE,MAAM,CAAC,OAAO,EAAE,CAAC;;gBAC9C,MAAM,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { NetworkPolicy } from '@dream_engine/security';
|
|
2
|
+
export interface FetchOptions {
|
|
3
|
+
timeout?: number;
|
|
4
|
+
maxBytes?: number;
|
|
5
|
+
maxRedirects?: number;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
/** Accept header (default prefers HTML). */
|
|
8
|
+
accept?: string;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
method?: 'GET' | 'HEAD';
|
|
11
|
+
}
|
|
12
|
+
export interface FetchResult {
|
|
13
|
+
requestedUrl: string;
|
|
14
|
+
url: string;
|
|
15
|
+
status: number;
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
contentType: string;
|
|
18
|
+
body: string;
|
|
19
|
+
bytes: number;
|
|
20
|
+
truncated: boolean;
|
|
21
|
+
redirects: string[];
|
|
22
|
+
durationMs: number;
|
|
23
|
+
fetchedAt: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* HTTP(S) fetcher that enforces the network policy at connection time (via a validating DNS lookup),
|
|
27
|
+
* re-validates every redirect hop, bounds response size and supports cancellation.
|
|
28
|
+
*/
|
|
29
|
+
export declare class SafeFetcher {
|
|
30
|
+
private readonly policy;
|
|
31
|
+
private readonly defaults;
|
|
32
|
+
private readonly httpAgent;
|
|
33
|
+
private readonly httpsAgent;
|
|
34
|
+
constructor(policy: NetworkPolicy, defaults: {
|
|
35
|
+
userAgent: string;
|
|
36
|
+
timeout: number;
|
|
37
|
+
maxBytes: number;
|
|
38
|
+
maxRedirects: number;
|
|
39
|
+
});
|
|
40
|
+
fetch(input: string, options?: FetchOptions): Promise<FetchResult>;
|
|
41
|
+
private request;
|
|
42
|
+
private readBody;
|
|
43
|
+
destroy(): void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;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