https://github.com/lizainslie/podbean.js
A friendly node wrapper for Podbean
https://github.com/lizainslie/podbean.js
podbean podbean-apis
Last synced: 8 months ago
JSON representation
A friendly node wrapper for Podbean
- Host: GitHub
- URL: https://github.com/lizainslie/podbean.js
- Owner: LizAinslie
- License: mit
- Created: 2023-10-04T23:59:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-08T05:52:58.000Z (about 2 years ago)
- Last Synced: 2024-12-27T20:33:53.294Z (10 months ago)
- Topics: podbean, podbean-apis
- Language: TypeScript
- Homepage:
- Size: 32.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```sh
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.```ts
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](LICENSE).