podcast-xml-parser
Advanced tools
Comparing version 3.0.0-beta.8 to 3.0.0-beta.9
@@ -9,2 +9,5 @@ /// <reference types="node" /> | ||
*/ | ||
export declare const podcastOpmlParser: (source: URL | string) => Promise<string[]>; | ||
export declare const podcastOpmlParser: (source: URL | string) => Promise<{ | ||
title?: string; | ||
url: string; | ||
}[]>; |
/** | ||
* Transforms parsed OPML XML data into an array of feed URLs. | ||
* Transforms parsed OPML XML data into an array of objects containing feed URLs and titles. | ||
* | ||
* @param xmlText - The OPML XML data as a string. | ||
* @returns An array of feed URLs extracted from the OPML data. | ||
* @returns An array of objects with each object containing a feed URL and an optional title. | ||
* @throws If the expected XML structure is not found. | ||
*/ | ||
export declare function transformOpml(xmlText: string): string[]; | ||
export declare function transformOpml(xmlText: string): { | ||
title?: string; | ||
url: string; | ||
}[]; |
@@ -6,6 +6,6 @@ "use strict"; | ||
/** | ||
* Transforms parsed OPML XML data into an array of feed URLs. | ||
* Transforms parsed OPML XML data into an array of objects containing feed URLs and titles. | ||
* | ||
* @param xmlText - The OPML XML data as a string. | ||
* @returns An array of feed URLs extracted from the OPML data. | ||
* @returns An array of objects with each object containing a feed URL and an optional title. | ||
* @throws If the expected XML structure is not found. | ||
@@ -37,5 +37,9 @@ */ | ||
} | ||
const feedUrls = outlines.map((outline) => outline["@_xmlUrl"]).filter((url) => !!url); | ||
return feedUrls; | ||
return outlines | ||
.filter((outline) => outline["@_xmlUrl"] !== undefined) | ||
.map((outline) => ({ | ||
title: outline["@_text"], | ||
url: outline["@_xmlUrl"], | ||
})); | ||
} | ||
exports.transformOpml = transformOpml; |
{ | ||
"name": "podcast-xml-parser", | ||
"version": "3.0.0-beta.8", | ||
"version": "3.0.0-beta.9", | ||
"description": "🎙 Parse podcast feeds in browsers, React Native, or Node.js environments.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -85,3 +85,3 @@ <!-- HIDE_SECTION_START --> | ||
**Purpose**: Parses an OPML outline to extract podcast feed URLs. | ||
**Purpose**: Parses an OPML outline to extract podcast feed URLs and optional titles. | ||
@@ -93,3 +93,3 @@ **Parameters**: | ||
**Returns**: | ||
A promise that resolves with an array of feed URLs extracted from the OPML outline. | ||
A promise that resolves with an array of objects, each containing a feed URL and an optional title extracted from the OPML outline. | ||
@@ -99,3 +99,3 @@ **Signature**: | ||
```typescript | ||
podcastOpmlParser(source: URL | string): Promise<string[]> | ||
podcastOpmlParser(source: URL | string): Promise<{ title?: string; url: string }[]> | ||
``` | ||
@@ -102,0 +102,0 @@ |
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
50103
838