mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
fix wasi
This commit is contained in:
@@ -1,35 +1,37 @@
|
|||||||
const axios = require('../../../utils/axios');
|
const axios = require('../../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
const id = ctx.params.id;
|
const id = ctx.params.id;
|
||||||
|
|
||||||
const response = await axios({
|
const response = await axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `https://q.qnmlgb.tech/w/api/articles?_ls=&_fmt=authorSimple&_page=author&_author_id=${id}&_sub_tab=&_tab=author`,
|
url: `https://wx.qnmlgb.tech/authors/${id}`,
|
||||||
headers: {
|
|
||||||
Referer: `https://w.qnmlgb.tech/authors/${id}/`,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const rawData = response.data.result.articles;
|
|
||||||
|
|
||||||
const data = [];
|
const $ = cheerio.load(response.data);
|
||||||
|
const list = $('.ae');
|
||||||
for (let i = 0; i < rawData.length; i++) {
|
|
||||||
const subArticles = rawData[i].sub_articles;
|
|
||||||
for (let j = 0; j < subArticles.length; j++) {
|
|
||||||
data.push(subArticles[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: `${rawData[0].author.nickname}微信公众号`,
|
title: `${$('#spider > div:nth-child(1) > div:nth-child(1)')
|
||||||
|
.text()
|
||||||
|
.trim()}微信公众号`,
|
||||||
link: `https://w.qnmlgb.tech/authors/${id}/`,
|
link: `https://w.qnmlgb.tech/authors/${id}/`,
|
||||||
description: rawData[0].author.profile_desc,
|
description: $('#spider > div:nth-child(2)')
|
||||||
item: data.map((item) => ({
|
.text()
|
||||||
title: item.article.title,
|
.trim(),
|
||||||
description: `${item.article.digest}<img referrerpolicy="no-referrer" src="${item.article.cover}">`,
|
item:
|
||||||
pubDate: new Date(item.article.datetime * 1000).toUTCString(),
|
list &&
|
||||||
link: item.article.content_url,
|
list
|
||||||
})),
|
.map((i, ele) => {
|
||||||
|
const $ = cheerio.load(ele);
|
||||||
|
return {
|
||||||
|
title: $('.pretty')
|
||||||
|
.text()
|
||||||
|
.trim(),
|
||||||
|
link: $('a').attr('href'),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user