diff --git a/src/cli.ts b/src/cli.ts index 47b3c8a..3bd0ef2 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -23,8 +23,8 @@ let browser: Browser = null; let sitemapUrl: string = ""; let writer: CsvWriter> = null; -debugStart(); -// start(); +// debugStart(); +start(); async function debugStart() { browser = await launch({ headless: false }); @@ -72,7 +72,7 @@ async function start() { for (const sitemapUrl of sitemapUrls) { - console.log(`Crawling found sitemap: ${sitemapUrl}`); + console.log(`Crawling sitemap: ${sitemapUrl}`); const sitemapRequest = await axios.get(sitemapUrl); const $ = cheerio.load(sitemapRequest.data, { xmlMode: true }); @@ -85,13 +85,13 @@ async function start() { }); } - console.log(`Crawled ${urls.length} urls from sitemaps.`); + console.log(`Found ${urls.length} urls from sitemaps.`); browser = await launch({ headless: true }); console.log(`Initialized puppeteer browser.`); const today: Date = new Date(); - const datecode: string = today.getFullYear().toString() + "-" + (today.getMonth() + 1).toString() + "-" + today.getDay().toString(); + const datecode: string = `${today.getFullYear()}-${today.getMonth() + 1}-${today.getDate()}`; const domain: string = getDomain(sitemapUrl); const file = `${domain}_${datecode}_report.csv`; writer = createObjectCsvWriter({