添加exclude过滤功能 (#186)
* 知乎日报全文rss * reverse router.js * 知乎日报当天全文rss * Update daily.js 去除JSON处理方法,添加对redis的异步get兼容,统一缓存保留时间。 * git ignore * 即刻topic广场信息 * Delete .gitignore * Revert "Merge branch 'master' into master" This reverts commit d2acb89f0b243c9313266f4cf959db4f37935db8, reversing changes made to 2c401dba0aefc1a9a124c1ba42f5f6c2cc7744f1. * fix bug * delete request for topic info * 把缩略图改成原图 * 添加exclude过滤 * fix md
This commit is contained in:
parent
2f16f589be
commit
ead78bbd89
|
|
@ -19,7 +19,9 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
|
||||
### 内容过滤
|
||||
|
||||
可以使用以下 URL query 过滤出想要的内容,支持正则
|
||||
可以使用以下 URL query 过滤内容,支持正则
|
||||
|
||||
filter 选出想要的内容
|
||||
|
||||
* filter: 过滤标题和描述
|
||||
|
||||
|
|
@ -29,6 +31,22 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
|
||||
举例: [https://rsshub.app/bilibili/user/coin/2267573?filter=微小微|赤九玖|暴走大事件](https://rsshub.app/bilibili/user/coin/2267573?filter=微小微|赤九玖|暴走大事件)
|
||||
|
||||
filterout 去掉不要的内容
|
||||
|
||||
* filterout: 过滤标题和描述
|
||||
|
||||
* filterout_title: 过滤标题
|
||||
|
||||
* filterout_description: 过滤描述
|
||||
|
||||
举例: [https://rsshub.app/bilibili/user/coin/2267573?filterout=微小微|赤九玖|暴走大事件](https://rsshub.app/bilibili/user/coin/2267573?filterout=微小微|赤九玖|暴走大事件)
|
||||
|
||||
::: tip 提示
|
||||
|
||||
filter 与 filterout 共 6 个 query 参数可以组合使用。当 filter、filter_title、filter_description 中多个参数存在时,取其交集进行过滤,filterout 三项同理。
|
||||
|
||||
:::
|
||||
|
||||
### 输出格式
|
||||
|
||||
RSSHub 同时支持 RSS 2.0、Atom 和 [JSON Feed](https://jsonfeed.org/) 输出格式,在路由末尾添加 `.rss` `.atom` 或 `.json` 即可请求对应输出格式,缺省为 RSS 2.0
|
||||
|
|
|
|||
|
|
@ -12,4 +12,15 @@ module.exports = async (ctx, next) => {
|
|||
);
|
||||
});
|
||||
}
|
||||
if (ctx.state.data && ctx.query && (ctx.query.filterout || ctx.query.filterout_title || ctx.query.filterout_description)) {
|
||||
ctx.state.data.item = ctx.state.data.item.filter((item) => {
|
||||
const title = item.title;
|
||||
const description = item.description;
|
||||
return (
|
||||
(ctx.query.filterout && !title.match(ctx.query.filterout) && !description.match(ctx.query.filterout)) ||
|
||||
(ctx.query.filterout_title && !title.match(ctx.query.filterout_title)) ||
|
||||
(ctx.query.filterout_description && !description.match(ctx.query.filterout_description))
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue