RSS: print type in instagram user title

This commit is contained in:
DIYgod 2018-05-11 14:31:57 +08:00
parent 2374389be2
commit 1cc0a6f4ca
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
1 changed files with 14 additions and 2 deletions

View File

@ -27,9 +27,21 @@ module.exports = async (ctx) => {
description: $('meta[name="description"]').attr('content'),
item: list.map((item) => {
item = item.node;
let type = '';
let tip = '';
switch (item.__typename) {
case 'GraphVideo':
type = '[视频] ';
tip = '打开原文播放视频: ';
break;
case 'GraphSidecar':
type = '[组图] ';
tip = '打开原文查看组图: ';
break;
}
return {
title: item.edge_media_to_caption.edges && item.edge_media_to_caption.edges[0] && item.edge_media_to_caption.edges[0].node.text || '无题',
description: `${item.__typename === 'GraphVideo' ? '打开原文播放视频:' : ''}<img referrerpolicy="no-referrer" src="${item.thumbnail_src}">`,
title: `${type}${item.edge_media_to_caption.edges && item.edge_media_to_caption.edges[0] && item.edge_media_to_caption.edges[0].node.text || '无题'}`,
description: `${tip}<img referrerpolicy="no-referrer" src="${item.thumbnail_src}">`,
pubDate: new Date(item.taken_at_timestamp * 1000).toUTCString(),
link: `https://www.instagram.com/p/${item.shortcode}/`
};