mega-scraper
Version:
scrape a website's content.
26 lines (25 loc) • 1.09 kB
JavaScript
module.exports = async function initStatsCache (cache, { url, ...options } = {}) {
cache.hset('start', +new Date())
cache.hset('url', url)
cache.hset('lastTenScrapedReviews', '[]')
cache.hset('lastTenScreenshots', '[]')
cache.hset('messages', '[]')
cache.hset('totalPages', 0)
cache.hset('scrapedReviewsCount', 0)
cache.hset('accuracy', 0)
cache.hset('scrapedPages', 0)
cache.hset('productReviewsCount', 0)
cache.hset('pageSize', 0)
cache.hset('totalPages', 0)
cache.hset('elapsed', 0)
cache.hset('finish', 0)
options.timeout && cache.hset('timeout', options.timeout)
options.headless && cache.hset('headless', options.headless)
options.screenshot && cache.hset('screenshot', options.screenshot)
options.proxy && cache.hset('proxy', options.proxy)
options.images && cache.hset('images', options.images)
options.stylesheets && cache.hset('stylesheets', options.stylesheets)
options.javascript && cache.hset('javascript', options.javascript)
options.exit && cache.hset('exit', options.exit)
options.cookie && cache.hset('cookie', options.cookie)
}