fix: wasi url (#2314)

This commit is contained in:
凉凉
2019-06-04 16:27:33 +08:00
committed by DIYgod
parent c855ceee58
commit 218c06f96c

View File

@@ -2,11 +2,12 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const id = ctx.params.id;
const { id } = ctx.params;
const url = `https://wx.qnmlgb.tech/authors/${id}`;
const response = await got({
method: 'get',
url: `https://wx.qnmlgb.tech/authors/${id}`,
url,
});
const $ = cheerio.load(response.data);
@@ -16,7 +17,7 @@ module.exports = async (ctx) => {
title: `${$('#spider > div:nth-child(1) > div:nth-child(1)')
.text()
.trim()}微信公众号`,
link: `https://w.qnmlgb.tech/authors/${id}/`,
link: url,
description: $('#spider > div:nth-child(2)')
.text()
.trim(),
@@ -25,11 +26,14 @@ module.exports = async (ctx) => {
list
.map((i, ele) => {
const $ = cheerio.load(ele);
const link = $('a').attr('href');
return {
title: $('.pretty')
.text()
.trim(),
link: $('a').attr('href'),
link: `https://wx.qnmlgb.tech${link}`,
guid: link,
};
})
.get(),