modify puppeteer web crawl

This commit is contained in:
chungyau97
2023-07-05 17:07:45 +08:00
parent 92e50a676c
commit c18e98761a
2 changed files with 29 additions and 26 deletions
+1 -1
View File
@@ -242,7 +242,7 @@ export async function crawl(baseURL: string, currentURL: string, pages: string[]
const baseURLObj = new URL(baseURL)
const currentURLObj = new URL(currentURL)
if (limit !== 0) if (pages.length === limit) return pages
if (limit !== 0 && pages.length === limit) return pages
if (baseURLObj.hostname !== currentURLObj.hostname) return pages