updated small fix
This commit is contained in:
parent
421155d3fa
commit
84edf517d5
10
src/cli.ts
10
src/cli.ts
@ -23,8 +23,8 @@ let browser: Browser = null;
|
||||
let sitemapUrl: string = "";
|
||||
let writer: CsvWriter<ObjectMap<any>> = 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({
|
||||
|
Loading…
x
Reference in New Issue
Block a user