diff --git a/rsshub/blueprints/main.py b/rsshub/blueprints/main.py index 173d84e..4e143b1 100644 --- a/rsshub/blueprints/main.py +++ b/rsshub/blueprints/main.py @@ -27,17 +27,33 @@ def filter_content(ctx): exclude_description = request.args.get('exclude_description') limit = request.args.get('limit', type=int) items = ctx['items'].copy() - items = [item for item in items if include_title in item['title']] if include_title else items - items = [item for item in items if include_description in item['description']] if include_description else items - items = [item for item in items if exclude_title not in item['title']] if exclude_title else items - items = [item for item in items if exclude_description not in item['description']] if exclude_description else items - items = items[:limit] if limit else items + + if include_title: + include_keywords = include_title.split('|') if '|' in include_title else [include_title] + items = [item for item in items if any(keyword in item['title'] for keyword in include_keywords)] + + if include_description: + include_keywords = include_description.split('|') if '|' in include_description else [include_description] + items = [item for item in items if any(keyword in item['description'] for keyword in include_keywords)] + + if exclude_title: + exclude_keywords = exclude_title.split('|') if '|' in exclude_title else [exclude_title] + items = [item for item in items if all(keyword not in item['title'] for keyword in exclude_keywords)] + + if exclude_description: + exclude_keywords = exclude_description.split('|') if '|' in exclude_description else [exclude_description] + items = [item for item in items if all(keyword not in item['description'] for keyword in exclude_keywords)] + + if limit: + items = items[:limit] + ctx = ctx.copy() ctx['items'] = items return ctx + #---------- feed路由从这里开始 -----------# @bp.route('/cninfo/announcement//') @bp.route('/cninfo/announcement') diff --git a/rsshub/spiders/word/word.py b/rsshub/spiders/word/word.py index 57e7c67..edcf0df 100644 --- a/rsshub/spiders/word/word.py +++ b/rsshub/spiders/word/word.py @@ -27,11 +27,11 @@ def remove_html_tags(text): def ctx(category=''): word = '' if category == 'ja': - url = 'https://raw.githubusercontent.com/hillerliao/img/main/words.csv' + url = 'https://raw.githubusercontent.com/henrylovemiller/img/main/words.csv' res = get_csv_line(url) word = f"{res[1]} 〔{res[2]} {res[4]}〕 {res[3]} " elif category == 'jlpt3': - url = 'https://raw.githubusercontent.com/hillerliao/img/main/hongbaoshu_N3.csv' + url = 'https://raw.githubusercontent.com/henrylovemiller/img/main/hongbaoshu_N3.csv' res = get_csv_line(url) word = f"{res[0]}〔{res[1]} {res[2]}〕 ➡{res[3]} ➡{res[4]} ➡ {res[5]} ➡ {res[6]} " word = remove_html_tags(word) diff --git a/rsshub/templates/main/feeds.html b/rsshub/templates/main/feeds.html index a4e372a..820a65d 100644 --- a/rsshub/templates/main/feeds.html +++ b/rsshub/templates/main/feeds.html @@ -5,8 +5,8 @@

RSS Filter参数

RSS 过滤参数by hillerliao
-

举例:https://pyrsshub.vercel.app/filter?feed=https://sspai.com/feed&include_title=派早报

-

参数:include_title 匹配标题

+

举例:https://pyrsshub.vercel.app/filter?feed=https://sspai.com/feed&include_title=征文|派早报

+

参数:include_title 匹配标题,支持多关键词,用 | 分隔。

参数:include_description 匹配摘要

参数:exclude_title 排除标题

参数:exclude_description 排除摘要