feat(route): 163 music artist songs (#11909)
This commit is contained in:
parent
a069add936
commit
0b33eb37b6
|
|
@ -1644,7 +1644,11 @@ JavDB 有多个备用域名,本路由默认使用永久域名 <https://javdb.c
|
|||
|
||||
### 歌手专辑
|
||||
|
||||
<Route author="metowolf" example="/163/music/artist/2116" path="/163/music/artist/:id" :paramsDesc="[' 歌手 id, 可在歌手详情页 URL 中找到']" radar="1" />
|
||||
<Route author="metowolf" example="/163/music/artist/2116" path="/163/music/artist/:id" :paramsDesc="['歌手 id, 可在歌手详情页 URL 中找到']" radar="1" />
|
||||
|
||||
### 歌手歌曲
|
||||
|
||||
<Route author="ZhongMingKun" example="/163/music/artist/songs/2116" path="/163/music/artist/songs/:id" :paramsDesc="['歌手 id, 可在歌手详情页 URL 中找到']" radar="1" />
|
||||
|
||||
### 电台节目
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module.exports = {
|
|||
'/dy2/:id': ['mjysci'],
|
||||
|
||||
'/music/artist/:id': ['metowolf'],
|
||||
'/music/artist/songs/:id': ['ZhongMingKun'],
|
||||
'/music/djradio/:id': ['magic-akari'],
|
||||
'/music/playlist/:id': ['DIYgod'],
|
||||
'/music/user/events/:id': ['Master-Hash'],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const { data } = await got(`https://music.163.com/api/v1/artist/songs`, {
|
||||
headers: {
|
||||
Referer: 'https://music.163.com/',
|
||||
},
|
||||
searchParams: {
|
||||
id,
|
||||
private_cloud: 'true',
|
||||
work_type: 1,
|
||||
order: 'time',
|
||||
offset: 0,
|
||||
limit: 100,
|
||||
},
|
||||
});
|
||||
|
||||
const artist = data.songs.find(({ ar }) => ar[0].id === parseInt(id)).ar[0];
|
||||
const items = data.songs.map((song) => ({
|
||||
title: `${song.name} - ${song.ar.map(({ name }) => name).join(' / ')}`,
|
||||
description: art(path.join(__dirname, '../templates/music/playlist.art'), {
|
||||
singer: song.ar.map(({ name }) => name).join(' / '),
|
||||
album: song.al.name,
|
||||
picUrl: song.al.picUrl,
|
||||
}),
|
||||
link: `https://music.163.com/#/song?id=${song.id}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${artist.name} - 歌手歌曲`,
|
||||
link: `https://music.163.com/#/artist?id=${id}`,
|
||||
description: `网易云音乐 - 歌手歌曲 - ${artist.name}`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -63,6 +63,15 @@ module.exports = {
|
|||
return id ? `/163/music/artist/${id}` : '';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '云音乐 - 歌手歌曲',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue',
|
||||
source: '/',
|
||||
target: (_params, url) => {
|
||||
const id = new URL(url).hash.match(/artist\?id=(.*)/)[1];
|
||||
return id ? `/163/music/artist/songs/${id}` : '';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '云音乐 - 电台节目',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue',
|
||||
|
|
@ -117,7 +126,7 @@ module.exports = {
|
|||
title: '云音乐 - 用户歌单',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue',
|
||||
source: '/m/user',
|
||||
target: (params, url) => `/163/music/playlist/${new URL(url).searchParams.get('id')}`,
|
||||
target: (params, url) => `/163/music/user/playlist/${new URL(url).searchParams.get('id')}`,
|
||||
},
|
||||
{
|
||||
title: '云音乐 - 歌单歌曲',
|
||||
|
|
@ -129,13 +138,13 @@ module.exports = {
|
|||
title: '云音乐 - 歌手专辑',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue',
|
||||
source: '/m/album',
|
||||
target: (params, url) => `/163/music/playlist/${new URL(url).searchParams.get('id')}`,
|
||||
target: (params, url) => `/163/music/artist/${new URL(url).searchParams.get('id')}`,
|
||||
},
|
||||
{
|
||||
title: '云音乐 - 播单声音',
|
||||
title: '云音乐 - 电台节目',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue',
|
||||
source: ['/m/radio', '/m/djradio'],
|
||||
target: (params, url) => `/163/music/playlist/${new URL(url).searchParams.get('id')}`,
|
||||
target: (params, url) => `/163/music/djradio/${new URL(url).searchParams.get('id')}`,
|
||||
},
|
||||
{
|
||||
title: '用户动态',
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module.exports = function (router) {
|
|||
router.get('/dy2/:id', require('./dy2'));
|
||||
|
||||
router.get('/music/artist/:id', require('./music/artist'));
|
||||
router.get('/music/artist/songs/:id', require('./music/artist-songs'));
|
||||
router.get('/music/djradio/:id', require('./music/djradio'));
|
||||
router.get('/music/playlist/:id', require('./music/playlist'));
|
||||
router.get('/music/user/events/:id', require('./music/userevents'));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
歌手:{{ singer }}<br>
|
||||
专辑:{{ album }}<br>
|
||||
发行日期:{{ date }}<br>
|
||||
{{ if date }}发行日期:{{ date }}<br>{{ /if }}
|
||||
<img src="{{ picUrl }}">
|
||||
|
|
|
|||
Loading…
Reference in New Issue