feat(route): Spotify show route (#12945)
* Add spotify show route * refactor: sort entries * docs: remove dupe field * Update lib/v2/spotify/show.js ---------
This commit is contained in:
@@ -525,23 +525,27 @@ Refer to [Pornhub F.A.Qs](https://help.pornhub.com/hc/en-us/articles/36004432703
|
||||
|
||||
### Artist Albums
|
||||
|
||||
<RouteEn author="outloudvi" example="/spotify/artist/6k9TBCxyr4bXwZ8Y21Kwn1" path="/spotify/artist/:id" :paramsDesc="['Artist ID']" />
|
||||
<RouteEn author="outloudvi" example="/spotify/artist/6k9TBCxyr4bXwZ8Y21Kwn1" path="/spotify/artist/:id" :paramsDesc="['Artist ID']" selfhost="1"/>
|
||||
|
||||
### Playlist
|
||||
|
||||
<RouteEn author="outloudvi" example="/spotify/playlist/4UBVy1LttvodwivPUuwJk2" path="/spotify/playlist/:id" :paramsDesc="['Playlist ID']" />
|
||||
<RouteEn author="outloudvi" example="/spotify/playlist/4UBVy1LttvodwivPUuwJk2" path="/spotify/playlist/:id" :paramsDesc="['Playlist ID']" selfhost="1"/>
|
||||
|
||||
### Personal Saved Tracks
|
||||
|
||||
<RouteEn author="outloudvi" example="/spotify/saved/50" path="/spotify/saved/:limit?" :paramsDesc="['Track count, 50 by default']" />
|
||||
<RouteEn author="outloudvi" example="/spotify/saved/50" path="/spotify/saved/:limit?" :paramsDesc="['Track count, 50 by default']" selfhost="1"/>
|
||||
|
||||
### Personal Top Tracks
|
||||
|
||||
<RouteEn author="outloudvi" example="/spotify/top/tracks" path="/spotify/top/tracks" />
|
||||
<RouteEn author="outloudvi" example="/spotify/top/tracks" path="/spotify/top/tracks" selfhost="1"/>
|
||||
|
||||
### Personal Top Artists
|
||||
|
||||
<RouteEn author="outloudvi" example="/spotify/top/artists" path="/spotify/top/artists" />
|
||||
<RouteEn author="outloudvi" example="/spotify/top/artists" path="/spotify/top/artists" selfhost="1"/>
|
||||
|
||||
### Show
|
||||
|
||||
<RouteEn author="caiohsramos" example="/spotify/show/38bS44xjbVVZ3No3ByF1dJ" path="/spotify/show/:id" :paramsDesc="['Show ID']" selfhost="1"/>
|
||||
|
||||
## The Movie Database
|
||||
|
||||
|
||||
+9
-5
@@ -1201,23 +1201,27 @@ JavDB 有多个备用域名,本路由默认使用永久域名 <https://javdb.c
|
||||
|
||||
### 艺术家专辑
|
||||
|
||||
<Route author="outloudvi" example="/spotify/artist/6k9TBCxyr4bXwZ8Y21Kwn1" path="/spotify/artist/:id" :paramsDesc="['艺术家 ID']" />
|
||||
<Route author="outloudvi" example="/spotify/artist/6k9TBCxyr4bXwZ8Y21Kwn1" path="/spotify/artist/:id" :paramsDesc="['艺术家 ID']" selfhost="1"/>
|
||||
|
||||
### 播放列表
|
||||
|
||||
<Route author="outloudvi" example="/spotify/playlist/4UBVy1LttvodwivPUuwJk2" path="/spotify/playlist/:id" :paramsDesc="['播放列表 ID']" />
|
||||
<Route author="outloudvi" example="/spotify/playlist/4UBVy1LttvodwivPUuwJk2" path="/spotify/playlist/:id" :paramsDesc="['播放列表 ID']" selfhost="1"/>
|
||||
|
||||
### 个人 Saved Tracks
|
||||
|
||||
<Route author="outloudvi" example="/spotify/saved/50" path="/spotify/saved/:limit?" :paramsDesc="['歌曲数量,默认为 50']" />
|
||||
<Route author="outloudvi" example="/spotify/saved/50" path="/spotify/saved/:limit?" :paramsDesc="['歌曲数量,默认为 50']" selfhost="1"/>
|
||||
|
||||
### 个人 Top Tracks
|
||||
|
||||
<Route author="outloudvi" example="/spotify/top/tracks" path="/spotify/top/tracks" />
|
||||
<Route author="outloudvi" example="/spotify/top/tracks" path="/spotify/top/tracks" selfhost="1"/>
|
||||
|
||||
### 个人 Top Artists
|
||||
|
||||
<Route author="outloudvi" example="/spotify/top/artists" path="/spotify/top/artists" />
|
||||
<Route author="outloudvi" example="/spotify/top/artists" path="/spotify/top/artists" selfhost="1"/>
|
||||
|
||||
### 节目
|
||||
|
||||
<Route author="caiohsramos" example="/spotify/show/38bS44xjbVVZ3No3ByF1dJ" path="/spotify/show/:id" :paramsDesc="['节目 ID']" selfhost="1"/>
|
||||
|
||||
## Sub HD
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ module.exports = {
|
||||
'/artist/:id': ['outloudvi'],
|
||||
'/playlist/:id': ['outloudvi'],
|
||||
'/saved/:limit?': ['outloudvi'],
|
||||
'/show/:id': ['caiohsramos'],
|
||||
'/top/tracks': ['outloudvi'],
|
||||
'/top/artists': ['outloudvi'],
|
||||
};
|
||||
|
||||
+15
-9
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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'));
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user