scraply 1.0.9 → 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.
- package/package.json +1 -1
- package/readme.md +1 -0
- package/src/scraply.js +5 -1
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Scraply is a customizable and efficient web crawler and data scraper for Node.js, designed to handle various web crawling needs with ease. You can define the URLs to crawl, configure patterns to include/exclude, and format the output data in JSON. Scraply is built to be flexible, with user-configurable settings and dynamic paths.
|
|
3
3
|
|
|
4
4
|
Bug Reports & Dev Stuff on: [Scraply's GitHub](https://github.com/pauserratgutierrez/scraply)
|
|
5
|
+
NPM Package: [Scraply's NPM](https://www.npmjs.com/package/scraply)
|
|
5
6
|
|
|
6
7
|
## Installation
|
|
7
8
|
Using npm:
|
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.
|
|
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`);
|