fix(route): Dilbert Strip (#8737)

This commit is contained in:
Xiang Li
2022-01-22 18:17:28 +00:00
committed by GitHub
parent b4feea696f
commit 48b5573d1c
+7 -4
View File
@@ -9,12 +9,15 @@ async function load(link, id) {
const context = $('.comic-item-container > .meta-info-container');
const img = context.find('img.img-comic');
const transcript = context.find('.js-toggle-container > p');
const transcript = context.find('.comic-transcript p').html();
const title = img.attr('alt').replace('Dilbert by Scott Adams', id);
const src = 'https:' + img.attr('src');
const src = img.attr('src');
const description = `<img src="${src}"></br><p>${transcript.html()}</p>`;
let description = `<img src="${src}">`;
if (transcript) {
description += `<br/><p>${transcript}</p>`;
}
return {
title,
@@ -29,7 +32,7 @@ module.exports = async (ctx) => {
const feed = await parser.parseURL(feed_url);
const items = await Promise.all(
feed.items.slice(0, 7).map(async (item) => {
const link = `https://dilbert.com/strip/${item.id}`;
const link = item.link;
const single = {
pubDate: item.pubDate,