From 3e7ea5b986bde571945af43d85ff881e84074399 Mon Sep 17 00:00:00 2001 From: Artin Date: Mon, 26 Nov 2018 14:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=92=AD=E5=AE=A2=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E9=9C=80=E8=A6=81=E7=9A=84=E5=AD=97=E6=AE=B5=20(#1192?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 减少了制作成本。 优化了一下文档。 --- docs/en/joinus/README.md | 9 +-------- docs/joinus/README.md | 7 ------- middleware/template.js | 5 +++++ routes/ximalaya/album.js | 4 +--- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/docs/en/joinus/README.md b/docs/en/joinus/README.md index 059a8fb15f..185a2d1abb 100644 --- a/docs/en/joinus/README.md +++ b/docs/en/joinus/README.md @@ -129,13 +129,7 @@ ctx.state.data = { }; ``` -
If you want to make a podcast feed
- -Reference article: - -- [Create a podcast - Apple](https://help.apple.com/itc/podcasts_connect/?lang=en#/itca5b22233a) -- Itunes podcast XML generator : https://codepen.io/jon-walstedt/pen/jsIup -- Feed Validation Service : https://podba.se/validate/?url=https://rsshub.app/ximalaya/album/299146/ +#### make a podcast feed these datas can make your podcast subscribeable: @@ -163,7 +157,6 @@ ctx.state.data = { enclosure_url: '', // The item's audio link enclosure_length: '', // The audio length, the unit is seconds. enclosure_type: '', // 'audio/mpeg' or 'audio/x-m4a' or others - itunes_duration: '', // Covert the 'enclosure_length' to hh:mm:ss (1:33:52) }, ], }; diff --git a/docs/joinus/README.md b/docs/joinus/README.md index 8331824177..db3f3da5d2 100644 --- a/docs/joinus/README.md +++ b/docs/joinus/README.md @@ -325,12 +325,6 @@ ctx.state.data = { #### 制作播客 Podcast Feed -参考文章: - -- [Podcasts Connect 帮助 创建播客 - Apple](https://help.apple.com/itc/podcasts_connect/#/itca5b22233a) -- RSS 格式参考: https://codepen.io/jon-walstedt/pen/jsIup -- 播客验证: https://podba.se/validate/?url=https://rsshub.app/ximalaya/album/299146/ - 这些字段能使你的 RSS 被泛用型播客软件订阅: ```js @@ -357,7 +351,6 @@ ctx.state.data = { enclosure_url: '', // 音频链接 enclosure_length: '', // 时间戳 (播放长度) , 一般是秒数 enclosure_type: '', // [.mp3就填'audio/mpeg'] [.m4a就填'audio/x-m4a'] [.mp4就填'video/mp4'], 或其他类型. - itunes_duration: '', // 由enclosure_length转换为 时:分:秒 }, ], }; diff --git a/middleware/template.js b/middleware/template.js index 45acacbe80..fb5946f214 100644 --- a/middleware/template.js +++ b/middleware/template.js @@ -43,6 +43,11 @@ module.exports = async (ctx, next) => { } } } + + if (item.enclosure_length) { + const itunes_duration = Math.floor(item.enclosure_length / 3600) + ':' + Math.floor((item.enclosure_length % 3600) / 60) + ':' + (((item.enclosure_length % 3600) % 60) / 100).toFixed(2).slice(-2); + item.itunes_duration = itunes_duration; + } }); // decode HTML entities diff --git a/routes/ximalaya/album.js b/routes/ximalaya/album.js index bea5a15246..77f2a06e4f 100644 --- a/routes/ximalaya/album.js +++ b/routes/ximalaya/album.js @@ -15,7 +15,7 @@ module.exports = async (ctx) => { const albuminfo = AlbumInfoResponse.data.data.mainInfo; // 专辑数据 const album_title = albuminfo.albumTitle; // 专辑标题 - const album_cover = albuminfo.cover.split('!')[0]; + const album_cover = 'http:' + albuminfo.cover.split('!')[0]; const classify = albuminfo.crumbs.categoryPinyin; // 专辑分类 const album_category = albuminfo.crumbs.categoryTitle; // 专辑分类名字 const album_intro = albuminfo.richIntro; // 专辑介绍 @@ -41,7 +41,6 @@ module.exports = async (ctx) => { const track = await axios_ins.get(TrackInfoApi + trackId); const track_item = track.data; const enclosure_length = track_item.duration; // 时间长度:单位(秒) - const itunes_duration = Math.floor(enclosure_length / 3600) + ':' + Math.floor((enclosure_length % 3600) / 60) + ':' + (((enclosure_length % 3600) % 60) / 100).toFixed(2).slice(-2); let desc = track_item.intro ? track_item.intro.replace(/((\r\n)+(\s)?)+/g, '
') : '暂无简介'; const itunes_item_image = track_item.coverLarge ? track_item.coverLarge.split('!')[0] : albuminfo.cover.split('!')[0]; @@ -59,7 +58,6 @@ module.exports = async (ctx) => { enclosure_url: track_item.playPathAacv224, enclosure_length: enclosure_length, enclosure_type: 'audio/x-m4a', - itunes_duration: itunes_duration, }; ctx.cache.set(link, JSON.stringify(resultItem), 24 * 60 * 60);