feat(route): Retrieve avatars from kemono pages and use them as feed images. (#13827)

This commit is contained in:
ティン・ルーフ 2023-11-18 13:32:14 +00:00 committed by GitHub
parent d355eb416c
commit 8364aa2006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,8 @@ module.exports = async (ctx) => {
});
let items = [],
title = '';
title = '',
image = undefined;
if (source === 'discord') {
title = `Posts of ${id} from Discord | Kemono`;
@ -56,6 +57,7 @@ module.exports = async (ctx) => {
const $ = cheerio.load(response.data);
title = $('title').text();
image = $('.user-header__avatar img[src]').attr('src');
items = await Promise.all(
$('.card-list__items')
@ -98,6 +100,7 @@ module.exports = async (ctx) => {
ctx.state.data = {
title,
image,
link: currentUrl,
item: items,
};