Update logic
This commit is contained in:
parent
095951aa4d
commit
71c98d8b80
@ -430,7 +430,7 @@ describe("E2E Tests for API Routes", () => {
|
||||
);
|
||||
expect(urls.length).toBeGreaterThan(1);
|
||||
|
||||
// Check if all URLs have a maximum depth of 1
|
||||
// Check if all URLs have an absolute maximum depth of 3 after the base URL depth was 2 and the maxDepth was 1
|
||||
urls.forEach((url: string) => {
|
||||
const depth = new URL(url).pathname.split("/").filter(Boolean).length;
|
||||
expect(depth).toBeLessThanOrEqual(3);
|
||||
|
@ -163,12 +163,11 @@ export class WebScraperDataProvider {
|
||||
inProgress?: (progress: Progress) => void
|
||||
): Promise<Document[]> {
|
||||
|
||||
const baseURLDepth = new URL(this.urls[0]).pathname.split('/').length - 2;
|
||||
const pathSplits = new URL(this.urls[0]).pathname.split('/');
|
||||
const baseURLDepth = pathSplits.length - (pathSplits[0].length === 0 && pathSplits[pathSplits.length - 1].length === 0 ? 1 : 0);
|
||||
const adjustedMaxDepth = this.maxCrawledDepth + baseURLDepth;
|
||||
|
||||
|
||||
|
||||
|
||||
const crawler = new WebCrawler({
|
||||
initialUrl: this.urls[0],
|
||||
includes: this.includes,
|
||||
|
Loading…
Reference in New Issue
Block a user