Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@activediscourse/podcast-parser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@activediscourse/podcast-parser

Parse XML podcast feeds into objects

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

podcast-parser

Parse XML podcast RSS feeds into standardized objects.

installation

yarn add @activediscourse/podcast-parser

usage

Pass a string containing XML source:

const parsePodcast = require("@activediscourse/podcast-parser")

parsePodcast("<podcast xml>")
  .then(feed => console.log(feed))
  .catch(e => console.error(e))

This library only handles parsing, so you'll need to fetch the feed separately first. For example, using node-fetch (or fetch in the browser):

const fetch = require("node-fetch")
const parsePodcast = require("@activediscourse/podcast-parser")

;(async () => {
  const response = await fetch("https://pinecast.com/feed/activediscourse")
  const xml = await response.text()
  const feed = await parsePodcast(xml)

  return feed
})()
  .then(feed => console.log(feed))
  .catch(e => console.error(e))

output format

The output is opinionated with the goal of normalizing results across feeds:

{
  "title": "<Podcast title>",
  "description": {
    "short": "<Podcast subtitle>",
    "long": "<Podcast description>"
  },
  "link": "<Podcast link (usually website for podcast)>",
  "image": "<Podcast image>",
  "language": "<ISO 639 language>",
  "copyright": "<Podcast copyright>",
  "updated": "<pubDate or latest episode pubDate>",
  "explicit": "<Podcast is explicit, true/false>",
  "categories": [
    "Category>Subcategory"
  ],
  "author": "<Author name>",
  "owner": {
    "name":  "<Owner name>",
    "email": "<Owner email>"
  },
  "episodes": [
    {
      "guid": "<Unique id>",
      "title": "<Episode title>",
      "subtitle": "<Episode subtitle>",
      "description": "<Episode description>",
      "rawDescription": "<Episode description stripped of HTML tags>",
      "explicit": "<Episode is is explicit, true/false>",
      "image": "<Episode image>",
      "published": "<date>",
      "duration": 120,
      "categories": [
        "Category"
      ],
      "enclosure": {
        "filesize": 5650889,
        "type": "audio/mpeg",
        "url": "<mp3 file>"
      }
    }
  ]
}

notes

language

Many podcasts have the language set something like en. A best effort attempt is made to normalize language strings to an IETF language code, so for example en will be converted to en-us. Non-English languages will be presented for example as de-DE.

normalization

Not all feeds can be guaranteed to contain all properties, so they are simply ommited from the output in that case.

Episode categories are included as an empty array if the podcast isn't assigned any categories.

Episodes are sorted in descending order by publish date.

development

  1. Clone the repo: git clone https://github.com/activediscourse/podcast-parser.git
  2. Move into the new directory: cd podcast-parser
  3. Install dependencies: yarn
  4. Build the source: yarn build
  5. Run tests: yarn test

license

MIT © Bo Lingen / citycide

Based on node-podcast-parser, also MIT, © Antti Kupila.

See license

Keywords

FAQs

Package last updated on 02 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc