Skip to content

Transforms Libsyn RSS feeds into plain JavaScript objects.

Notifications You must be signed in to change notification settings

sa-express-news/libsyn-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libsyn Podcast Feed Parser

This package creates JavaScript objects from RSS feeds generated by the Libsyn podcasting service with information on the podcast and a list of most recent episodes, including their descriptions and the links to the audio files.

How it works

The package exposes a getPodcast function that uses isomorphic-fetch to request the Libsyn RSS feed at the URL provided to it. It then uses xml2js to wrangle the RSS response into something a bit more manageable.

The asynchronous function returns a Podcast object:

interface Podcast {
    meta: PodcastMeta;
    episodes: PodcastEpisode[];
}

The meta property contains information about the podcast:

interface PodcastMeta {
    title: string;
    description: string;
    imageURL: string;
}

While episodes is an array of objects with information about episodes in the feed (most recent first):

interface PodcastEpisode {
    title: string;
    publicationDate: Date;
    audioFileURL: string;
    description: string;
}

Usage

Install the package from this GitHub repository:

npm install git+https://github.com/sa-express-news/libsyn-parser.git

Import the getPodcast asynchronous function wherever you need to fetch a Libsyn podcast:

import { getPodcast } from 'libsyn-feed-parser';

Pass your Libsyn RSS feed URL to the function, then wait for it to return the podcast object:

try{
    const podcast = await getPodcast('https://expressbriefing.libsyn.com/rss/');

    console.log(podcast.meta.title);
}catch(error){
    // handle error
}

// or

getPodcast('https://expressbriefing.libsyn.com/rss/')
    .then(podcast){
        console.log(podcast.meta.title);
    }
    .catch(error){
        // handle error
    }

About

Transforms Libsyn RSS feeds into plain JavaScript objects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published