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

Support for gzipped urls?

lubo-sema opened this issue · comments

Hi Sean,

I am trying to use the sitemapper with this site:

https://www.imot.bg/sitemap/index.xml

And as you can see the urls inside are .gz ipped.

Can we extend sitemapper to understand these and extract the contents.

I tried adding this:

var body = response.body;
if (response.headers['content-encoding'] && response.headers['content-encoding'].toLowerCase().indexOf('gzip') > -1) {
body = zlib.gunzipSync(body);
}

      return xmlParse(body);

to the parse() method.

But I do not know how to build the packages so I can get a node.js supported output file. I have no idea how to produce the package file. Can you help me with this? I want to make it work.

Kind Regards,
Lyubomir

+1 for this feature.

A big thank you to @jasonaibrahim, this has been added with #73 and is released in version sitemapper@3.1.12