scraply 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/scraply.js +5 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "scraply",
3
3
  "description": "A simple, configurable and functional content scraper",
4
- "version": "1.0.10",
4
+ "version": "1.0.11",
5
5
  "main": "src/scraply.js",
6
6
  "type": "module",
7
7
  "scripts": {
package/src/scraply.js CHANGED
@@ -19,6 +19,9 @@ const init = () => {
19
19
  urlData.push({ url: normalizedURL, file: null, status: null, error: null });
20
20
  });
21
21
  saveQueue(urlData);
22
+
23
+ // Delete everything under CONFIG.MAIN_DIR
24
+ deleteDataFiles(CONFIG.MAIN_DIR);
22
25
  } else { // If the queue is not empty
23
26
  const allProcessed = urlData.every(entry => entry.file !== null || entry.error !== null);
24
27
  if (allProcessed) { // If all URLs have been processed
@@ -27,11 +30,12 @@ const init = () => {
27
30
  urlData = [];
28
31
  urlMetadata = {};
29
32
 
30
- // Delete everything except CONFIG.DATA_FORMATTER.FORMATTED_PATH, so that the formatted data is always preserved until the crawler really finalizes the data. This way, the Discord Bot will fetch the correct & latest data from the GitHub repo, without fetching any incomplete data or empty data, as it watches for file diffs!
33
+ // Delete everything except CONFIG.DATA_FORMATTER.FORMATTED_PATH, so that the formatted data is always preserved until the crawler really finalizes the data.
31
34
  deleteDataFiles(CONFIG.CRAWLER.QUEUE_PATH);
32
35
  deleteDataFiles(CONFIG.CRAWLER.CRAWLED_PATH);
33
36
  deleteDataFiles(CONFIG.DATA_FORMATTER.ERROR_REPORT_PATH);
34
37
 
38
+
35
39
  init();
36
40
  } else { // If there are URLs that haven't been processed yet, resume from the queue.
37
41
  console.log(`Resuming from ${CONFIG.CRAWLER.QUEUE_PATH} with ${urlData.length} total found URLs\n`);