feat(pixiv): multiple picture support

This commit is contained in:
eyhn 2018-04-19 23:45:13 +08:00
parent 05503c32fe
commit c8a467ecc8
1 changed files with 9 additions and 1 deletions

View File

@ -133,9 +133,17 @@ module.exports = async (ctx) => {
description: `${username} 的 Pixiv 最新动态`,
lastBuildDate: new Date().toUTCString(),
item: illusts.map((illust) => {
const images = [];
if (illust.page_count === 1) {
images.push(`<p><img src="https://pixiv.cat/${illust.id}.jpg"/></p>`);
} else {
for (let i = 0; i < illust.page_count; i++) {
images.push(`<p><img src="https://pixiv.cat/${illust.id}-${i+1}.jpg"/></p>`);
}
}
return {
title: illust.title,
description: `<p>画师:${username} - 上传于:${new Date(illust.create_date).toLocaleString('zh-cn')} - 阅览数:${illust.total_view} - 收藏数:${illust.total_bookmarks}</p><p><img src="https://pixiv.cat/${illust.id}.jpg"/></p>`,
description: `<p>画师:${username} - 上传于:${new Date(illust.create_date).toLocaleString('zh-cn')} - 阅览数:${illust.total_view} - 收藏数:${illust.total_bookmarks}</p>${images.join('')}`,
link: `https://www.pixiv.net/member_illust.php?mode=medium&illust_id=${illust.id}`
};
})