diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-10-19 17:54:18 +0200 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-10-19 18:21:58 +0200 |
| commit | 0daefa86b400efe08245f4f2a386f7341b76b24e (patch) | |
| tree | 60d743bb9734a9d7f46701a5ac9026650a330d49 /docs/configuration/url-filter.md | |
| parent | 03b3be0c3bbc70584e8988e1810dc28eacf4521f (diff) | |
docs: Add documentationv0.3.0
Diffstat (limited to 'docs/configuration/url-filter.md')
| -rw-r--r-- | docs/configuration/url-filter.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/configuration/url-filter.md b/docs/configuration/url-filter.md new file mode 100644 index 0000000..e2feda8 --- /dev/null +++ b/docs/configuration/url-filter.md @@ -0,0 +1,42 @@ +# URL Filter + +The `allowedURLs` and `blockedURLs` config options allow you to specify a list of URL patterns (in form of regular expressions) which are accessible or blocked during scraping. + +```javascript +export const options = { + url: "http://example.com/", + allowedURLs: ["/articles/.*", "/authors/.*"], + blockedURLs: ["/authors/admin"], + // ... +}; +``` + +### `allowedURLs` + +This config option controls which URLs are allowed to be visted during scraping. When no value is provided all URLs are allowed to be visited if not otherwise blocked. + +When a list of URL patterns is provided, only URLs matching one or more of these patterns are allowed to be visted. + +Example: + +```javascript +export const options = { + url: "http://example.com/", + allowedURLs: ["/products/"], +}; +``` + +### `blockedURLs` + +This config option controls which URLs are blocked from being visted during scraping. + +When a list of URL patterns is provided, URLs matching one or more of these patterns are blocked from to be visted. + +Example: + +```javascript +export const options = { + url: "http://example.com/", + blockedURLs: ["/restricted"], +}; +``` |