From 64496ca55d47fcb1428df3e1ffc413df028341ef Mon Sep 17 00:00:00 2001 From: Zhi Yang Date: Mon, 11 May 2020 18:28:49 +0800 Subject: [PATCH] fix: Support itunes_category and itunes_explicit (#4610) --- lib/routes/ximalaya/album.js | 14 +++++++++++--- lib/views/rss.art | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/routes/ximalaya/album.js b/lib/routes/ximalaya/album.js index fb6a0944b..6d4427395 100644 --- a/lib/routes/ximalaya/album.js +++ b/lib/routes/ximalaya/album.js @@ -2,6 +2,16 @@ const got = require('@/utils/got'); const baseUrl = 'http://www.ximalaya.com'; const got_ins = got.extend({}); +// Find category from: https://help.apple.com/itc/podcasts_connect/?lang=en#/itc9267a2f12 +const categoryDict = { + 人文: 'Society & Culture', + 历史: 'History', + 头条: 'News', + 娱乐: 'Leisure', + 音乐: 'Music', + IT科技: 'Technology', +}; + module.exports = async (ctx) => { const id = ctx.params.id; // 专辑id const isAll = ctx.params.all ? true : false; @@ -66,8 +76,6 @@ module.exports = async (ctx) => { enclosure_url: enclosure_url, enclosure_length: enclosure_length, enclosure_type: 'audio/x-m4a', - itunes_category: album_category, - itunes_explicit: 'clean', // 内容是否为限制级 }; return Promise.resolve(resultItem); }) @@ -79,7 +87,7 @@ module.exports = async (ctx) => { description: album_desc, image: album_cover, itunes_author: author, - itunes_category: album_category, + itunes_category: categoryDict[album_category] || album_category, item: resultItems, }; }; diff --git a/lib/views/rss.art b/lib/views/rss.art index c9d782e07..542c8eb3d 100644 --- a/lib/views/rss.art +++ b/lib/views/rss.art @@ -15,6 +15,7 @@ i@diygod.me (DIYgod) {{ if itunes_author }}{{ itunes_author}}{{ /if }} {{ if itunes_category }}{{ /if }} + {{ if itunes_author }}{{ itunes_explicit || 'clean' }}{{ /if }} {{ language || 'zh-cn' }} {{ if image }} @@ -35,8 +36,6 @@ {{ if $value.itunes_item_image }}{{ /if }} {{ if $value.enclosure_url }}{{ /if }} {{ if itunes_author && $value.itunes_duration }}{{ $value.itunes_duration }} {{ /if }} - {{ if itunes_author && $value.itunes_category }}{{ $value.itunes_category }} {{ /if }} - {{ if itunes_author && $value.itunes_explicit }}{{ $value.itunes_explicit }} {{ /if }} {{ if $value.author }}{{ /if }} {{ if typeof $value.category === 'string' }} {{ $value.category }}