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',
'www.linkedin.com'
]Resolve handler type for the promise in this.parse()
Type: Object
urlstring the original url used to query the datasitesSitesArray
{
url: 'linkedin.com/sitemap.xml',
sites: [
'linkedin.com/project1',
'linkedin.com/project2'
]
}Resolve handler type for the promise in this.parse()
Type: Object
{
error: "There was an error!"
data: {
url: 'linkedin.com',
urlset: [{
url: 'www.linkedin.com/project1'
},[{
url: '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
urlstring? the Sitemaps url (e.g http://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
urlstring url to query (optional, defaultthis.url)callbackgetSitesCallback callback for sites and error
Meta
- deprecated: This is deprecated.
Get the timeout
console.log(sitemapper.timeout);Returns Timeout
Set the timeout
durationTimeout
sitemapper.timeout = 15000; // 15 secondsurlstring url for making requests. Should be a link to a sitemaps.xml
sitemapper.url = 'http://wp.seantburke.com/sitemap.xml'Get the url to parse
console.log(sitemapper.url)Returns string