forked from seantomburke/sitemapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.es6
26 lines (19 loc) · 787 Bytes
/
example.es6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import Sitemapper from 'sitemapper';
const sitemapper = new Sitemapper();
const Google = new Sitemapper({
url: 'https://www.google.com/work/sitemap.xml',
timeout: 15000, // 15 seconds
});
Google.fetch()
.then(data => console.log(data.sites))
.catch(error => console.log(error));
sitemapper.timeout = 5000;
sitemapper.fetch('http://wp.seantburke.com/sitemap.xml')
.then(({ url, sites }) => console.log(`url:${url}`, 'sites:', sites))
.catch(error => console.log(error));
sitemapper.fetch('http://www.cnn.com/sitemaps/sitemap-index.xml')
.then(data => console.log(data))
.catch(error => console.log(error));
sitemapper.fetch('http://www.stubhub.com/new-sitemap/us/sitemap-US-en-index.xml')
.then((data) => console.log(data))
.catch(error => console.log(error));