mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
fix(core): fix category filtering (#11451)
This commit is contained in:
@@ -181,7 +181,7 @@ module.exports = async (ctx, next) => {
|
||||
const title = item.title || '';
|
||||
const description = item.description || title;
|
||||
const author = item.author || '';
|
||||
const category = item.category || [];
|
||||
const category = item.category ? (Array.isArray(item.category) ? item.category : [item.category]) : [];
|
||||
const isFilter =
|
||||
title.match(makeRegex(ctx.query.filter)) || description.match(makeRegex(ctx.query.filter)) || author.match(makeRegex(ctx.query.filter)) || category.some((c) => c.match(makeRegex(ctx.query.filter)));
|
||||
return isFilter;
|
||||
@@ -194,7 +194,7 @@ module.exports = async (ctx, next) => {
|
||||
const title = item.title || '';
|
||||
const description = item.description || title;
|
||||
const author = item.author || '';
|
||||
const category = item.category || [];
|
||||
const category = item.category ? (Array.isArray(item.category) ? item.category : [item.category]) : [];
|
||||
let isFilter = true;
|
||||
ctx.query.filter_title && (isFilter = title.match(makeRegex(ctx.query.filter_title)));
|
||||
ctx.query.filter_description && (isFilter = isFilter && description.match(makeRegex(ctx.query.filter_description)));
|
||||
@@ -213,7 +213,7 @@ module.exports = async (ctx, next) => {
|
||||
const title = item.title;
|
||||
const description = item.description || title;
|
||||
const author = item.author || '';
|
||||
const category = item.category || [];
|
||||
const category = item.category ? (Array.isArray(item.category) ? item.category : [item.category]) : [];
|
||||
let isFilter = true;
|
||||
ctx.query.filterout_title && (isFilter = !title.match(makeRegex(ctx.query.filterout_title)));
|
||||
ctx.query.filterout_description && (isFilter = isFilter && !description.match(makeRegex(ctx.query.filterout_description)));
|
||||
|
||||
Reference in New Issue
Block a user