chore(deps-dev): bump prettier from 1.19.1 to 2.0.2

This commit is contained in:
DIYgod
2020-04-02 21:21:46 +08:00
parent 27e4a7c151
commit 0e7b14e718
471 changed files with 1237 additions and 4457 deletions

View File

@@ -11,31 +11,21 @@ module.exports = async (ctx) => {
const $ = cheerio.load(response.data);
const meta = $('.mp-info__list .mp-info__value');
const author = $(meta[0])
.text()
.trim();
const author = $(meta[0]).text().trim();
const year = new Date().getFullYear();
const items = await Promise.all(
$('.post-item__main')
.get()
.map(async (e) => {
let pubDate = date(
`${year} ${$(e)
.find('.post-item__date')
.text()
.trim()}`,
8
);
let pubDate = date(`${year} ${$(e).find('.post-item__date').text().trim()}`, 8);
if (new Date(pubDate) > new Date()) {
pubDate = new Date(pubDate).setFullYear(year - 1);
pubDate = new Date(pubDate).toUTCString();
}
const link = `https://wemp.app${$(e)
.find('.post-item__title')
.attr('href')}`;
const link = `https://wemp.app${$(e).find('.post-item__title').attr('href')}`;
const response = await ctx.cache.tryGet(link, async () => (await got.get(link)).data);
const article = cheerio.load(response);
@@ -47,10 +37,7 @@ module.exports = async (ctx) => {
}
const single = {
title: $(e)
.find('.post-item__title')
.text()
.trim(),
title: $(e).find('.post-item__title').text().trim(),
link: weixinLink || link,
description: article('#content').html(),
pubDate,
@@ -64,9 +51,7 @@ module.exports = async (ctx) => {
ctx.state.data = {
title: `微信公众号 - ${author}`,
link: `https://wemp.app/accounts/${id}/`,
description: $(meta[1])
.text()
.trim(),
description: $(meta[1]).text().trim(),
item: items,
};
};