mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 06:27:38 +00:00
chore: refactor config and fix audits (#406)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {Link, Series, Store} from './model';
|
||||
import {Logger, Print} from '../logger';
|
||||
import {Print, logger} from '../logger';
|
||||
import {Browser} from 'puppeteer';
|
||||
import cheerio from 'cheerio';
|
||||
import {filterSeries} from './filter';
|
||||
@@ -7,7 +7,7 @@ import {usingResponse} from '../util';
|
||||
|
||||
function addNewLinks(store: Store, links: Link[], series: Series) {
|
||||
if (links.length === 0) {
|
||||
Logger.error(Print.message('NO STORE LINKS FOUND', series, store, true));
|
||||
logger.error(Print.message('NO STORE LINKS FOUND', series, store, true));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -19,8 +19,8 @@ function addNewLinks(store: Store, links: Link[], series: Series) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.info(Print.message(`FOUND ${newLinks.length} STORE LINKS`, series, store, true));
|
||||
Logger.debug(JSON.stringify(newLinks, null, 2));
|
||||
logger.info(Print.message(`FOUND ${newLinks.length} STORE LINKS`, series, store, true));
|
||||
logger.debug(JSON.stringify(newLinks, null, 2));
|
||||
|
||||
store.links = store.links.concat(newLinks);
|
||||
}
|
||||
@@ -37,13 +37,13 @@ export async function fetchLinks(store: Store, browser: Browser) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Logger.info(Print.message('DETECTING STORE LINKS', series, store, true));
|
||||
logger.info(Print.message('DETECTING STORE LINKS', series, store, true));
|
||||
|
||||
promises.push(usingResponse(browser, url, async response => {
|
||||
const text = await response?.text();
|
||||
|
||||
if (!text) {
|
||||
Logger.error(Print.message('NO RESPONSE', series, store, true));
|
||||
logger.error(Print.message('NO RESPONSE', series, store, true));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user