From 8fd98af6a7c604b6bd09174cc881d20d5502dd2c Mon Sep 17 00:00:00 2001 From: Ethan Shen <42264778+nczitzk@users.noreply.github.com> Date: Thu, 1 Dec 2022 00:39:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E5=86=85=E8=92=99=E5=8F=A4?= =?UTF-8?q?=E5=B9=BF=E6=92=AD=E7=94=B5=E8=A7=86=E5=8F=B0=E7=82=B9=E6=92=AD?= =?UTF-8?q?enclosure=5Ftype=E7=BC=BA=E5=A4=B1=20(#11360)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/v2/nmtv/column.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/v2/nmtv/column.js b/lib/v2/nmtv/column.js index 2ef7a7793..d8b0ff6b5 100644 --- a/lib/v2/nmtv/column.js +++ b/lib/v2/nmtv/column.js @@ -19,20 +19,26 @@ module.exports = async (ctx) => { const data = response.data; - const items = data.map((item) => ({ - title: item.title, - link: item.content_url, - author: item.column_name, - pubDate: timezone(parseDate(item.publish_time), +8), - description: art(path.join(__dirname, 'templates/description.art'), { - type: item.type, - image: item.index_pic, - file: `${hostUrl}/${item.target_path}${item.target_filename}`, - }), - enclosure_url: `${hostUrl}/${item.target_path}${item.target_filename}`, - itunes_duration: item.video.duration, - itunes_item_image: item.index_pic, - })); + const items = data.map((item) => { + const enclosure_url = `${hostUrl}/${item.target_path}${item.target_filename}`; + const enclosure_type = `${item.type}/${enclosure_url.match(/\.(\w+)$/)[1]}`; + + return { + title: item.title, + link: item.content_url, + author: item.column_name, + pubDate: timezone(parseDate(item.publish_time), +8), + description: art(path.join(__dirname, 'templates/description.art'), { + type: item.type, + image: item.index_pic, + file: enclosure_url, + }), + enclosure_url, + enclosure_type, + itunes_duration: item.video.duration, + itunes_item_image: item.index_pic, + }; + }); const author = data[0].column_name; const imageUrl = data[0].column_info.indexpic;