mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 06:30:40 +08:00
fix(core): string-type categories only (#13590)
This commit is contained in:
@@ -136,6 +136,13 @@ module.exports = async (ctx, next) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// handle category
|
||||
if (item.category) {
|
||||
// convert single string to array, and filter only string type category
|
||||
Array.isArray(item.category) || (item.category = [item.category]);
|
||||
item.category = item.category.filter((e) => typeof e === 'string');
|
||||
}
|
||||
return item;
|
||||
};
|
||||
|
||||
@@ -172,8 +179,7 @@ module.exports = async (ctx, next) => {
|
||||
const title = item.title || '';
|
||||
const description = item.description || title;
|
||||
const author = item.author || '';
|
||||
const categoryArray = Array.isArray(item.category) ? item.category : [item.category];
|
||||
const category = item.category ? categoryArray : [];
|
||||
const category = item.category || [];
|
||||
const isFilter =
|
||||
engine === 're2'
|
||||
? regex.matcher(title).find() || regex.matcher(description).find() || regex.matcher(author).find() || category.some((c) => regex.matcher(c).find())
|
||||
@@ -189,8 +195,7 @@ module.exports = async (ctx, next) => {
|
||||
const title = item.title || '';
|
||||
const description = item.description || title;
|
||||
const author = item.author || '';
|
||||
const categoryArray = Array.isArray(item.category) ? item.category : [item.category];
|
||||
const category = item.category ? categoryArray : [];
|
||||
const category = item.category || [];
|
||||
let isFilter = true;
|
||||
|
||||
const titleRegex = makeRegex(ctx.query.filter_title);
|
||||
@@ -216,8 +221,7 @@ module.exports = async (ctx, next) => {
|
||||
const title = item.title;
|
||||
const description = item.description || title;
|
||||
const author = item.author || '';
|
||||
const categoryArray = Array.isArray(item.category) ? item.category : [item.category];
|
||||
const category = item.category ? categoryArray : [];
|
||||
const category = item.category || [];
|
||||
let isFilter = true;
|
||||
|
||||
const titleRegex = makeRegex(ctx.query.filterout_title);
|
||||
|
||||
Reference in New Issue
Block a user