fix: 99percentinvisible (#2307)

This commit is contained in:
凉凉
2019-06-04 11:43:29 +08:00
committed by DIYgod
parent 2bd3b39fcd
commit fb0d0bf603
+4 -5
View File
@@ -10,15 +10,14 @@ module.exports = async (ctx) => {
const $ = cheerio.load(response.data);
const list = $('.content .post-blocks .post-actions a.transcript')
const list = $('.content .post-blocks a.post-image')
.map((i, e) => $(e).attr('href'))
.get();
const out = await Promise.all(
list
.filter((e) => e.startsWith('/episode'))
.filter((e) => e.startsWith(url.resolve(host, 'episode/')))
.map(async (itemUrl) => {
itemUrl = url.resolve(host, itemUrl);
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
@@ -33,8 +32,8 @@ module.exports = async (ctx) => {
.trim(),
link: itemUrl,
author: '99% Invisible',
description: $('article .transcript-content').html(),
pubDate: new Date($('article header .entry-meta time').text()),
description: $('article .page-content').html(),
pubDate: new Date($('article header .entry-meta time').text()).toUTCString(),
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);