From 5c7be0f09eaecd0d0803303a01a9824c5459242d Mon Sep 17 00:00:00 2001 From: Illia Antypenko Date: Fri, 3 Jul 2026 10:00:41 +0200 Subject: [PATCH] Fix grammar and formatting issues in README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix typos: "Thease"→"These", "coppied"→"copied", "occured"→"occurred" - Fix broken grammar in note and onResourceError description - Add missing space in "Parameters-" labels - Align mixed tab/space indentation in afterResponse example - Use ESM import instead of require in generateFilename example (package is pure ESM) Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9a01a5a3..d4b89c99 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Download the website to the local directory (including all css, images, js, etc.) -**Note:** by default dynamic websites (where content is loaded by js) may be saved not correctly because `website-scraper` doesn't execute js, it only parses http responses for html and css files. If you need to download a dynamic website take a look at [website-scraper-puppeteer](https://github.com/website-scraper/website-scraper-puppeteer). +**Note:** by default dynamic websites (where content is loaded by js) may not be saved correctly because `website-scraper` doesn't execute js, it only parses http responses for html and css files. If you need to download a dynamic website take a look at [website-scraper-puppeteer](https://github.com/website-scraper/website-scraper-puppeteer). ## Sponsors Maintenance of this project is made possible by all the [contributors](https://github.com/website-scraper/node-website-scraper/graphs/contributors) and [sponsors](https://github.com/sponsors/s0ph1e). @@ -221,7 +221,7 @@ Plugins allow to extend scraper behaviour * [getReference](#getreference) ##### Built-in plugins -Scraper has built-in plugins which are used by default if not overwritten with custom plugins. You can find them in [lib/plugins](lib/plugins) directory. Thease plugins are intended for internal use but can be coppied if the behaviour of the plugins needs to be extended / changed. +Scraper has built-in plugins which are used by default if not overwritten with custom plugins. You can find them in [lib/plugins](lib/plugins) directory. These plugins are intended for internal use but can be copied if the behaviour of the plugins needs to be extended / changed. ##### Existing plugins * [website-scraper-puppeteer](https://github.com/website-scraper/website-scraper-puppeteer) - download dynamic (rendered with js) websites using puppeteer @@ -231,7 +231,7 @@ Scraper has built-in plugins which are used by default if not overwritten with c Plugin is object with `.apply` method, can be used to change scraper behavior. -`.apply` method takes one argument - `registerAction` function which allows to add handlers for different actions. Action handlers are functions that are called by scraper on different stages of downloading website. For example `generateFilename` is called to generate filename for resource based on its url, `onResourceError` is called when error occured during requesting/handling/saving resource. +`.apply` method takes one argument - `registerAction` function which allows to add handlers for different actions. Action handlers are functions that are called by scraper on different stages of downloading website. For example `generateFilename` is called to generate filename for resource based on its url, `onResourceError` is called when error occurred during requesting/handling/saving resource. You can add multiple plugins which register multiple actions. Plugins will be applied in order they were added to options. All actions should be regular or async functions. Scraper will call actions of specific type in order they were added and use result (if supported by action type) from last action call. @@ -336,7 +336,7 @@ registerAction('afterResponse', ({response}) => { } else { return { body: response.body, - encoding: 'utf8', + encoding: 'utf8', metadata: { headers: response.headers, someOtherData: [ 1, 2, 3 ] @@ -349,7 +349,7 @@ registerAction('afterResponse', ({response}) => { ##### onResourceSaved Action onResourceSaved is called each time after a resource is saved (to file system or other storage with 'saveResource' action). -Parameters- object which includes: +Parameters - object which includes: * resource - [Resource](https://github.com/website-scraper/node-website-scraper/blob/master/lib/resource.js) object Scraper ignores the result returned from this action and does not wait until it is resolved @@ -358,9 +358,9 @@ registerAction('onResourceSaved', ({resource}) => console.log(`Resource ${resour ``` ##### onResourceError -Action onResourceError is called each time when resource's downloading/handling/saving to was failed +Action onResourceError is called each time a resource's downloading/handling/saving fails -Parameters- object which includes: +Parameters - object which includes: * resource - [Resource](https://github.com/website-scraper/node-website-scraper/blob/master/lib/resource.js) object * error - Error object @@ -384,7 +384,7 @@ If multiple actions `generateFilename` added - scraper will use result from last Default plugins which generate filenames: [byType](https://github.com/website-scraper/node-website-scraper/blob/master/lib/plugins/generate-filenamy-by-type-plugin.js), [bySiteStructure](https://github.com/website-scraper/node-website-scraper/blob/master/lib/plugins/generate-filenamy-by-site-structure-plugin.js) ```javascript // Generate random filename -const crypto = require('crypto'); +import crypto from 'crypto'; registerAction('generateFilename', ({resource}) => { return {filename: crypto.randomBytes(20).toString('hex')}; });