sitemap-links
Advanced tools
Comparing version 1.0.1 to 1.0.2
12
index.js
@@ -12,2 +12,3 @@ const fetch = require('node-fetch'); | ||
if (urlset) | ||
// Sitemap contains URLs directly, return them | ||
return urlset.url.loc | ||
@@ -17,3 +18,10 @@ ? urlset.url.loc // Only single URL in sitemap | ||
// Sitemap contains URLs to other sitemap(s), download them resursively | ||
if (sitemapindex) { | ||
// Contains only a single sitemap | ||
if (sitemapindex.sitemap.loc) | ||
return Promise.all([ | ||
fetch_sitemap(sitemapindex.sitemap.loc), | ||
]); | ||
// Recursively fetch all sitemaps inside current sitemap and fetch links | ||
@@ -31,3 +39,3 @@ // Using Promise.all() for running in parallel | ||
}) | ||
.catch(e => console.log(e.message)); | ||
.catch(e => console.log(e)); | ||
@@ -46,3 +54,3 @@ const get_sitemap_links = async (url, timeout) => { | ||
} catch (e) { | ||
throw new Error('Unable to fetch sitemap.', e.message); | ||
throw new Error('Unable to fetch sitemap.', e); | ||
} | ||
@@ -49,0 +57,0 @@ }; |
{ | ||
"name": "sitemap-links", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
3722
74