feat: 添加豆瓣广播标题 (#3912)

This commit is contained in:
hoilc 2020-02-09 19:09:02 +08:00 committed by GitHub
parent 4671720f4c
commit 5ddf4c7698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 13 deletions

View File

@ -569,7 +569,7 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
::: tip 提示
- **目前只支持整数型 id**
- 字母型的 id可以通过头像图片链接来找到其整数型 id图片命名规则`ul[userid]-*.jpg`
- 字母型的 id可以通过头像图片链接来找到其整数型 id图片命名规则`ul[userid]-*.jpg`或`u[userid]-*.jpg`,即取文件名中间的数字
- 例如:用户 id: `MovieL`他的头像图片链接:`https://img1.doubanio.com/icon/ul1128221-98.jpg`他的整数型 id: `1128221`
:::

View File

@ -54,19 +54,23 @@ module.exports = async (ctx) => {
const items = response.data.items;
const username = items ? items[0].status.author.name : '';
ctx.state.data = {
title: `豆瓣广播-${userid}`,
title: `豆瓣广播 - ${username ? username : userid}`,
link: `https://m.douban.com/people/${userid}/statuses`,
item: items
.filter((item) => !item.deleted)
.map((item) => {
const r = getContentByActivity(item.status);
return {
title: r.title,
link: item.status.sharing_url,
pubDate: new Date(Date.parse(item.status.create_time + ' GMT+0800')).toUTCString(),
description: r.description,
};
}),
item:
items &&
items
.filter((item) => !item.deleted)
.map((item) => {
const r = getContentByActivity(item.status);
return {
title: r.title,
link: item.status.sharing_url,
pubDate: new Date(Date.parse(item.status.create_time + ' GMT+0800')).toUTCString(),
description: r.description,
};
}),
};
};