JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1797
  • Score
    100M100P100Q110598F
  • License ISC

A simple package for parsing podcast RSS feeds into manageable JavaScript objects. For use with Node and in the browser.

Package Exports

  • podparse

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (podparse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm version Build Status

NPM

Table of Contents

podparse

A simple package for parsing podcast feeds into manageable JavaScript objects. For use with Node and in the browser. Based on jbierfeldt/podcast-feed-parser.

Installation

npm install podparse

See podparse on npm.

Differences from jbierfeldt/podcast-feed-parser

This package:

  • Does not contain the isomorphic-fetch dependency.
  • Is designed to be easier to use, albeit less configurable.
  • Removes empty (null, undefined, '', NaN, {}) from the output.
  • Does not use hard-coded namespace prefixes (esp. itunes, googleplay, and atom).

Overview

By default, podparse will parse a podcast's xml feed and return an object with the following properties. meta contains all of the information pertinent to the podcast show itself, and episodes is list of episode objects which contain the information pertinent to each individual episode of the podcast.

{
    meta: {
      title: 'My podcast',
      description: 'A podcast about whatever',
      // ...
    },
    episodes: [
      {
        title: 'My Episode 1',
        description: 'Episode 1',
        pubDate: '2018-11-29T10:30:00.000Z',
        // ...
      }, {
        title: 'My Episode 2',
        description: 'Episode 2',
        pubDate: '2018-11-28T10:30:00.000Z',
        // ...
      }
    ]
  }
}

Quickstart

podparse has one main functions: getPodcastFromFeed.

For parsing a podcast from an feed xml, use getPodcastFromFeed:

const getPodcastFromFeed = require("podparse")
const fs = require('fs')

const podcastFeed = fs.readFileSync('path/to/podcast-feed.xml', 'utf8')
const podcast = getPodcastFromFeed(podcastFeed)

console.log(podcast.meta.title)
// "My Podcast"

podcast.episodes.forEach( (episode) => {
    console.log(episode.title)
})
// "My Episode 1"
// "My Episode 2"

Default

By default, podparse will parse a feed for the following default fields, based on this standard. If a field is not found in a feed, it will quietly return undefined.

{
    meta: {
        title: '',
        description: '',
        subtitle: '',
        image: {
          url: '',
          title: '',
          link: '',
          width: 0,
          height: 0
        },
        lastUpdated: '',
        link: '',
        language: '',
        editor: '',
        author: '',
        summary: '',
        categories: [],
        owner: {
          name: '',
          email: ''
        },
        ttl: 0,
        explicit: true,
        complete: true,
        blocked: true
    },
    episodes: [
      {
        title: '',
        description: '',
        imageURL: '',
        pubDate: '',
        link: '',
        guid: '',
        language: '',
        enclosure: {
          length: '0',
          type: '',
          url: ''
        },
        duration: 0,
        summary: '',
        blocked: true,
        explicit: true,
        order: 1
      }
  ]
}