@detiq/crawler 1.1.9 → 1.1.10
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/accessibility-auditor.js +54 -74
- package/dist/ai-login.js +227 -249
- package/dist/auth-token-rotator.js +57 -67
- package/dist/auth.js +299 -336
- package/dist/browser-extension.js +104 -142
- package/dist/captcha-solver.js +98 -125
- package/dist/color-contrast.js +77 -89
- package/dist/content-chunker.js +126 -126
- package/dist/content-dedup.js +54 -71
- package/dist/cookie-consent.js +68 -83
- package/dist/cookie-jar.js +53 -60
- package/dist/crawler.js +4494 -5353
- package/dist/custom-js-injector.js +45 -61
- package/dist/dark-mode-capture.js +67 -81
- package/dist/dead-link-detector.js +47 -55
- package/dist/element-hash.js +8 -12
- package/dist/email-otp.js +154 -195
- package/dist/engine-router.js +87 -98
- package/dist/export/bulk-export.js +70 -55
- package/dist/export/vector-export.js +77 -105
- package/dist/extractors/advanced.js +249 -266
- package/dist/extractors/artifact-envelope.js +59 -58
- package/dist/failure-analysis-agent.js +37 -33
- package/dist/feature-flag-detector.js +51 -66
- package/dist/form-detector.js +55 -75
- package/dist/frontier.js +76 -101
- package/dist/gap-pass.js +68 -89
- package/dist/graphql-detector.js +62 -72
- package/dist/http-engine.js +282 -330
- package/dist/incremental-diff.js +54 -87
- package/dist/index.js +67 -28
- package/dist/input-fuzzer.js +93 -97
- package/dist/interactive-probe.js +715 -827
- package/dist/job-queue.js +2151 -2169
- package/dist/js-coverage.js +52 -56
- package/dist/js-router-detector.js +86 -117
- package/dist/language-detector.js +51 -63
- package/dist/link-classifier.js +32 -50
- package/dist/live-view.js +91 -108
- package/dist/locator-extractor.js +151 -187
- package/dist/logger.js +9 -7
- package/dist/markdown-extract.js +48 -61
- package/dist/native-crawler.js +780 -946
- package/dist/network-observer.js +135 -156
- package/dist/network-throttle.js +29 -40
- package/dist/openapi-generator.js +77 -92
- package/dist/pdf-extractor.js +72 -90
- package/dist/performance-metrics.js +80 -102
- package/dist/phash.js +125 -144
- package/dist/pii-scrubber.js +65 -68
- package/dist/playwright-recorder.js +70 -58
- package/dist/policies/crawl-safety.js +31 -34
- package/dist/profiles/domain-profile.js +130 -125
- package/dist/proxy.js +146 -172
- package/dist/rate-limiter.js +58 -65
- package/dist/redirect-tracker.js +60 -64
- package/dist/redis-frontier.js +116 -136
- package/dist/redis-queue.js +157 -144
- package/dist/response-cache.js +127 -140
- package/dist/responsive-detector.js +42 -46
- package/dist/retry-policy.js +46 -50
- package/dist/robots-txt.js +69 -83
- package/dist/screen-reader.js +45 -70
- package/dist/screenshot-masker.js +59 -77
- package/dist/seo-checker.js +88 -107
- package/dist/session-capture.js +192 -212
- package/dist/session-export.js +107 -133
- package/dist/sitemap-writer.js +38 -41
- package/dist/sitemap.js +141 -202
- package/dist/skyvern.js +123 -148
- package/dist/sqs-queue.js +42 -42
- package/dist/sso-token.js +74 -90
- package/dist/stealth/human-behavior.js +156 -173
- package/dist/telemetry.js +68 -82
- package/dist/test-executor.js +309 -335
- package/dist/tls-fingerprint.js +77 -88
- package/dist/url-pattern-completer.js +71 -90
- package/dist/visual-diff-verdict.js +23 -38
- package/dist/webhook-notifier.js +71 -69
- package/dist/websocket-detector.js +56 -68
- package/dist/worker.js +29 -38
- package/package.json +1 -1
package/dist/markdown-extract.js
CHANGED
|
@@ -1,67 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* article body), stripped of nav/ads/chrome. Ideal for content/marketing
|
|
7
|
-
* pages and RAG chunking. null when Readability finds no article (most
|
|
8
|
-
* app UI screens — dashboards, forms — legitimately have none).
|
|
9
|
-
* - "full" markdown: the whole visible page converted straight to Markdown,
|
|
10
|
-
* always present. The fallback for app screens where there's no "article".
|
|
11
|
-
*
|
|
12
|
-
* Runs entirely on an already-captured `page.content()` string — no extra
|
|
13
|
-
* network fetch, no extra page navigation.
|
|
14
|
-
*/
|
|
15
|
-
import { parseHTML } from 'linkedom';
|
|
16
|
-
import { Readability } from '@mozilla/readability';
|
|
17
|
-
import TurndownService from 'turndown';
|
|
18
|
-
const turndown = new TurndownService({ headingStyle: 'atx', codeBlockStyle: 'fenced' });
|
|
19
|
-
turndown.remove(['script', 'style', 'noscript', 'svg', 'iframe']);
|
|
1
|
+
import { parseHTML } from "linkedom";
|
|
2
|
+
import { Readability } from "@mozilla/readability";
|
|
3
|
+
import TurndownService from "turndown";
|
|
4
|
+
const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
|
|
5
|
+
turndown.remove(["script", "style", "noscript", "svg", "iframe"]);
|
|
20
6
|
function stripNoiseElements(document) {
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
const noisy = document.querySelectorAll('script, style, noscript, svg, iframe, [aria-hidden="true"]');
|
|
8
|
+
noisy.forEach((el) => el.remove());
|
|
23
9
|
}
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
function extractMarkdown(html, url) {
|
|
11
|
+
try {
|
|
12
|
+
const { document } = parseHTML(html);
|
|
13
|
+
stripNoiseElements(document);
|
|
14
|
+
let readabilityResult = null;
|
|
26
15
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// full-page fallback below still has an intact document.
|
|
33
|
-
const { document: readerDoc } = parseHTML(html);
|
|
34
|
-
stripNoiseElements(readerDoc);
|
|
35
|
-
readabilityResult = new Readability(readerDoc, { charThreshold: 50 }).parse();
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
readabilityResult = null;
|
|
39
|
-
}
|
|
40
|
-
if (readabilityResult?.content && readabilityResult.textContent.trim().length >= 50) {
|
|
41
|
-
const markdown = turndown.turndown(readabilityResult.content);
|
|
42
|
-
return {
|
|
43
|
-
markdown: `# ${readabilityResult.title || document.title || url}\n\n${markdown}`,
|
|
44
|
-
method: 'readability',
|
|
45
|
-
title: readabilityResult.title || document.title || null,
|
|
46
|
-
wordCount: readabilityResult.textContent.trim().split(/\s+/).length,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const body = document.body;
|
|
50
|
-
if (!body)
|
|
51
|
-
return null;
|
|
52
|
-
const markdown = turndown.turndown(body.innerHTML || '');
|
|
53
|
-
const text = markdown.trim();
|
|
54
|
-
if (!text)
|
|
55
|
-
return null;
|
|
56
|
-
const title = document.title || null;
|
|
57
|
-
return {
|
|
58
|
-
markdown: title ? `# ${title}\n\n${markdown}` : markdown,
|
|
59
|
-
method: 'full-page',
|
|
60
|
-
title,
|
|
61
|
-
wordCount: text.split(/\s+/).length,
|
|
62
|
-
};
|
|
16
|
+
const { document: readerDoc } = parseHTML(html);
|
|
17
|
+
stripNoiseElements(readerDoc);
|
|
18
|
+
readabilityResult = new Readability(readerDoc, { charThreshold: 50 }).parse();
|
|
19
|
+
} catch {
|
|
20
|
+
readabilityResult = null;
|
|
63
21
|
}
|
|
64
|
-
|
|
65
|
-
|
|
22
|
+
if (readabilityResult?.content && readabilityResult.textContent.trim().length >= 50) {
|
|
23
|
+
const markdown2 = turndown.turndown(readabilityResult.content);
|
|
24
|
+
return {
|
|
25
|
+
markdown: `# ${readabilityResult.title || document.title || url}
|
|
26
|
+
|
|
27
|
+
${markdown2}`,
|
|
28
|
+
method: "readability",
|
|
29
|
+
title: readabilityResult.title || document.title || null,
|
|
30
|
+
wordCount: readabilityResult.textContent.trim().split(/\s+/).length
|
|
31
|
+
};
|
|
66
32
|
}
|
|
33
|
+
const body = document.body;
|
|
34
|
+
if (!body) return null;
|
|
35
|
+
const markdown = turndown.turndown(body.innerHTML || "");
|
|
36
|
+
const text = markdown.trim();
|
|
37
|
+
if (!text) return null;
|
|
38
|
+
const title = document.title || null;
|
|
39
|
+
return {
|
|
40
|
+
markdown: title ? `# ${title}
|
|
41
|
+
|
|
42
|
+
${markdown}` : markdown,
|
|
43
|
+
method: "full-page",
|
|
44
|
+
title,
|
|
45
|
+
wordCount: text.split(/\s+/).length
|
|
46
|
+
};
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
67
50
|
}
|
|
51
|
+
export {
|
|
52
|
+
extractMarkdown
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=markdown-extract.js.map
|