diff --git a/docs/en/multimedia.md b/docs/en/multimedia.md index b08c0b8d2..7b8fbe9f6 100644 --- a/docs/en/multimedia.md +++ b/docs/en/multimedia.md @@ -525,23 +525,27 @@ Refer to [Pornhub F.A.Qs](https://help.pornhub.com/hc/en-us/articles/36004432703 ### Artist Albums - + ### Playlist - + ### Personal Saved Tracks - + ### Personal Top Tracks - + ### Personal Top Artists - + + +### Show + + ## The Movie Database diff --git a/docs/multimedia.md b/docs/multimedia.md index 5326cb8c6..90a3fecf4 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -1201,23 +1201,27 @@ JavDB 有多个备用域名,本路由默认使用永久域名 + ### 播放列表 - + ### 个人 Saved Tracks - + ### 个人 Top Tracks - + ### 个人 Top Artists - + + +### 节目 + + ## Sub HD diff --git a/lib/v2/spotify/maintainer.js b/lib/v2/spotify/maintainer.js index c83b3aad2..218925e01 100644 --- a/lib/v2/spotify/maintainer.js +++ b/lib/v2/spotify/maintainer.js @@ -2,6 +2,7 @@ module.exports = { '/artist/:id': ['outloudvi'], '/playlist/:id': ['outloudvi'], '/saved/:limit?': ['outloudvi'], + '/show/:id': ['caiohsramos'], '/top/tracks': ['outloudvi'], '/top/artists': ['outloudvi'], }; diff --git a/lib/v2/spotify/radar.js b/lib/v2/spotify/radar.js index 14b893273..eabf46d84 100644 --- a/lib/v2/spotify/radar.js +++ b/lib/v2/spotify/radar.js @@ -2,18 +2,18 @@ module.exports = { 'spotify.com': { _name: 'Spotify', open: [ - { - title: '播放列表', - docs: 'https://docs.rsshub.app/multimedia.html#spotify', - source: ['/playlist/:id'], - target: '/spotify/playlist/:id', - }, { title: '歌手专辑', docs: 'https://docs.rsshub.app/multimedia.html#spotify', source: ['/artist/:id'], target: '/spotify/artist/:id', }, + { + title: '播放列表', + docs: 'https://docs.rsshub.app/multimedia.html#spotify', + source: ['/playlist/:id'], + target: '/spotify/playlist/:id', + }, { title: '用户 Saved Tracks', docs: 'https://docs.rsshub.app/multimedia.html#spotify', @@ -21,10 +21,10 @@ module.exports = { target: '/spotify/saved', }, { - title: '用户 Top Tracks', + title: '节目', docs: 'https://docs.rsshub.app/multimedia.html#spotify', - source: ['/'], - target: '/spotify/top/tracks', + source: ['/show/:id'], + target: '/spotify/show/:id', }, { title: '用户 Top Artists', @@ -32,6 +32,12 @@ module.exports = { source: ['/'], target: '/spotify/top/artists', }, + { + title: '用户 Top Tracks', + docs: 'https://docs.rsshub.app/multimedia.html#spotify', + source: ['/'], + target: '/spotify/top/tracks', + }, ], }, }; diff --git a/lib/v2/spotify/router.js b/lib/v2/spotify/router.js index 396994e6f..fd1110af6 100644 --- a/lib/v2/spotify/router.js +++ b/lib/v2/spotify/router.js @@ -2,6 +2,7 @@ module.exports = function (router) { router.get('/artist/:id', require('./artist')); router.get('/playlist/:id', require('./playlist')); router.get('/saved/:limit?', require('./saved')); - router.get('/top/tracks', require('./top')('tracks')); + router.get('/show/:id', require('./show')); router.get('/top/artists', require('./top')('artists')); + router.get('/top/tracks', require('./top')('tracks')); }; diff --git a/lib/v2/spotify/show.js b/lib/v2/spotify/show.js new file mode 100644 index 000000000..0fa76f148 --- /dev/null +++ b/lib/v2/spotify/show.js @@ -0,0 +1,43 @@ +const utils = require('./utils'); +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const token = await utils.getPublicToken(); + const { id } = ctx.params; + + const meta = await got + .get(`https://api.spotify.com/v1/shows/${id}?market=US`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + .json(); + + const episodes = meta.episodes.items; + + ctx.state.data = { + title: meta.name, + description: meta.description, + link: meta.external_urls.spotify, + language: meta.languages[0], + itunes_author: meta.publisher, + itunes_category: meta.type, + itunes_explicit: meta.explicit, + allowEmpty: true, + item: episodes.map((x) => ({ + title: x.name, + description: x.html_description, + pubDate: parseDate(x.release_date), + link: x.external_urls.spotify, + itunes_item_image: x.images[0].url, + itunes_duration: x.duration_ms * 1000, + enclosure_url: x.audio_preview_url, + enclosure_type: 'audio/mpeg', + })), + }; + + if (meta.images.length) { + ctx.state.data.image = meta.images[0].url; + } +};