Skip to content
parses sitemaps for Node.JS
JavaScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Generating new lib file Jun 5, 2017
src Detecting if data.urlset.url exists before .map() (#21) Feb 14, 2017
.eslintignore Large refactor that implements es6 and promises Aug 8, 2016
.eslintrc Large refactor that implements es6 and promises Aug 8, 2016
.gitignore adding lib Aug 20, 2016
.travis.yml Update .travis.yml Aug 20, 2016
Brocfile.js adding reverse compatibility Aug 12, 2016
CONTRIBUTING.md precompiling library Aug 20, 2016
LICENSE
README.md Fix example in README (#31) May 24, 2019
docs.md removing docs command Aug 8, 2016
example.es6 changing .getSites() to .fetch() Aug 8, 2016
example.js adding reverse compatibility Aug 12, 2016
package.json Move broccoli to dev dependencies (#28) Oct 22, 2018
sitemapper.d.ts Add Typescript types (#29) Oct 22, 2018

README.md

Sitemap-parser

Build Status Monthly Downloads npm version dependencies Status Inline docs

Parse through a sitemaps xml to get all the urls for your crawler.

Version 2

Installation

npm install sitemapper --save

Simple Example

var Sitemapper = require('sitemapper');

var sitemap = new Sitemapper();

sitemap.fetch('http://wp.seantburke.com/sitemap.xml').then(function(sites) {
  console.log(sites);
});

Examples in ES5

var Sitemapper = require('sitemapper');

var Google = new Sitemapper({
  url: 'https://www.google.com/work/sitemap.xml',
  timeout: 15000 //15 seconds
});

Google.fetch()
  .then(function (data) {
    console.log(data);
  })
  .catch(function (error) {
    console.log(error);
  });


// or


var sitemapper = new Sitemapper();

sitemapper.timeout = 5000;
sitemapper.fetch('http://wp.seantburke.com/sitemap.xml')
  .then(function (data) {
    console.log(data);
  })
  .catch(function (error) {
    console.log(error);
  });

Examples in ES6

import Sitemapper from '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));


// or


const sitemapper = new Sitemapper();
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));

Version 1

npm install sitemapper@1.1.1 --save

Simple Example

var Sitemapper = require('sitemapper');

var sitemapper = new Sitemapper();

sitemapper.getSites('http://wp.seantburke.com/sitemap.xml', function(err, sites) {
    if (!err) {
     console.log(sites);
    }
});
You can’t perform that action at this time.