Comparing version 5.0.1 to 5.0.2
@@ -295,3 +295,3 @@ 'use strict'; | ||
_controller = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(name, mode, requestConfigs, intervalTime, crawlSingleFnExtraConfig, crawlSingleFn) { | ||
var isPriorityCrawl, targetRequestConfigs, controllerConfigs, batchCrawl, crawlQueue, retriedIds, succssIds, errorIds; | ||
var isPriorityCrawl, targetRequestConfigs, controllerConfigs, batchCrawl, i, crawlQueue, retriedIds, succssIds, errorIds; | ||
return _regeneratorRuntime().wrap(function _callee8$(_context9) { | ||
@@ -325,11 +325,12 @@ while (1) switch (_context9.prev = _context9.next) { | ||
batchCrawl = mode === 'async' ? asyncBatchCrawl : syncBatchCrawl; | ||
i = 0; | ||
crawlQueue = controllerConfigs; | ||
case 6: | ||
case 7: | ||
if (!crawlQueue.length) { | ||
_context9.next = 13; | ||
_context9.next = 14; | ||
break; | ||
} | ||
_context9.next = 9; | ||
_context9.next = 10; | ||
return batchCrawl(crawlQueue, intervalTime, crawlSingleFnExtraConfig, crawlSingleFn); | ||
case 9: | ||
case 10: | ||
crawlQueue = crawlQueue.filter(function (config) { | ||
@@ -342,7 +343,7 @@ return config.maxRetry && !config.isSuccess && config.crawlCount <= config.maxRetry; | ||
}); | ||
log(logWarn("Ids to retry: [ ".concat(retriedIds.join(' - '), " ]"))); | ||
log(logWarn("Retry: ".concat(++i, " - Ids to retry: [ ").concat(retriedIds.join(' - '), " ]"))); | ||
} | ||
_context9.next = 6; | ||
_context9.next = 7; | ||
break; | ||
case 13: | ||
case 14: | ||
// 统计结果 | ||
@@ -362,3 +363,3 @@ succssIds = []; | ||
return _context9.abrupt("return", controllerConfigs); | ||
case 20: | ||
case 21: | ||
case "end": | ||
@@ -365,0 +366,0 @@ return _context9.stop(); |
{ | ||
"name": "x-crawl", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"author": "coderHXL", | ||
@@ -5,0 +5,0 @@ "description": "x-crawl is a flexible nodejs crawler library.", |
@@ -20,3 +20,3 @@ # x-crawl [![npm](https://img.shields.io/npm/v/x-crawl.svg)](https://www.npmjs.com/package/x-crawl) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/coder-hxl/x-crawl/blob/main/LICENSE) | ||
- **🧾 Capture Record** - Capture and record the crawled results, and highlight them on the console. | ||
- **🦾TypeScript** - Own types, implement complete types through generics. | ||
- **🦾 TypeScript** - Own types, implement complete types through generics. | ||
@@ -116,3 +116,3 @@ ## Relationship with puppeteer | ||
// 2.Create a crawler instance | ||
const myXCrawl = xCrawl({ intervalTime: { max: 3000, min: 2000 } }) | ||
const myXCrawl = xCrawl({ maxRetry: 3, intervalTime: { max: 3000, min: 2000 } }) | ||
@@ -132,3 +132,3 @@ // 3.Set the crawling task | ||
// Store the image URL | ||
const imgUrls: string[] = [] | ||
const imgUrls = [] | ||
const elSelectorMap = ['.c14whb16', '.a1stauiv'] | ||
@@ -573,3 +573,3 @@ for (const item of res) { | ||
More information about the results can be found at [About results](# About-results), which can be selected according to the actual situation. | ||
More information about the results can be found at [About results](#About-results) , which can be selected according to the actual situation. | ||
@@ -702,3 +702,3 @@ ### crawlData | ||
More information about the results can be found at [About results](# About-results), which can be selected according to the actual situation. | ||
More information about the results can be found at [About results](#About-results) , which can be selected according to the actual situation. | ||
@@ -821,3 +821,3 @@ ### crawlFile | ||
More information about the results can be found at [About results](# About-results), which can be selected according to the actual situation. | ||
More information about the results can be found at [About results](#About-results) , which can be selected according to the actual situation. | ||
@@ -824,0 +824,0 @@ ### startPolling |
Sorry, the diff of this file is not supported yet
152255
2462