seantomburke / sitemapper

parses sitemaps for Node.JS

Home Page:https://www.npmjs.com/package/sitemapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get the example code working.

landland opened this issue · comments

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

Output is

{ url: 'http://wp.seantburke.com/sitemap.xml', sites: [] }

Why is sites array empty?

Which version are you running?

Seems to be running okay on the latest version: sitemapper@v2.1.7

https://tonicdev.com/57b1f189b055491400efd073/57b1f189b055491400efd074

Try increasing the timeout from 5000 to 15000.
5000 means that if it doesn't see any results in 5 seconds, then it will return an empty array. Your connection might be slow.

ok thanks! increasing the timeout worked.