Skip to content

Commit 58c3a2a

Browse files
committed
Update crawl.js
1 parent 827527e commit 58c3a2a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/crawl.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { getMockResponse } from './utils/mockResponse.js';
1616
* @param {boolean} [options.extractionMode=true] - true for AI extraction, false for markdown conversion (NO AI/LLM)
1717
* @param {boolean} [options.cacheWebsite=true] - Whether to cache the website content
1818
* @param {number} [options.depth=2] - Maximum depth of the crawl (1-10)
19+
* @param {number|null} [options.breadth] - Maximum number of links to crawl per depth level. If null/undefined, unlimited (default). Controls the 'width' of exploration at each depth. Useful for limiting crawl scope on large sites. Note: maxPages always takes priority. Ignored when sitemap=true.
1920
* @param {number} [options.maxPages=2] - Maximum number of pages to crawl (1-100)
2021
* @param {boolean} [options.sameDomainOnly=true] - Whether to only crawl pages from the same domain
2122
* @param {boolean} [options.sitemap] - Whether to use sitemap for better page discovery
@@ -68,6 +69,7 @@ export async function crawl(
6869
const {
6970
cacheWebsite = true,
7071
depth = 2,
72+
breadth = null,
7173
maxPages = 2,
7274
sameDomainOnly = true,
7375
sitemap = false,
@@ -87,6 +89,10 @@ export async function crawl(
8789
render_heavy_js: renderHeavyJs,
8890
};
8991

92+
if (breadth !== null && breadth !== undefined) {
93+
payload.breadth = breadth;
94+
}
95+
9096
if (stealth) {
9197
payload.stealth = stealth;
9298
}

0 commit comments

Comments
 (0)