Nondeterministic Palindrome Machine
Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

sitemapper

3.0.5 • Public • Published

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

const Sitemapper = require('sitemapper');
 
const sitemap = new Sitemapper();
 
sitemap.fetch('http://wp.seantburke.com/sitemap.xml').then(function(sites) {
  console.log(sites);
});
 

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));

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);
  });
 

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);
    }
});

Install

npm i sitemapper

DownloadsWeekly Downloads

1,975

Version

3.0.5

License

MIT

Unpacked Size

57.1 kB

Total Files

14

Last publish

Collaborators

  • avatar