Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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))
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));
var sitePath = options.sitePath;
grunt.log.writeln('Prerendering ...');
var snapshotOptions = {
phantomScript: options.phantomScript,
timeout: options.timeout,
selector: options.selector,
interval: options.interval
};
if (options.sitemap) {
var urlObj = require('url').parse(options.sitemap);
sitePath = urlObj.protocol + '//' + urlObj.host;
require('sitemapper').getSites(options.sitemap, function(err, urls) {
if (err) {
var urls = options.urls;
}
urls = urls.map(function(url) {
return require('url').parse(url).pathname;
});
crawlUrls(urls);
});
} else {
// strip site path of trailing slash
if (sitePath[sitePath.length-1] === '/') sitePath = sitePath.slice(0, -1);
var urls = options.urls;
crawlUrls(urls);
}