Ver código fonte

crawlMaxDepth = 0 to ignore depth

Former-commit-id: c35b16c9b14324ec1c67d2be192f24b9f92b6e3f
Gildas 5 anos atrás
pai
commit
41154e64cc
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      cli/single-file

+ 1 - 1
cli/single-file

@@ -103,7 +103,7 @@ async function runNextTask(tasks, options) {
 		task.status = "processed";
 		if (pageData) {
 			task.filename = pageData.filename;
-			if (options.crawlLinks && task.depth < options.crawlMaxDepth) {
+			if (options.crawlLinks && (options.crawlMaxDepth == 0) || (task.depth < options.crawlMaxDepth)) {
 				let newTasks = pageData.links
 					.map(urlLink => ({ url: rewriteURL(urlLink, options.urlRewriteRules), originalUrl: urlLink, depth: task.depth + 1 }))
 					.filter(task => task.url && VALID_URL_TEST.test(task.url) && !tasks.find(otherTask => otherTask.url == task.url));