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

podcast-index-api

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

podcast-index-api - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

29

index.js

@@ -12,12 +12,9 @@ const got = require('got')

const PATH_SEARCH_BY_TERM = 'search/byterm'
const PATH_PODCASTS_BY_FEED_URL = 'podcasts/byfeedurl'
const PATH_PODCASTS_BY_FEED_ID = 'podcasts/byfeedid'
const PATH_PODCASTS_BY_ITUNES_ID = 'podcasts/byitunesid'
const PATH_ADD_BY_FEED_URL = 'add/byfeedurl'
const PATH_EPISODES_BY_FEED_ID = 'episodes/byfeedid'
const PATH_EPISODES_BY_FEED_URL = 'episodes/byfeedurl'
const PATH_EPISODES_BY_ITUNES_ID = 'episodes/byitunesid'
const PATH_PODCASTS_BY_FEED_URL = 'podcasts/byfeedurl'
const PATH_PODCASTS_BY_FEED_ID = 'podcasts/byfeedid'
const PATH_PODCASTS_BY_ITUNES_ID = 'podcasts/byitunesid'
const PATH_RECENT_FEEDS = 'recent/feeds'

@@ -27,4 +24,21 @@ const PATH_RECENT_EPISODES = 'recent/episodes'

const qs = (o) => '?' + querystring.stringify(o)
const withResponse = (response) => response.body
const withResponse = (response) => {
// Check for success or failure and create a predictable error response
let body = response.body
// if response.statusCode == 200?
if(body.hasOwnProperty('status') && body.status === 'false') {
// Failed
if(body.hasOwnProperty('description')) {
// Error message from server API
throw { message: body.description, code: response.statusCode }
} else {
throw { message: 'Request failed.', code: response.statusCode }
}
} else {
// Succcess // 200
return body
}
}
module.exports = (key, secret, userAgent) => {

@@ -40,2 +54,3 @@ if (!key || !secret) {

prefixUrl: BASE_API_URL,
throwHttpErrors: false,
hooks: {

@@ -42,0 +57,0 @@ beforeRequest: [

{
"name": "podcast-index-api",
"version": "1.1.2",
"version": "1.1.3",
"description": "JS lib for the Podcast Index API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

# Podcast Index API
# Podcast Index API Javascript library

@@ -3,0 +3,0 @@ > A Podcast Index API library for Node.js

@@ -1,2 +0,2 @@

jest.setTimeout(60000)
jest.setTimeout(10000)

@@ -15,2 +15,3 @@ const lib = require('../index.js')

const FEED_URL = 'http://joeroganexp.joerogan.libsynpro.com/rss'
const FEED_URL_NOT_FOUND = 'http://www.google.com/'
const RECENT_FEEDS_COUNT = 3

@@ -86,2 +87,11 @@ const RECENT_EPISODES_COUNT = 3

it('Podcasts By Feed URL not found', async () => {
expect.assertions(1)
try {
const results = await api.podcastsByFeedUrl(FEED_URL_NOT_FOUND)
} catch(e) {
expect(e.code).toEqual(400)
}
})
it('Podcasts By Feed ID', async () => {

@@ -88,0 +98,0 @@ expect.assertions(3)

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