Sitemap Parser
Copyright (c) 2020 Sean Thomas Burke Licensed under the MIT license.
Meta
- author: Sean Burke <@seantomburke>
An array of urls
[
'www.google.com',
'https://www.linkedin.com'
]
Resolve handler type for the promise in this.parse()
Type: Object
url
string the original url used to query the datasites
SitesArray
{
url: 'https://linkedin.com/sitemap.xml',
sites: [
'https://linkedin.com/project1',
'https://linkedin.com/project2'
]
}
Resolve handler type for the promise in this.parse()
Type: Object
{
error: "There was an error!"
data: {
url: 'https://linkedin.com',
urlset: [{
url: 'https://www.linkedin.com/project1'
},[{
url: 'https://www.linkedin.com/project2'
}]
}
}
Timeout in milliseconds
Type: Number
Callback for the getSites method
Type: Function
Type: Object
Gets the sites from a sitemap.xml with a given URL
url
string? the Sitemaps url (e.g https://wp.seantburke.com/sitemap.xml) (optional, defaultthis.url
)
sitemapper.fetch('example.xml')
.then((sites) => console.log(sites));
/** Gets the sites from a sitemap.xml with a given URL
Type: Function
url
string url to query (optional, defaultthis.url
)callback
getSitesCallback callback for sites and error
Meta
- deprecated: This is deprecated.
Get the timeout
console.log(sitemapper.timeout);
Returns Timeout
Set the timeout
duration
Timeout
sitemapper.timeout = 15000; // 15 seconds
url
string url for making requests. Should be a link to a sitemaps.xml
sitemapper.url = 'https://wp.seantburke.com/sitemap.xml'
Get the url to parse
console.log(sitemapper.url)
Returns string