sitemapper
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -33,3 +33,3 @@ /* | ||
}); | ||
} | ||
}; | ||
@@ -39,2 +39,4 @@ sitemap.getSites = function(url, callback){ | ||
var d,s,error,sites = []; | ||
var sUrlSize = 1; | ||
var parseCnt = 0; | ||
this.parse(url, function read(err, data){ | ||
@@ -47,11 +49,16 @@ if(!err) | ||
sites = _.flatten(sites); | ||
callback(error,sites); | ||
parseCnt++; | ||
if (parseCnt === sUrlSize) { | ||
callback(error, sites); | ||
} | ||
} | ||
else if(s = data.sitemapindex) | ||
{ | ||
_.each(_.flatten(_.pluck(s.sitemap, "loc")), function(url){ | ||
var sitemapUrls = _.flatten(_.pluck(s.sitemap, "loc")); | ||
sUrlSize = _.size(sitemapUrls); | ||
//console.log(sitemapUrls); | ||
_.each(sitemapUrls, function(url){ | ||
self.parse(url, read); | ||
}) | ||
} | ||
else{ | ||
}); | ||
}else{ | ||
error = "no valid xml"; | ||
@@ -64,2 +71,2 @@ } | ||
}); | ||
} | ||
}; |
{ | ||
"name": "sitemapper", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Parser for XML Sitemaps to be used with Robots.txt and web crawlers", | ||
@@ -15,2 +15,3 @@ "keywords": [ | ||
"homepage": "http://github.com/hawaiianchimp/sitemap-parser", | ||
"tonicExampleFilename": "example.js", | ||
"bugs": { | ||
@@ -17,0 +18,0 @@ "url": "http://github.com/hawaiianchimp/sitemap-parser/issues" |
@@ -6,9 +6,13 @@ ##Sitemap-parser | ||
####Simple Implementation | ||
```javascript | ||
var sitemap = require('sitemapper'); | ||
var sitemap = require("sitemap-parser"); | ||
sitemap.getSites("http://www.cbs.com/sitemaps/show/show_siteMap_index.xml", function(err, sites){ | ||
if(!err)console.log(sites); | ||
else console.log(error); | ||
}); | ||
sitemap.getSites('http://www.cbs.com/sitemaps/show/show_siteMap_index.xml', function(err, sites) { | ||
if(!err) { | ||
console.log(sites); | ||
} | ||
else { | ||
console.log(err); | ||
} | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4071
4
62
18