Giter Site home page Giter Site logo

podbean.js's Introduction

Podbean.js

A friendly NodeJS wrapper for the Podbean API

Note This API wrapper is built with client credentials authorization in mind. If you need client side auth, or something else, this is probably not the library for you.

Installation

I use yarn.

yarn add podbean.js

Usage

Here's A quick example to demonstrate what this library can do at the time of writing. You can copy this into a file named testbed.ts at the root of this repo, which is ignored because I'm too lazy to use an env file, and run yarn testbed to try it out.

import PodbeanAPI from "podbean.js";

const CLIENT_ID = 'yourClientId'
const CLIENT_SECRET = 'yourClientSecret';

const podbean = new PodbeanAPI({ clientId: CLIENT_ID, clientSecret: CLIENT_SECRET });

// log in
await podbean.login()

// grab basic podcast details
const podcast = await podbean.podcast();
console.log(`${podcast.title} (Status: ${podcast.status}) [ID: ${podcast.id}]`)
console.log(podcast.description);

// fetch and list episodes
const [episodes, count, hasMore] = await podbean.fetchEpisodes();
console.log(`\nDone fetching episodes. Total Fetched: ${count}\n`);
episodes.forEach((it, idx) => {
  console.log(`${it.episodeNumber} - ${it.title} (Status: ${it.status}) [ID: ${it.id}]`);
  console.log(`\tCreated: ${it.publishTime}`);
  console.log(`\t${it.duration ? `Duration: ${new Date(1000 * it.duration).toISOString().substr(11, 8)}` : 'Duration: 00:00:00 (No file)'}`);
  if (idx + 1 !== episodes.length) console.log(''); // spacer
});

console.log(
  hasMore 
    ? '\nThere are more episodes available'
    : '\nThere are no more episodes available'
);

License

This project is governed under the permissive MIT License.

podbean.js's People

Contributors

lizainslie avatar

Stargazers

Nick McCurdy avatar Emaline avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.