forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonthly.js
38 lines (34 loc) · 1.34 KB
/
monthly.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const config = require('../../config');
module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: 'https://www.jianshu.com/trending/monthly',
headers: {
'User-Agent': config.ua,
Referer: 'https://www.jianshu.com/trending/monthly',
},
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.note-list li');
ctx.state.data = {
title: '简书 30 日热门',
link: 'https://www.jianshu.com/trending/monthly',
description: '简书 30 日热门',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('.title').text(),
description: `作者:${item.find('.nickname').text()}<br>描述:${item.find('.abstract').text()}<br><img referrerpolicy="no-referrer" src="https:${item.find('.img-blur').data('echo')}">`,
pubDate: new Date(item.find('.time').data('shared-at')).toUTCString(),
link: `https://www.jianshu.com${item.find('.title').attr('href')}`,
};
})
.get(),
};
};