diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 23d9f2e7e..bd7dca853 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -164,53 +164,6 @@ 'steampowered.com': { _name: 'Steam', store: [{ title: 'search', docs: 'https://docs.rsshub.app/game.html#steam', source: '/search/', target: (params, url) => `/steam/search/${new URL(url).searchParams}` }] }, // 'baijingapp.com': { _name: '白鲸出海', www: [{ title: '文章', docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai', source: '', target: '/baijing' }] }, 'xiaomi.cn': { _name: '小米社区', www: [{ title: '圈子', docs: 'https://docs.rsshub.app/bbs.html#xiao-mi-she-qu', source: '/board/:boardId', target: '/mi/bbs/board/:boardId' }] }, - '163.com': { - _name: '网易', - music: [ - { - title: '云音乐 - 用户歌单', - docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', - source: '/', - target: (params, url) => { - const id = new URL(url).hash.match(/home\?id=(.*)/)[1]; - return id ? `/ncm/user/playlist/${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(/playlist\?id=(.*)/)[1]; - return id ? `/ncm/playlist/${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(/album\?id=(.*)/)[1]; - return id ? `/ncm/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(/djradio\?id=(.*)/)[1]; - return id ? `/ncm/djradio/${id}` : ''; - }, - }, - ], - 'y.music': [ - { title: '云音乐 - 用户歌单', docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', source: '/m/user', target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}` }, - { title: '云音乐 - 歌单歌曲', docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', source: '/m/playlist', target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}` }, - { title: '云音乐 - 歌手专辑', docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', source: '/m/album', target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}` }, - { title: '云音乐 - 播单声音', docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', source: ['/m/radio', '/m/djradio'], target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}` }, - ], - }, 'suzhou.gov.cn': { _name: '苏州市政府', www: [{ title: '政府新闻', docs: 'https://docs.rsshub.app/government.html#su-zhou-shi-ren-min-zheng-fu', source: '/szsrmzf/:uid/nav_list.shtml', target: '/gov/suzhou/news/:uid' }] }, 'mqube.net': { _name: 'MQube', diff --git a/docs/multimedia.md b/docs/multimedia.md index cf75faacf..224a1564a 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -1628,23 +1628,27 @@ JavDB 有多个备用域名,本路由默认使用永久域名 + ### 用户歌单 - + ### 用户听歌排行 - + + +### 用户动态 + + ### 歌手专辑 - + ### 电台节目 - + ## 西瓜视频 diff --git a/docs/study.md b/docs/study.md index 6805ada35..8d6b3dc50 100644 --- a/docs/study.md +++ b/docs/study.md @@ -470,7 +470,7 @@ path="/ctfhub/upcoming/:limit?" ### 精品课程 - + ## 下厨房 diff --git a/lib/radar-rules.js b/lib/radar-rules.js index 1768d356c..b93e30757 100644 --- a/lib/radar-rules.js +++ b/lib/radar-rules.js @@ -395,73 +395,6 @@ module.exports = { }, ], }, - '163.com': { - _name: '网易', - music: [ - { - title: '云音乐 - 用户歌单', - docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', - source: '/', - target: (params, url) => { - const id = new URL(url).hash.match(/home\?id=(.*)/)[1]; - return id ? `/ncm/user/playlist/${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(/playlist\?id=(.*)/)[1]; - return id ? `/ncm/playlist/${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(/album\?id=(.*)/)[1]; - return id ? `/ncm/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(/djradio\?id=(.*)/)[1]; - return id ? `/ncm/djradio/${id}` : ''; - }, - }, - ], - 'y.music': [ - { - title: '云音乐 - 用户歌单', - docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', - source: '/m/user', - target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}`, - }, - { - title: '云音乐 - 歌单歌曲', - docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', - source: '/m/playlist', - target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}`, - }, - { - title: '云音乐 - 歌手专辑', - docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', - source: '/m/album', - target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}`, - }, - { - title: '云音乐 - 播单声音', - docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', - source: ['/m/radio', '/m/djradio'], - target: (params, url) => `/ncm/playlist/${new URL(url).searchParams.get('id')}`, - }, - ], - }, 'suzhou.gov.cn': { _name: '苏州市政府', www: [ diff --git a/lib/router.js b/lib/router.js index f2e624035..f9c6f8d06 100644 --- a/lib/router.js +++ b/lib/router.js @@ -62,11 +62,11 @@ router.get('/benedictevans', lazyloadRouteHandler('./routes/benedictevans/recent // router.get('/tieba/user/:uid', lazyloadRouteHandler('./routes/tieba/user')); // 网易云音乐 -router.get('/ncm/playlist/:id', lazyloadRouteHandler('./routes/ncm/playlist')); -router.get('/ncm/user/playlist/:uid', lazyloadRouteHandler('./routes/ncm/userplaylist')); -router.get('/ncm/artist/:id', lazyloadRouteHandler('./routes/ncm/artist')); -router.get('/ncm/djradio/:id', lazyloadRouteHandler('./routes/ncm/djradio')); -router.get('/ncm/user/playrecords/:uid/:type?', lazyloadRouteHandler('./routes/ncm/userplayrecords')); +// router.get('/ncm/playlist/:id', lazyloadRouteHandler('./routes/ncm/playlist')); +// router.get('/ncm/user/playlist/:uid', lazyloadRouteHandler('./routes/ncm/userplaylist')); +// router.get('/ncm/artist/:id', lazyloadRouteHandler('./routes/ncm/artist')); +// router.get('/ncm/djradio/:id', lazyloadRouteHandler('./routes/ncm/djradio')); +// router.get('/ncm/user/playrecords/:uid/:type?', lazyloadRouteHandler('./routes/ncm/userplayrecords')); // 掘金 migrated to v2 // router.get('/juejin/category/:category', lazyloadRouteHandler('./routes/juejin/category')); diff --git a/lib/routes/ncm/playlist.js b/lib/routes/ncm/playlist.js deleted file mode 100644 index e9bd29404..000000000 --- a/lib/routes/ncm/playlist.js +++ /dev/null @@ -1,45 +0,0 @@ -const got = require('@/utils/got'); -const config = require('@/config').value; - -module.exports = async (ctx) => { - const id = ctx.params.id; - - const response = await got({ - method: 'post', - url: 'https://music.163.com/api/v3/playlist/detail', - headers: { - Referer: 'https://music.163.com/', - Cookie: config.ncm.cookies, - }, - form: { - id, - }, - }); - - const data = response.data.playlist; - const songinfo = await got({ - method: 'get', - url: `https://music.163.com/api/song/detail?ids=[${data.trackIds.slice(0, 201).map((item) => item.id)}]`, - headers: { - Referer: 'https://music.163.com', - }, - }); - const songs = songinfo.data.songs; - - ctx.state.data = { - title: data.name, - link: `https://music.163.com/#/playlist?id=${id}`, - description: `网易云音乐歌单 - ${data.name}`, - item: data.trackIds.slice(0, 201).map((item) => { - const thissong = songs.find((element) => element.id === item.id); - const singer = thissong.artists.length === 1 ? thissong.artists[0].name : thissong.artists.reduce((prev, cur) => (prev.name || prev) + '/' + cur.name); - return { - title: `${thissong.name} - ${singer}`, - description: `歌手:${singer}
专辑:${thissong.album.name}
发行日期:${new Date(thissong.album.publishTime).toLocaleDateString()}
`, - link: `https://music.163.com/#/song?id=${item.id}`, - pubDate: new Date(item.at), - author: singer, - }; - }), - }; -}; diff --git a/lib/v2/163/maintainer.js b/lib/v2/163/maintainer.js index c5168ec4b..d6fddf203 100644 --- a/lib/v2/163/maintainer.js +++ b/lib/v2/163/maintainer.js @@ -3,6 +3,14 @@ module.exports = { '/ds/:id': ['luyuhuang'], '/dy/:id': ['HendricksZheng'], '/dy2/:id': ['mjysci'], + + '/music/artist/:id': ['metowolf'], + '/music/djradio/:id': ['magic-akari'], + '/music/playlist/:id': ['DIYgod'], + '/music/user/events/:id': ['Master-Hash'], + '/music/user/playlist/:uid': ['DIYgod'], + '/music/user/playrecords/:uid/:type?': ['alfredcai'], + '/news/rank/:category?/:type?/:time?': ['nczitzk'], '/news/special/:type?': ['nczitzk'], '/open/vip': ['hoilc'], diff --git a/lib/routes/ncm/artist.js b/lib/v2/163/music/artist.js similarity index 65% rename from lib/routes/ncm/artist.js rename to lib/v2/163/music/artist.js index 87932b0f8..1430d298b 100644 --- a/lib/routes/ncm/artist.js +++ b/lib/v2/163/music/artist.js @@ -1,11 +1,11 @@ const got = require('@/utils/got'); +const { art } = require('@/utils/render'); +const path = require('path'); module.exports = async (ctx) => { const id = ctx.params.id; - const response = await got({ - method: 'get', - url: `https://music.163.com/api/artist/albums/${id}`, + const response = await got(`https://music.163.com/api/artist/albums/${id}`, { headers: { Referer: 'https://music.163.com/', }, @@ -17,11 +17,17 @@ module.exports = async (ctx) => { title: data.artist.name, link: `https://music.163.com/#/artist/album?id=${id}`, description: `网易云音乐歌手专辑 - ${data.artist.name}`, + image: data.artist.img1v1Url || data.artist.picUrl, item: data.hotAlbums.map((item) => { const singer = item.artists.length === 1 ? item.artists[0].name : item.artists.reduce((prev, cur) => (prev.name || prev) + '/' + cur.name); return { title: `${item.name} - ${singer}`, - description: `歌手:${singer}
专辑:${item.name}
日期:${new Date(item.publishTime).toLocaleDateString()}
`, + description: art(path.join(__dirname, '../templates/music/playlist.art'), { + singer, + album: item.name, + date: new Date(item.publishTime).toLocaleDateString(), + picUrl: item.picUrl, + }), link: `https://music.163.com/#/album?id=${item.id}`, pubDate: new Date(item.publishTime), published: new Date(item.publishTime), diff --git a/lib/routes/ncm/djradio.js b/lib/v2/163/music/djradio.js similarity index 92% rename from lib/routes/ncm/djradio.js rename to lib/v2/163/music/djradio.js index a6ca1d3b2..4056445e4 100644 --- a/lib/routes/ncm/djradio.js +++ b/lib/v2/163/music/djradio.js @@ -7,9 +7,7 @@ module.exports = async (ctx) => { const id = ctx.params.id; const ProcessFeed = (limit, offset) => - got({ - method: 'post', - url: 'https://music.163.com/api/dj/program/byradio', + got.post('https://music.163.com/api/dj/program/byradio', { headers: { Referer: 'https://music.163.com/', }, @@ -40,7 +38,7 @@ module.exports = async (ctx) => { const duration = ~~(pg.duration / 1000); const mm_ss_duration = `${(duration / 60).toFixed(0).padStart(2, '0')}:${(duration % 60).toFixed(0).padStart(2, '0')}`; - const html = art(path.join(__dirname, 'templates/djradio-content.art'), { + const html = art(path.join(__dirname, '../templates/music/djradio-content.art'), { pg, description, itunes_duration: mm_ss_duration, diff --git a/lib/v2/163/music/maintainer.js b/lib/v2/163/music/maintainer.js new file mode 100644 index 000000000..464796cda --- /dev/null +++ b/lib/v2/163/music/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/user/events/:id': ['Master-Hash'], +}; diff --git a/lib/v2/163/music/playlist.js b/lib/v2/163/music/playlist.js new file mode 100644 index 000000000..722804899 --- /dev/null +++ b/lib/v2/163/music/playlist.js @@ -0,0 +1,55 @@ +const got = require('@/utils/got'); +const config = require('@/config').value; +const { art } = require('@/utils/render'); +const path = require('path'); + +module.exports = async (ctx) => { + if (!config.ncm || !config.ncm.cookies) { + throw '163 Music RSS is disabled due to the lack of relevant config'; + } + + const id = ctx.params.id; + + const response = await got.post('https://music.163.com/api/v3/playlist/detail', { + headers: { + Referer: 'https://music.163.com/', + Cookie: config.ncm.cookies, + }, + form: { + id, + }, + }); + + const data = response.data.playlist; + const songinfo = await got('https://music.163.com/api/song/detail', { + headers: { + Referer: 'https://music.163.com', + }, + searchParams: { + ids: `[${data.trackIds.slice(0, 201).map((item) => item.id)}]`, + }, + }); + const songs = songinfo.data.songs; + + ctx.state.data = { + title: data.name, + link: `https://music.163.com/#/playlist?id=${id}`, + description: `网易云音乐歌单 - ${data.name}`, + item: data.trackIds.slice(0, 201).map((item) => { + const thisSong = songs.find((element) => element.id === item.id); + const singer = thisSong.artists.length === 1 ? thisSong.artists[0].name : thisSong.artists.reduce((prev, cur) => (prev.name || prev) + '/' + cur.name); + return { + title: `${thisSong.name} - ${singer}`, + description: art(path.join(__dirname, '../templates/music/playlist.art'), { + singer, + album: thisSong.album.name, + date: new Date(thisSong.album.publishTime).toLocaleDateString(), + picUrl: thisSong.album.picUrl, + }), + link: `https://music.163.com/#/song?id=${item.id}`, + pubDate: new Date(item.at), + author: singer, + }; + }), + }; +}; diff --git a/lib/v2/163/music/userevents.js b/lib/v2/163/music/userevents.js new file mode 100644 index 000000000..6344fc473 --- /dev/null +++ b/lib/v2/163/music/userevents.js @@ -0,0 +1,52 @@ +const path = require('path'); +const got = require('@/utils/got'); +const { art } = require('@/utils/render'); +const renderDescription = (info) => art(path.join(__dirname, '../templates/music/userevents.art'), info); + +module.exports = async (ctx) => { + const { id } = ctx.params; + + const response = await got(`https://music.163.com/api/event/get/${id}`, { + headers: { + Referer: 'https://music.163.com/', + }, + }); + + const { data } = response; + const { nickname, signature, avatarUrl } = data.events[0].user; + + ctx.state.data = { + title: `${nickname}的云村动态`, + link: `https://music.163.com/#/user/event?id=${id}`, + description: `网易云音乐用户动态 - ${signature}`, + icon: avatarUrl, + image: avatarUrl, + item: data.events.map((item) => { + const title = item.info.commentThread.resourceTitle; + const userId = item.user.userId; + const description = JSON.parse(item.json).msg; + const pics = item.pics.map(({ originUrl }) => originUrl); + const eventId = item.id; + + /** + * @todo 根据 `item.info.commentThread.resourceInfo.eventType` 生成 Media + * 17 分享节目 + * 18 分享单曲 + * 19 分享专辑 + * 35 空 + * 因为我不需要,我就不写了。 + * 因为 api 并没有 mp3 URL,生成 `media` 字段会有困难。 + */ + return { + title, + description: renderDescription({ description, pics }), + link: `https://music.163.com/#/event?id=${eventId}&uid=${userId}`, + pubDate: new Date(item.eventTime), + published: new Date(item.eventTime), + author: nickname, + upvotes: item.info.likedCount, + comments: item.info.commentCount, + }; + }), + }; +}; diff --git a/lib/routes/ncm/userplaylist.js b/lib/v2/163/music/userplaylist.js similarity index 71% rename from lib/routes/ncm/userplaylist.js rename to lib/v2/163/music/userplaylist.js index 62547cb33..bebbe6aec 100644 --- a/lib/routes/ncm/userplaylist.js +++ b/lib/v2/163/music/userplaylist.js @@ -1,11 +1,11 @@ const got = require('@/utils/got'); +const { art } = require('@/utils/render'); +const path = require('path'); module.exports = async (ctx) => { const uid = ctx.params.uid; - const response = await got({ - method: 'post', - url: 'http://music.163.com/api/user/playlist', + const response = await got.post('https://music.163.com/api/user/playlist', { headers: { Referer: 'https://music.163.com/', }, @@ -24,23 +24,21 @@ module.exports = async (ctx) => { ctx.state.data = { title: `${nickname} 的所有歌单`, - link: `http://music.163.com/user/home?id=${uid}`, + link: `https://music.163.com/user/home?id=${uid}`, subtitle: signature, description: signature, author: nickname, updated: response.headers.date, icon: avatarUrl, + image: avatarUrl, item: playlist.map((pl) => { - const image = ``; - - const description = `
${(pl.description || '') - .split('\n') - .map((p) => `

${p}

`) - .join('')}
`; - const src = `http://music.163.com/playlist/${pl.id}`; - const html = image + description + ``; + const html = art(path.join(__dirname, '../templates/music/userplaylist.art'), { + image: pl.coverImgUrl, + description: (pl.description || '').split('\n'), + src, + }); return { title: pl.name, diff --git a/lib/routes/ncm/userplayrecords.js b/lib/v2/163/music/userplayrecords.js similarity index 56% rename from lib/routes/ncm/userplayrecords.js rename to lib/v2/163/music/userplayrecords.js index a52173e90..6adb8b563 100644 --- a/lib/routes/ncm/userplayrecords.js +++ b/lib/v2/163/music/userplayrecords.js @@ -1,5 +1,7 @@ const got = require('@/utils/got'); const config = require('@/config').value; +const { art } = require('@/utils/render'); +const path = require('path'); const headers = { cookie: config.ncm.cookies, @@ -17,18 +19,14 @@ function getItem(records) { return records.map((record, index) => { const song = record.song; - const album = song.al ? `` : ''; - - const artists = song.ar.map((a) => `${a.name}`).join(`/`); const artists_paintext = song.ar.map((a) => a.name).join('/'); - const html = `
- 排行:${index + 1} 播放次数:${record.playCount} 得分:${record.score}
- 歌曲:${song.name}
- 歌手:${artists}
- 歌曲图:${album}
-
`; + const html = art(path.join(__dirname, '../templates/music/userplayrecords.art'), { + index, + record, + song, + }); return { title: `[${index + 1}] ${song.name} - ${artists_paintext}`, @@ -43,14 +41,14 @@ module.exports = async (ctx) => { const uid = ctx.params.uid; const type = parseInt(ctx.params.type) || 0; - const url = `http://music.163.com/api/v1/play/record?uid=${uid}&type=${type}`; - const response = await got({ url, headers }); + const url = `https://music.163.com/api/v1/play/record?uid=${uid}&type=${type}`; + const response = await got(url, { headers }); const records = type === 1 ? response.data.weekData : response.data.allData; ctx.state.data = { - title: type === 1 ? `听歌榜单(最近一周)- ${uid}` : `听歌榜单(所有时间)- ${uid}`, - link: `http://music.163.com/user/home?id=${uid}`, + title: `${type === 1 ? '听歌榜单(最近一周)' : '听歌榜单(所有时间}'} - ${uid}}`, + link: `https://music.163.com/user/home?id=${uid}`, updated: response.headers.date, item: getItem(records), }; diff --git a/lib/v2/163/radar.js b/lib/v2/163/radar.js index 8e5880e56..d15e81017 100644 --- a/lib/v2/163/radar.js +++ b/lib/v2/163/radar.js @@ -35,6 +35,53 @@ module.exports = { target: '/163/today', }, ], + music: [ + { + title: '云音乐 - 用户歌单', + docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', + source: '/', + target: (params, url) => { + const id = new URL(url).hash.match(/home\?id=(.*)/)[1]; + return id ? `/163/music/user/playlist/${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(/playlist\?id=(.*)/)[1]; + return id ? `/163/music/playlist/${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(/album\?id=(.*)/)[1]; + 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(/djradio\?id=(.*)/)[1]; + return id ? `/163/music/djradio/${id}` : ''; + }, + }, + { + title: '用户动态', + docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue-yong-hu-dong-tai', + source: ['/'], + target: (_, url) => { + const id = new URL(url).hash.match(/event\?id=(.*)/)[1]; + return id ? `/163/music/user/events/${id}` : ''; + }, + }, + ], news: [ { title: '排行榜', @@ -65,5 +112,35 @@ module.exports = { target: '/163/today', }, ], + 'y.music': [ + { + 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')}`, + }, + { + title: '云音乐 - 歌单歌曲', + docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue', + source: '/m/playlist', + target: (params, url) => `/163/music/playlist/${new URL(url).searchParams.get('id')}`, + }, + { + 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')}`, + }, + { + 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')}`, + }, + { + title: '用户动态', + docs: 'https://docs.rsshub.app/multimedia.html#wang-yi-yun-yin-yue-yong-hu-dong-tai', + }, + ], }, }; diff --git a/lib/v2/163/router.js b/lib/v2/163/router.js index b23f3a7f2..bc3e92afb 100644 --- a/lib/v2/163/router.js +++ b/lib/v2/163/router.js @@ -3,6 +3,14 @@ module.exports = function (router) { router.get('/ds/:id', require('./ds')); router.get('/dy/:id', require('./dy')); router.get('/dy2/:id', require('./dy2')); + + router.get('/music/artist/:id', require('./music/artist')); + 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')); + router.get('/music/user/playlist/:uid', require('./music/userplaylist')); + router.get('/music/user/playrecords/:uid/:type?', require('./music/userplayrecords')); + router.get('/news/rank/:category?/:type?/:time?', require('./news/rank')); router.get('/news/special/:type?', require('./news/special')); router.get('/open/vip', require('./open/vip')); diff --git a/lib/routes/ncm/templates/djradio-content.art b/lib/v2/163/templates/music/djradio-content.art similarity index 100% rename from lib/routes/ncm/templates/djradio-content.art rename to lib/v2/163/templates/music/djradio-content.art diff --git a/lib/v2/163/templates/music/playlist.art b/lib/v2/163/templates/music/playlist.art new file mode 100644 index 000000000..c846e49ce --- /dev/null +++ b/lib/v2/163/templates/music/playlist.art @@ -0,0 +1,4 @@ +歌手:{{ singer }}
+专辑:{{ album }}
+发行日期:{{ date }}
+ diff --git a/lib/v2/163/templates/music/userevents.art b/lib/v2/163/templates/music/userevents.art new file mode 100644 index 000000000..1149522e0 --- /dev/null +++ b/lib/v2/163/templates/music/userevents.art @@ -0,0 +1,7 @@ +

+{{ each description.split('\n') }} + {{$value}}{{if $index !== description.split('\n').length - 1}}
{{/if}} +{{/each}} +{{ each pics }} + +{{ /each }}

diff --git a/lib/v2/163/templates/music/userplaylist.art b/lib/v2/163/templates/music/userplaylist.art new file mode 100644 index 000000000..f5bf0c018 --- /dev/null +++ b/lib/v2/163/templates/music/userplaylist.art @@ -0,0 +1,16 @@ +{{ if image }} + +{{ /if }} + +{{ if description }} +
+ {{ each description d }} +

{{ d }}

+ {{ /each }} +
+{{ /if }} + + +{{ if src }} + +{{ /if }} diff --git a/lib/v2/163/templates/music/userplayrecords.art b/lib/v2/163/templates/music/userplayrecords.art new file mode 100644 index 000000000..303cc815d --- /dev/null +++ b/lib/v2/163/templates/music/userplayrecords.art @@ -0,0 +1,7 @@ +
+排行:{{ index + 1 }} 播放次数:{{ record.playCount }} 得分:{{ record.score }}
+歌曲:{{ song.name }}
+歌手:{{ each song.ar a i }}{{ a.name }} {{ if i < song.ar.length - 1 }}/ {{ /if }}{{ /each }} +
+{{ if song.al }}歌曲图:
{{ /if }} +