@detiq/crawler 1.0.7 → 1.0.9

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/crawler.js CHANGED
@@ -204,7 +204,8 @@ async function launchChromeCDP(execPath, extraArgs, proxy) {
204
204
  `--remote-debugging-port=${port}`,
205
205
  "--remote-allow-origins=*",
206
206
  "--no-first-run",
207
- "--no-default-browser-check"
207
+ "--no-default-browser-check",
208
+ "--window-size=1280,900"
208
209
  ]
209
210
  });
210
211
  const deadline = Date.now() + 1e4;
@@ -2183,6 +2184,8 @@ ${snippet}`,
2183
2184
  })();
2184
2185
  }
2185
2186
  const linkMappings = await extractLinkMappings(page, origin);
2187
+ await AppBrain.clearScreenElements(opts.tenantId, opts.projectId, screen.id).catch(() => {
2188
+ });
2186
2189
  for (let _ei = 0; _ei < elements.length; _ei += 4) {
2187
2190
  const _batch = elements.slice(_ei, _ei + 4);
2188
2191
  await Promise.all(_batch.map(async (el) => {
@@ -3393,8 +3396,12 @@ async function contentFallbackElements(page) {
3393
3396
  const text = p.textContent?.replace(/\s+/g, " ").trim().slice(0, 300);
3394
3397
  if (text && text.length > 10 && text.length < 400) addUniq({ meaning: text, role: "cta-section" });
3395
3398
  });
3396
- document.querySelectorAll('nav a, [role="navigation"] a, header nav a, footer nav a, [aria-label*="navigation" i] a, [aria-label*="menu" i] a').forEach((a) => {
3397
- if (!isVisible(a)) return;
3399
+ const isNavVisible = (el) => {
3400
+ const s = window.getComputedStyle(el);
3401
+ return s.display !== "none" && s.visibility !== "hidden" && s.opacity !== "0";
3402
+ };
3403
+ document.querySelectorAll('nav a, [role="navigation"] a, header a, header nav a, footer nav a, [aria-label*="navigation" i] a, [aria-label*="menu" i] a').forEach((a) => {
3404
+ if (!isNavVisible(a)) return;
3398
3405
  const label = (a.getAttribute("aria-label") || a.textContent?.replace(/\s+/g, " ").trim() || "").slice(0, 60);
3399
3406
  const href = a.href;
3400
3407
  if (!label || !href || /^(javascript:|#$)/i.test(href)) return;