-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (32 loc) · 1.03 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import linksScraper from './src/node/links-scraper.js'
import contentBatchScraper from './src/node/content-scraper.js'
import combineFiles from './src/node/combine-files.js'
import {
RUN_CONTENT_SCRAPER,
RUN_LINKS_SCRAPER
} from './src/utils/scraper-constants.js'
/**
* Executes the links scraper, content scraper, and file combining functionality based on the configured settings.
*/
if (RUN_LINKS_SCRAPER && RUN_CONTENT_SCRAPER) {
// Run both the links scraper and content scraper
linksScraper()
.then(contentBatchScraper)
.then(combineFiles)
.catch(error => {
console.error('Error Occurred During Scraping:', error);
});
} else if (RUN_LINKS_SCRAPER) {
// Run only the links scraper
linksScraper()
.catch(error => {
console.error('Error Occurred During Links Scraping:', error);
});
} else if (RUN_CONTENT_SCRAPER) {
// Run only the content scraper
contentBatchScraper()
.then(combineFiles)
.catch(error => {
console.error('Error Occurred During Content Scraping:', error);
});
}