mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 13:39:35 +08:00
fix wasi
This commit is contained in:
@@ -1,35 +1,37 @@
|
||||
const axios = require('../../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: `https://q.qnmlgb.tech/w/api/articles?_ls=&_fmt=authorSimple&_page=author&_author_id=${id}&_sub_tab=&_tab=author`,
|
||||
headers: {
|
||||
Referer: `https://w.qnmlgb.tech/authors/${id}/`,
|
||||
},
|
||||
url: `https://wx.qnmlgb.tech/authors/${id}`,
|
||||
});
|
||||
const rawData = response.data.result.articles;
|
||||
|
||||
const data = [];
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.ae');
|
||||
|
||||
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}/`,
|
||||
description: rawData[0].author.profile_desc,
|
||||
item: data.map((item) => ({
|
||||
title: item.article.title,
|
||||
description: `${item.article.digest}<img referrerpolicy="no-referrer" src="${item.article.cover}">`,
|
||||
pubDate: new Date(item.article.datetime * 1000).toUTCString(),
|
||||
link: item.article.content_url,
|
||||
})),
|
||||
description: $('#spider > div:nth-child(2)')
|
||||
.text()
|
||||
.trim(),
|
||||
item:
|
||||
list &&
|
||||
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