podcast-chapter-parser-psc

Parse psc (podlove simple chapters) format into JSON

Usage no npm install needed!

<script type="module">
  import podcastChapterParserPsc from 'https://cdn.skypack.dev/podcast-chapter-parser-psc';
</script>

README

Podcast Chapter Parser for psc

Podcast Chapter Parser for Podlove Simple Chapters.

Installation

npm install podcast-chapter-parser-psc

Example

// for node, use xmldom; in a browser, pass window.DOMParser
var DOMParser = require('xmldom').DOMParser; 
var psc = require('podcast-chapter-parser-psc').parser(DOMParser);

var chapters = psc.parse('<psc:chapters xmlns:psc="http://podlove.org/simple-chapters" version="1.2">' 
  + '<psc:chapter title="Intro" start="00:00:01.200"/>'
  + '<psc:chapter title="Say Hello" start="00:00:02.000" href="http://example.com"/>' 
  + '</psc:chapters>');
// =>
// [
//     { start: 1200, title: "Intro" },
//     { start: 2000, title: "Say Hello", href: "http://example.com" }
// ]

Development

npm install
npm test