# xml-urls

> Extract all URLs from Feed, Atom, RSS, and Sitemap XML markup for crawling and auditing.

Latest version **2.2.2** (published 2026-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install xml-urls
pnpm add xml-urls
yarn add xml-urls
bun add xml-urls
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 2.2.2 |
| Published | 2026-10-15 |
| First published | 2018-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6 |
| Dependencies | 4 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Kiko Beats |
| Maintainers | kikobeats |
| Keywords | atom, crawl, extract, feed, parser, rss, sitemap, url, urls, xml |

## Links

- npm: https://www.npmjs.com/package/xml-urls
- Repository: https://github.com/Kikobeats/xml-urls
- Issues: https://github.com/Kikobeats/xml-urls/issues
- npm.io page: https://npm.io/package/xml-urls

## Dependencies (4)

- [cheerio](https://npm.io/package/cheerio.md) ~1.2.0
- [matcher](https://npm.io/package/matcher.md) ~7.0.0
- [html-get](https://npm.io/package/html-get.md) ~2.27.1
- [@metascraper/helpers](https://npm.io/package/@metascraper/helpers.md) 5

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.2.2 (latest) — 2026-10-15
- 2.2.1 — 2026-09-30
- 2.2.0 — 2026-09-10
- 2.1.85 — 2026-09-10
- 2.1.84 — 2026-09-09
- 2.1.83 — 2026-08-26
- 2.1.82 — 2026-08-21
- 2.1.81 — 2026-08-13
- 2.1.80 — 2026-08-11
- 2.1.79 — 2026-08-03
- 2.1.78 — 2026-08-03
- 2.1.77 — 2026-07-30
- 2.1.76 — 2026-07-15
- 2.1.75 — 2026-07-06
- 2.1.74 — 2026-07-03
- … 78 more at https://npm.io/package/xml-urls/versions

## README

# xml-urls

[![Last version](https://img.shields.io/github/v/tag/Kikobeats/xml-urls?style=flat-square)](https://github.com/Kikobeats/xml-urls/releases)
[![Coverage Status](https://img.shields.io/coverallsCoverage/github/Kikobeats/xml-urls?style=flat-square)](https://coveralls.io/github/Kikobeats/xml-urls)
[![NPM Status](https://img.shields.io/npm/dm/xml-urls?style=flat-square)](https://www.npmjs.com/package/xml-urls)

> Get all URLs detected inside a Feed/Atom/RSS/Sitemap xml markup.

## Install

```bash
$ npm install xml-urls --save
```

## Usage

```js
const xmlUrls = require('xml-urls')

;(async () => {
  const url = process.argv[2]
  if (!url) throw new TypeError('Need to provide an url as first argument.')
  const urls = await xmlUrls(url)

  urls.forEach(url => console.log(url))

  // => [
  //  'http://www.sitemappro.com/',
  //  'http://www.sitemappro.com/download.html',
  //  'http://www.sitemappro.com/register.html',
  //  'http://www.sitemappro.com/examples.html',
  //  'http://www.sitemappro.com/company.html',
  //  'http://www.sitemappro.com/contact.html',
  //  ...
  // ]
})()
```

By default, URLs are loaded with [`html-get`](https://github.com/Kikobeats/html-get). Nested sitemap indexes are walked until every page `loc` is collected.

Pass markup when you already have the first document; nested `.xml` locs are still fetched:

```js
const urls = await xmlUrls(xml, { url: 'https://example.com/sitemap.xml' })
```

In a [Microlink Function](https://microlink.io/docs/api/parameters/function), pass a `fetcher` so the isolate HTTP client is used instead of `html-get`:

```js
const maps = require('robots-parser')(robotsUrl, body).getSitemaps()
return require('xml-urls')(maps, { fetcher: fetch })
```

See more at [examples](/examples).

## API

### xmlUrls(input, [options])

#### input

*Required*<br>
Type: `string` | `string[]`

A sitemap/feed URL, XML/HTML markup (a string that starts with `<`), or a list of them.

#### options

Type: `object`

When `input` is a URL and no `fetcher` is set, extra options are forwarded to [`html-get`](https://github.com/Kikobeats/html-get#options).

##### fetcher

Type: `function`<br>
Default: [`html-get`](https://github.com/Kikobeats/html-get)

`(url, opts) => string | { html } | Response | Promise<…>`. Return XML/HTML text, an `html-get` result, or a Fetch [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) (gzip is decoded).

##### html

Type: `string`

Parse this markup instead of fetching `input`. Nested `.xml` locs are still fetched. Use it with a URL `input` (or `options.url`) so relative locs resolve correctly.

##### url

Type: `string`

Base URL when `input` is markup.

##### whitelist

Type: `array`<br>
Default: `[]`

A list of links to be excluded from the final output. It supports regex patterns.

See [matcher](https://github.com/sindresorhus/matcher#matcher-= for know more.

## Related

- [html-urls](https://github.com/Kikobeats/html-urls) – Get all urls from a HTML markup.
- [css-urls](https://github.com/Kikobeats/css-urls) – Get all URLs referenced from stylesheet files.

## License

**xml-urls** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/xml-urls/blob/master/LICENSE.md) License.<br>
Authored and maintained by Kiko Beats with help from [contributors](https://github.com/Kikobeats/xml-urls/contributors).

> [kikobeats.com](https://kikobeats.com) · GitHub [@Kiko Beats](https://github.com/Kikobeats) · X [@Kikobeats](https://x.com/Kikobeats)

---
_Source: https://npm.io/package/xml-urls · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
