diff --git a/lib/v2/kemono/index.js b/lib/v2/kemono/index.js index 01f142de0..bc7215aac 100644 --- a/lib/v2/kemono/index.js +++ b/lib/v2/kemono/index.js @@ -5,6 +5,7 @@ const { art } = require('@/utils/render'); const path = require('path'); module.exports = async (ctx) => { + const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 25; const source = ctx.params.source ?? ''; const id = ctx.params.id; @@ -40,6 +41,7 @@ module.exports = async (ctx) => { return channelResponse.data .filter((i) => i.content || i.attachments) + .slice(0, limit) .map((i) => ({ title: i.content, description: art(path.join(__dirname, 'templates', 'discord.art'), { i }), @@ -62,7 +64,7 @@ module.exports = async (ctx) => { items = await Promise.all( $('.card-list__items') .find('a') - .slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 25) + .slice(0, limit) .toArray() .map((item) => { item = $(item); @@ -90,7 +92,7 @@ module.exports = async (ctx) => { item.author = content('.post__user-name').text(); item.title = content('.post__title span').first().text(); item.guid = item.link.replace('kemono.su', 'kemono.party'); - item.pubDate = parseDate(content('.timestamp').attr('datetime')); + item.pubDate = parseDate(content('div.post__published').contents().last().text().trim()); // find the first attachment with a file extension we // want, and set it as the enclosure