mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
@@ -4,12 +4,12 @@ const url = require('url');
|
||||
const sanitizeHtml = require('sanitize-html');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const indexLink = 'https://awesome.fairyever.com/daily/';
|
||||
const indexLink = 'https://daily.fairyever.com/';
|
||||
const { data } = await axios.get(indexLink);
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
// 修改 slice 可以获取更多天的内容,暂时最新的一天就够了
|
||||
const days = $('ul.menu-list>li>a')
|
||||
const days = $('.sidebar-link:contains(年)')
|
||||
.slice(0, 1)
|
||||
.toArray();
|
||||
|
||||
@@ -24,13 +24,17 @@ module.exports = async (ctx) => {
|
||||
}
|
||||
const { data } = await axios.get(link);
|
||||
const $$ = cheerio.load(data);
|
||||
let description = $$('article[title*=日报]>section')
|
||||
// 去掉文章头部的 logo 和文章尾部的二维码
|
||||
.slice(1, -1)
|
||||
// 去除锚点
|
||||
$$('a')
|
||||
.filter(function() {
|
||||
return $(this).text() === '#';
|
||||
})
|
||||
.remove();
|
||||
let description = $$('.content')
|
||||
.toArray()
|
||||
.reduce((pre, cur) => pre + $$.html(cur), '');
|
||||
description = sanitizeHtml(description, {
|
||||
allowedTags: ['section', 'h2', 'ul', 'li', 'p', 'span', 'a'],
|
||||
allowedTags: ['div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'li', 'p', 'span', 'a', 'blockquote'],
|
||||
});
|
||||
const item = {
|
||||
title: $('head>title').text(),
|
||||
|
||||
Reference in New Issue
Block a user