diff --git a/lib/routes/hentai-cosplays/utils.js b/lib/routes/hentai-cosplays/utils.js index 85be00b28..bbe000d79 100644 --- a/lib/routes/hentai-cosplays/utils.js +++ b/lib/routes/hentai-cosplays/utils.js @@ -20,7 +20,7 @@ exports.processFeed = async function processFeed(ctx, link) { list.map(async (info) => { const title = info.title.trim(); const date = info.date; - const itemUrl = host + info.link; + const itemUrl = host + 'story' + info.link.replace('/image', ''); const cache = await ctx.cache.get(itemUrl); if (cache) { @@ -29,15 +29,21 @@ exports.processFeed = async function processFeed(ctx, link) { const response = await got.get(itemUrl); const $ = cheerio.load(response.data); - const images = $('.icon-overlay > a > img'); - const desc = cheerio.html(images); + const images = $('amp-img') + .map(function (index, element) { + element = $(element); + const img_src = element.attr('src'); + return ``; + }) + .get() + .join(' '); const item = { title: title, link: itemUrl, - description: desc, + description: images, pubDate: new Date(date).toUTCString(), }; - if (desc) { + if (images) { ctx.cache.set(itemUrl, JSON.stringify(item)); } return Promise.resolve(item);