Skip to content

⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。

fix(rss): 修复首次抓取计数及报告热点过滤,升级至 v6.8.1

sansanac0ad4f48dea
diff --git a/README-EN.md b/README-EN.md
index 94c768fa99..d774d6d0d4 100644
--- a/README-EN.md
+++ b/README-EN.md
@@ -11,7 +11,7 @@ Deploy in <strong>30 seconds</strong> — Say goodbye to endless scrolling, only
[![GitHub Stars](https://img.shields.io/github/stars/sansan0/TrendRadar?style=flat-square&logo=github&color=yellow)](https://github.com/sansan0/TrendRadar/stargazers)
[![GitHub Forks](https://img.shields.io/github/forks/sansan0/TrendRadar?style=flat-square&logo=github&color=blue)](https://github.com/sansan0/TrendRadar/network/members)
[![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg?style=flat-square)](LICENSE)
-[![Version](https://img.shields.io/badge/version-v6.8.0-blue.svg)](https://github.com/sansan0/TrendRadar)
+[![Version](https://img.shields.io/badge/version-v6.8.1-blue.svg)](https://github.com/sansan0/TrendRadar)
[![MCP](https://img.shields.io/badge/MCP-v4.0.4-green.svg)](https://github.com/sansan0/TrendRadar)
[![RSS](https://img.shields.io/badge/RSS-Feed_Support-orange.svg?style=flat-square&logo=rss&logoColor=white)](https://github.com/sansan0/TrendRadar)
[![AI Translation](https://img.shields.io/badge/AI-Multi--Language-purple.svg?style=flat-square)](https://github.com/sansan0/TrendRadar)
diff --git a/README.md b/README.md
index 098e55f360..8d13b95f91 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
[![GitHub Stars](https://img.shields.io/github/stars/sansan0/TrendRadar?style=flat-square&logo=github&color=yellow)](https://github.com/sansan0/TrendRadar/stargazers)
[![GitHub Forks](https://img.shields.io/github/forks/sansan0/TrendRadar?style=flat-square&logo=github&color=blue)](https://github.com/sansan0/TrendRadar/network/members)
[![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg?style=flat-square)](LICENSE)
-[![Version](https://img.shields.io/badge/version-v6.8.0-blue.svg)](https://github.com/sansan0/TrendRadar)
+[![Version](https://img.shields.io/badge/version-v6.8.1-blue.svg)](https://github.com/sansan0/TrendRadar)
[![MCP](https://img.shields.io/badge/MCP-v4.0.4-green.svg)](https://github.com/sansan0/TrendRadar)
[![RSS](https://img.shields.io/badge/RSS-订阅源支持-orange.svg?style=flat-square&logo=rss&logoColor=white)](https://github.com/sansan0/TrendRadar)
[![AI翻译](https://img.shields.io/badge/AI-多语言推送-purple.svg?style=flat-square)](https://github.com/sansan0/TrendRadar)
diff --git a/pyproject.toml b/pyproject.toml
index 7eae724d39..d088c5d890 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "trendradar"
-version = "6.8.0"
+version = "6.8.1"
description = "TrendRadar - 热点新闻聚合与分析工具"
requires-python = ">=3.12"
dependencies = [
diff --git a/trendradar/__init__.py b/trendradar/__init__.py
index 35277fe352..62364678ad 100644
--- a/trendradar/__init__.py
+++ b/trendradar/__init__.py
@@ -9,5 +9,5 @@ TrendRadar - 热点新闻聚合与分析工具
from trendradar.context import AppContext
-__version__ = "6.8.0"
+__version__ = "6.8.1"
__all__ = ["AppContext", "__version__"]
diff --git a/trendradar/__main__.py b/trendradar/__main__.py
index 46727e4ffa..d50a0b8612 100644
--- a/trendradar/__main__.py
+++ b/trendradar/__main__.py
@@ -1375,6 +1375,13 @@ class NewsAnalyzer:
quiet=True,
)
+ # 首次抓取时全部条目都是新增,清除新增统计以避免与主区域完全重复
+ if rss_new_stats and rss_stats:
+ main_count = sum(len(s.get("titles", [])) for s in rss_stats)
+ new_count = sum(len(s.get("titles", [])) for s in rss_new_stats)
+ if new_count > 0 and new_count >= main_count:
+ rss_new_stats = None
+
self._rss_total_count = total
return rss_stats, rss_new_stats, raw_rss_items, rss_new_urls
diff --git a/trendradar/context.py b/trendradar/context.py
index 198f3ac58d..b4b0c10cac 100644
--- a/trendradar/context.py
+++ b/trendradar/context.py
@@ -301,8 +301,6 @@ class AppContext:
id_to_name=id_to_name,
mode=mode,
rank_threshold=self.rank_threshold,
- matches_word_groups_func=self.matches_word_groups,
- load_frequency_words_func=lambda: self.load_frequency_words(frequency_file),
show_new_section=self.show_new_section,
)
@@ -336,8 +334,6 @@ class AppContext:
date_folder=self.format_date(),
time_filename=self.format_time(),
render_html_func=lambda *args, **kwargs: self.render_html(*args, rss_items=rss_items, rss_new_items=rss_new_items, ai_analysis=ai_analysis, standalone_data=standalone_data, **kwargs),
- matches_word_groups_func=self.matches_word_groups,
- load_frequency_words_func=lambda: self.load_frequency_words(frequency_file),
report_metadata=report_metadata,
)
diff --git a/trendradar/report/generator.py b/trendradar/report/generator.py
index 54b2681089..f406dbb8ee 100644
--- a/trendradar/report/generator.py
+++ b/trendradar/report/generator.py
@@ -18,8 +18,6 @@ def prepare_report_data(
id_to_name: Optional[Dict] = None,
mode: str = "daily",
rank_threshold: int = 3,
- matches_word_groups_func: Optional[Callable] = None,
- load_frequency_words_func: Optional[Callable] = None,
show_new_section: bool = True,
) -> Dict:
"""
@@ -32,8 +30,6 @@ def prepare_report_data(
id_to_name: ID 到名称的映射
mode: 报告模式 (daily/incremental/current)
rank_threshold: 排名阈值
- matches_word_groups_func: 词组匹配函数
- load_frequency_words_func: 加载频率词函数
show_new_section: 是否显示新增热点区域
Returns:
@@ -41,28 +37,33 @@ def prepare_report_data(
"""
processed_new_titles = []
- # 始终过滤新增标题用于计数(头部统计需要),但区域展示受配置控制
+ stats_title_set = {
+ t["title"]
+ for stat in stats
+ for t in stat.get("titles", [])
+ }
+
+ # 过滤新增标题:只保留在 stats 中存活的标题(即通过了 AI/关键词过滤的标题)
filtered_new_titles = {}
if new_titles and id_to_name:
- if matches_word_groups_func and load_frequency_words_func:
- word_groups, filter_words, global_filters = load_frequency_words_func()
- for source_id, titles_data in new_titles.items():
- filtered_titles = {}
- for title, title_data in titles_data.items():
- if matches_word_groups_func(title, word_groups, filter_words, global_filters):
- filtered_titles[title] = title_data
- if filtered_titles:
- filtered_new_titles[source_id] = filtered_titles
- else:
- filtered_new_titles = new_titles
+ for source_id, titles_data in new_titles.items():
+ filtered_titles = {}
+ for title, title_data in titles_data.items():
+ if title in stats_title_set:
+ filtered_titles[title] = title_data
+ if filtered_titles:
+ filtered_new_titles[source_id] = filtered_titles
original_new_count = sum(len(titles) for titles in new_titles.values()) if new_titles else 0
filtered_new_count = sum(len(titles) for titles in filtered_new_titles.values()) if filtered_new_titles else 0
if original_new_count > 0:
- print(f"频率词过滤后:{filtered_new_count} 条新增热点匹配(原始 {original_new_count} 条)")
+ print(f"新增热点过滤后:{filtered_new_count} 条保留(原始 {original_new_count} 条)")
# 在增量模式下或配置关闭时隐藏新增新闻区域(但计数已完成)
- hide_new_section = mode == "incremental" or not show_new_section
+ # 当全部热榜条目都是新增时(首次运行),也隐藏以避免与主区域完全重复
+ all_new_titles = {title for titles in filtered_new_titles.values() for title in titles}
+ all_are_new = bool(all_new_titles) and all_new_titles == stats_title_set
+ hide_new_section = mode == "incremental" or not show_new_section or all_are_new
if not hide_new_section and filtered_new_titles and id_to_name:
for source_id, titles_data in filtered_new_titles.items():
@@ -151,8 +152,6 @@ def generate_html_report(
date_folder: str = "",
time_filename: str = "",
render_html_func: Optional[Callable] = None,
- matches_word_groups_func: Optional[Callable] = None,
- load_frequency_words_func: Optional[Callable] = None,
report_metadata: Optional[Dict] = None,
) -> str:
"""
@@ -176,8 +175,6 @@ def generate_html_report(
date_folder: 日期文件夹名称
time_filename: 时间文件名
render_html_func: HTML 渲染函数
- matches_word_groups_func: 词组匹配函数
- load_frequency_words_func: 加载频率词函数
Returns:
str: 生成的 HTML 文件路径(时间戳快照路径)
@@ -198,8 +195,6 @@ def generate_html_report(
id_to_name,
mode,
rank_threshold,
- matches_word_groups_func,
- load_frequency_words_func,
)
if report_metadata:
diff --git a/trendradar/report/html.py b/trendradar/report/html.py
index ff2f7b98a7..d3eff74de8 100644
--- a/trendradar/report/html.py
+++ b/trendradar/report/html.py
@@ -2303,11 +2303,14 @@ def render_html_content(
initTabVisibility();
initTabScroll(tabBar);
- function activateTab(index) {
+ function activateTab(index, scroll) {
tabs.forEach(function(t) { t.classList.remove('active'); });
if (index === 'all') {
var allBtn = tabBar.querySelector('[data-tab-index="all"]');
- if (allBtn) allBtn.classList.add('active');
+ if (allBtn) {
+ allBtn.classList.add('active');
+ if (scroll !== false) allBtn.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });
+ }
groups.forEach(function(g) { g.style.display = ''; });
try { history.replaceState(null, '', '#all'); } catch(e) {}
return;
@@ -2322,7 +2325,7 @@ def render_html_content(
});
}
var activeBtn = tabBar.querySelector('.tab-btn.active');
- if (activeBtn) activeBtn.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });
+ if (scroll !== false && activeBtn) activeBtn.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });
try { history.replaceState(null, '', '#tab-' + idx); } catch(e) {}
}
@@ -2349,7 +2352,7 @@ def render_html_content(
var hash = window.location.hash;
if (hash === '#all') { activateTab('all'); }
else if (hash.indexOf('#tab-') === 0) { activateTab(parseInt(hash.replace('#tab-', ''))); }
- else { activateTab(0); }
+ else { activateTab(0, false); }
}
function initTabVisibility() {
diff --git a/trendradar/storage/sqlite_mixin.py b/trendradar/storage/sqlite_mixin.py
index d1e6d03a5d..ac9f40b9cc 100644
--- a/trendradar/storage/sqlite_mixin.py
+++ b/trendradar/storage/sqlite_mixin.py
@@ -1075,11 +1075,11 @@ class SQLiteStorageMixin:
if item.url:
historical_urls[feed_id].add(item.url)
- # 检查是否有历史数据
+ # 检查是否有早于当前批次的历史数据
has_historical_data = any(len(urls) > 0 for urls in historical_urls.values())
if not has_historical_data:
- # 第一次抓取,没有"新增"概念
- return {}
+ # 当天第一次抓取,所有条目都是新增
+ return current_data.items.copy()
# 检测新增
new_items: Dict[str, List[RSSItem]] = {}
diff --git a/uv.lock b/uv.lock
index 8bcad33f81..353997dcb4 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1996,7 +1996,7 @@ wheels = [
[[package]]
name = "trendradar"
-version = "6.8.0"
+version = "6.8.1"
source = { editable = "." }
dependencies = [
{ name = "boto3" },
diff --git a/version b/version
index e029aa99b7..5f6c0863ac 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-6.8.0
+6.8.1