fix: sspai series, close #3546
This commit is contained in:
parent
0bb6fa0ba8
commit
cb8416eac5
|
|
@ -1,14 +1,17 @@
|
|||
const got = require('@/utils/got');
|
||||
const { JSDOM } = require('jsdom');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://sspai.com/api/v1/series/page/get?limit=5&sort=weight&offset=0&released_at=0`,
|
||||
headers: {
|
||||
Host: 'sspai.com',
|
||||
},
|
||||
url: 'https://sspai.com/series',
|
||||
});
|
||||
const data = response.data.data;
|
||||
|
||||
const dom = new JSDOM(response.data, {
|
||||
runScripts: 'dangerously',
|
||||
});
|
||||
|
||||
const data = dom.window.__INITIAL_STATE__.seriesHomeModule.seriesSearchpage;
|
||||
|
||||
ctx.state.data = {
|
||||
title: '少数派 -- 最新上架付费专栏',
|
||||
|
|
@ -16,9 +19,10 @@ module.exports = async (ctx) => {
|
|||
description: '少数派 -- 最新上架付费专栏',
|
||||
item: data.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.summary,
|
||||
description: `<img src="https://cdn.sspai.com/${item.banner}"><br>${item.description}`,
|
||||
link: `https://sspai.com/series/${item.id}`,
|
||||
author: item.nickname,
|
||||
author: item.author.nickname,
|
||||
pubDate: new Date(item.released_at * 1000),
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue