MCPcopy
hub / github.com/yujiosaka/headless-chrome-crawler / queue

Method queue

lib/hccrawler.js:156–170  ·  view source on GitHub ↗

* @param {?Object|?Array<!string>|?string} options * @return {!Promise}

(options)

Source from the content-addressed store, hash-verified

154 * @return {!Promise}
155 */
156 async queue(options) {
157 await Promise.all(map(isArray(options) ? options : [options], async _options => {
158 const queueOptions = isString(_options) ? { url: _options } : _options;
159 each(CONSTRUCTOR_OPTIONS, option => {
160 if (queueOptions && queueOptions[option]) throw new Error(`Overriding ${option} is not allowed!`);
161 });
162 const mergedOptions = extend({}, this._options, queueOptions);
163 if (mergedOptions.evaluatePage) mergedOptions.evaluatePage = `(${mergedOptions.evaluatePage})()`;
164 if (!mergedOptions.url) throw new Error('Url must be defined!');
165 if (mergedOptions.device && !includes(deviceNames, mergedOptions.device)) throw new Error('Specified device is not supported!');
166 if (mergedOptions.delay > 0 && mergedOptions.maxConcurrency !== 1) throw new Error('Max concurrency must be 1 when delay is set!');
167 mergedOptions.url = parse(mergedOptions.url).href;
168 await this._push(omit(mergedOptions, CONSTRUCTOR_OPTIONS), 1, null);
169 }));
170 }
171
172 /**
173 * @return {!Promise}

Callers 13

redis.test.jsFile · 0.80
index.test.jsFile · 0.80
pause-resume.jsFile · 0.80
emulate-device.jsFile · 0.80
csv-exporter.jsFile · 0.80
priority-queue.jsFile · 0.80
custom-cache.jsFile · 0.80
custom-crawl.jsFile · 0.80
redis-cache.jsFile · 0.80
custom-exporter.jsFile · 0.80

Calls 1

_pushMethod · 0.95

Tested by

no test coverage detected