mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Merge pull request #1687 from 0xi4o/bug/scrap-limit
Fix: relative links method and limit not applying to manage links
This commit is contained in:
@@ -126,7 +126,9 @@ class Cheerio_DocumentLoaders implements INode {
|
||||
let docs = []
|
||||
if (relativeLinksMethod) {
|
||||
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
||||
if (!limit) limit = 10
|
||||
// if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined
|
||||
// so when limit is 0 we can fetch all the links
|
||||
if (limit === null || limit === undefined) limit = 10
|
||||
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
||||
const pages: string[] =
|
||||
selectedLinks && selectedLinks.length > 0
|
||||
@@ -143,7 +145,7 @@ class Cheerio_DocumentLoaders implements INode {
|
||||
} else if (selectedLinks && selectedLinks.length > 0) {
|
||||
if (process.env.DEBUG === 'true')
|
||||
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
||||
for (const page of selectedLinks) {
|
||||
for (const page of selectedLinks.slice(0, limit)) {
|
||||
docs.push(...(await cheerioLoader(page)))
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -167,7 +167,9 @@ class Playwright_DocumentLoaders implements INode {
|
||||
let docs = []
|
||||
if (relativeLinksMethod) {
|
||||
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
||||
if (!limit) limit = 10
|
||||
// if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined
|
||||
// so when limit is 0 we can fetch all the links
|
||||
if (limit === null || limit === undefined) limit = 10
|
||||
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
||||
const pages: string[] =
|
||||
selectedLinks && selectedLinks.length > 0
|
||||
@@ -184,7 +186,7 @@ class Playwright_DocumentLoaders implements INode {
|
||||
} else if (selectedLinks && selectedLinks.length > 0) {
|
||||
if (process.env.DEBUG === 'true')
|
||||
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
||||
for (const page of selectedLinks) {
|
||||
for (const page of selectedLinks.slice(0, limit)) {
|
||||
docs.push(...(await playwrightLoader(page)))
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -168,7 +168,9 @@ class Puppeteer_DocumentLoaders implements INode {
|
||||
let docs = []
|
||||
if (relativeLinksMethod) {
|
||||
if (process.env.DEBUG === 'true') options.logger.info(`Start ${relativeLinksMethod}`)
|
||||
if (!limit) limit = 10
|
||||
// if limit is 0 we don't want it to default to 10 so we check explicitly for null or undefined
|
||||
// so when limit is 0 we can fetch all the links
|
||||
if (limit === null || limit === undefined) limit = 10
|
||||
else if (limit < 0) throw new Error('Limit cannot be less than 0')
|
||||
const pages: string[] =
|
||||
selectedLinks && selectedLinks.length > 0
|
||||
@@ -185,7 +187,7 @@ class Puppeteer_DocumentLoaders implements INode {
|
||||
} else if (selectedLinks && selectedLinks.length > 0) {
|
||||
if (process.env.DEBUG === 'true')
|
||||
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
|
||||
for (const page of selectedLinks) {
|
||||
for (const page of selectedLinks.slice(0, limit)) {
|
||||
docs.push(...(await puppeteerLoader(page)))
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user