Merge pull request #6684 from troyliu0105/porn-images-xxx

fix: use story path to show all pics
This commit is contained in:
NeverBehave 2021-01-12 16:43:59 -05:00 committed by GitHub
commit 2d849bf1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -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 `<img src=${img_src} referrerpolicy="no-referrer" alt="">`;
})
.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);