@detiq/crawler 1.1.9 → 1.1.11

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.
Files changed (83) hide show
  1. package/dist/accessibility-auditor.js +54 -74
  2. package/dist/ai-login.js +227 -249
  3. package/dist/auth-token-rotator.js +57 -67
  4. package/dist/auth.js +299 -336
  5. package/dist/browser-extension.js +104 -142
  6. package/dist/captcha-solver.js +98 -125
  7. package/dist/color-contrast.js +77 -89
  8. package/dist/content-chunker.js +126 -126
  9. package/dist/content-dedup.js +54 -71
  10. package/dist/cookie-consent.js +68 -83
  11. package/dist/cookie-jar.js +53 -60
  12. package/dist/crawler.js +4494 -5353
  13. package/dist/custom-js-injector.js +45 -61
  14. package/dist/dark-mode-capture.js +67 -81
  15. package/dist/dead-link-detector.js +47 -55
  16. package/dist/element-hash.js +8 -12
  17. package/dist/email-otp.js +154 -195
  18. package/dist/engine-router.js +87 -98
  19. package/dist/export/bulk-export.js +70 -55
  20. package/dist/export/vector-export.js +77 -105
  21. package/dist/extractors/advanced.js +249 -266
  22. package/dist/extractors/artifact-envelope.js +59 -58
  23. package/dist/failure-analysis-agent.js +37 -33
  24. package/dist/feature-flag-detector.js +51 -66
  25. package/dist/form-detector.js +55 -75
  26. package/dist/frontier.js +76 -101
  27. package/dist/gap-pass.js +68 -89
  28. package/dist/graphql-detector.js +62 -72
  29. package/dist/http-engine.js +282 -330
  30. package/dist/incremental-diff.js +54 -87
  31. package/dist/index.js +67 -28
  32. package/dist/input-fuzzer.js +93 -97
  33. package/dist/interactive-probe.js +715 -827
  34. package/dist/job-queue.js +2151 -2169
  35. package/dist/js-coverage.js +52 -56
  36. package/dist/js-router-detector.js +86 -117
  37. package/dist/language-detector.js +51 -63
  38. package/dist/link-classifier.js +32 -50
  39. package/dist/live-view.js +91 -108
  40. package/dist/locator-extractor.js +151 -187
  41. package/dist/logger.js +9 -7
  42. package/dist/markdown-extract.js +48 -61
  43. package/dist/native-crawler.js +780 -946
  44. package/dist/network-observer.js +135 -156
  45. package/dist/network-throttle.js +29 -40
  46. package/dist/openapi-generator.js +77 -92
  47. package/dist/pdf-extractor.js +72 -90
  48. package/dist/performance-metrics.js +80 -102
  49. package/dist/phash.js +125 -144
  50. package/dist/pii-scrubber.js +65 -68
  51. package/dist/playwright-recorder.js +70 -58
  52. package/dist/policies/crawl-safety.js +31 -34
  53. package/dist/profiles/domain-profile.js +130 -125
  54. package/dist/proxy.js +146 -172
  55. package/dist/rate-limiter.js +58 -65
  56. package/dist/redirect-tracker.js +60 -64
  57. package/dist/redis-frontier.js +116 -136
  58. package/dist/redis-queue.js +157 -144
  59. package/dist/response-cache.js +127 -140
  60. package/dist/responsive-detector.js +42 -46
  61. package/dist/retry-policy.js +46 -50
  62. package/dist/robots-txt.js +69 -83
  63. package/dist/screen-reader.js +45 -70
  64. package/dist/screenshot-masker.js +59 -77
  65. package/dist/seo-checker.js +88 -107
  66. package/dist/session-capture.js +192 -212
  67. package/dist/session-export.js +107 -133
  68. package/dist/sitemap-writer.js +38 -41
  69. package/dist/sitemap.js +141 -202
  70. package/dist/skyvern.js +123 -148
  71. package/dist/sqs-queue.js +42 -42
  72. package/dist/sso-token.js +74 -90
  73. package/dist/stealth/human-behavior.js +156 -173
  74. package/dist/telemetry.js +68 -82
  75. package/dist/test-executor.js +309 -335
  76. package/dist/tls-fingerprint.js +77 -88
  77. package/dist/url-pattern-completer.js +71 -90
  78. package/dist/visual-diff-verdict.js +23 -38
  79. package/dist/webhook-notifier.js +71 -69
  80. package/dist/websocket-detector.js +56 -68
  81. package/dist/worker.js +29 -38
  82. package/package.json +1 -1
  83. package/src/job-queue.ts +136 -0
@@ -1,67 +1,54 @@
1
- /**
2
- * HTML → Markdown extraction for crawled pages — matches crawl4AI's markdown
3
- * output capability. Two-tier, mirroring crawl4AI's "markdown" vs "fit markdown":
4
- *
5
- * - "fit" markdown: Readability's best guess at the primary content (title +
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
- const noisy = document.querySelectorAll('script, style, noscript, svg, iframe, [aria-hidden="true"]');
22
- noisy.forEach((el) => el.remove());
7
+ const noisy = document.querySelectorAll('script, style, noscript, svg, iframe, [aria-hidden="true"]');
8
+ noisy.forEach((el) => el.remove());
23
9
  }
24
- /** Best-effort HTML→Markdown for one crawled page. Never throws. */
25
- export function extractMarkdown(html, url) {
10
+ function extractMarkdown(html, url) {
11
+ try {
12
+ const { document } = parseHTML(html);
13
+ stripNoiseElements(document);
14
+ let readabilityResult = null;
26
15
  try {
27
- const { document } = parseHTML(html);
28
- stripNoiseElements(document);
29
- let readabilityResult = null;
30
- try {
31
- // Readability mutates the DOM it's given — clone via re-parsing so the
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
- catch {
65
- return null;
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