优化播客格式需要的字段 (#1192)

减少了制作成本。
优化了一下文档。
This commit is contained in:
Artin
2018-11-26 14:36:58 +08:00
committed by DIYgod
parent 0ef3046cd5
commit 3e7ea5b986
4 changed files with 7 additions and 18 deletions
+1 -8
View File
@@ -129,13 +129,7 @@ ctx.state.data = {
};
```
<details><summary>If you want to make a podcast feed</summary><br>
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)
},
],
};
-7
View File
@@ -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转换为 时:分:秒
},
],
};
+5
View File
@@ -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
+1 -3
View File
@@ -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, '<br/>') : '暂无简介';
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);