Skip to content

Commit 208cffb

Browse files
committed
Update README.md
1 parent 34a4370 commit 208cffb

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Node.js module for website's scraping with images, css, js, etc.
1616
```javascript
1717
var scraper = require('website-scraper');
1818
var options = {
19-
url: 'http://nodejs.org/',
19+
urls: 'http://nodejs.org/',
2020
directory: '/path/to/save/',
2121
};
2222

@@ -33,16 +33,15 @@ scraper.scrape(options).then(function (result) {
3333

3434
##API
3535
### scrape(options, callback)
36-
Makes request to `url` and saves all files found with `srcToLoad` to `directory`.
36+
Makes request to `url` and saves all files found with `sources` to `directory`.
3737

3838
**options** - object containing next options:
3939

40-
- `url:` url to load *(required)*
40+
- `urls:` array of urls to load and filenames for them *(required, see example below)*
4141
- `directory:` path to save loaded files *(required)*
42-
- `paths:` array of objects, contains urls or relative paths to load and filenames for them (if is not set only `url` will be loaded) *(optional, see example below)*
4342
- `log:` boolean indicates whether to write the log to console *(optional, default: false)*
44-
- `indexFile:` filename for index page *(optional, default: 'index.html')*
45-
- `srcToLoad:` array of objects to load, specifies selectors and attribute values to select files for loading *(optional, see default value in `lib/defaults.js`)*
43+
- `defaultFilename:` filename for index page *(optional, default: 'index.html')*
44+
- `sources:` array of objects to load, specifies selectors and attribute values to select files for loading *(optional, see default value in `lib/defaults.js`)*
4645
- `subdirectories:` array of objects, specifies subdirectories for extensions. If `null` all files will be saved to `directory` *(optional, see example below)*
4746

4847

@@ -69,19 +68,18 @@ and separate files into directories:
6968

7069
```javascript
7170
scraper.scrape({
72-
url: 'http://nodejs.org/',
73-
directory: '/path/to/save',
74-
paths: [
75-
{path: '/', filename: 'index.html'},
76-
{path: '/about', filename: 'about.html'},
71+
urls: [
72+
'http://nodejs.org/', // Will be saved with default filename 'index.html'
73+
{url: 'http://nodejs.org/about', filename: 'about.html'},
7774
{url: 'http://blog.nodejs.org/', filename: 'blog.html'}
7875
],
76+
directory: '/path/to/save',
7977
subdirectories: [
8078
{directory: 'img', extensions: ['.jpg', '.png', '.svg']},
8179
{directory: 'js', extensions: ['.js']},
8280
{directory: 'css', extensions: ['.css']}
8381
],
84-
srcToLoad: [
82+
sources: [
8583
{selector: 'img', attr: 'src'},
8684
{selector: 'link[rel="stylesheet"]', attr: 'href'},
8785
{selector: 'script', attr: 'src'}

0 commit comments

Comments
 (0)