⭐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 等渠道智能推送。
Python aibarkdata-analysisdockerhot-newsllmmailmcpmcp-servernewsntfypythonrsstrending-topicswechatwework
fix: StorageManager 添加推送记录代理方法 + S3 切换至 virtual-hosted style 提升兼容性
sansan6dd29eaee3c2
diff --git a/README-EN.md b/README-EN.mdindex 17c88802bd..a87ca8dcdc 100644--- a/README-EN.md+++ b/README-EN.md@@ -10,8 +10,7 @@<a href="https://trendshift.io/repositories/14726" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14726" alt="sansan0%2FTrendRadar | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>-<a href="https://share.302.ai/mEOUzG" target="_blank" title="One-stop AI Models & APIs Platform"><img src="_image/302ai.png" alt="302.AI logo" height="50"/></a>-<a href="https://shandianshuo.cn" target="_blank" title="AI Voice Input, 4x Faster Than Typing ⚡"><img src="_image/shandianshuo.png" alt="FlashSpeak logo" height="51"/></a>+<a href="https://shandianshuo.cn" target="_blank" title="AI Voice Input, 4x Faster Than Typing ⚡"><img src="_image/shandianshuo.png" alt="FlashSpeak logo" height="55"/></a>[](https://github.com/sansan0/TrendRadar/stargazers)[](https://github.com/sansan0/TrendRadar/network/members)@@ -365,14 +364,10 @@ Transform from "algorithm recommendation captivity" to "actively getting the inf- **Major Version Upgrade**: Upgrading from v1.x to v2.y, recommend deleting existing fork and re-forking to save effort and avoid config conflicts-### 2025/12/13 - v4.0.0+### 2025/12/17 - v4.0.1-**🎉 Major Update: Comprehensive Refactoring of Storage and Core Architecture**--- **Multi-Storage Backend Support**: Introduced a brand new storage module supporting local SQLite and remote cloud storage (S3-compatible protocols, Cloudflare R2 recommended for free tier), adaptable to GitHub Actions, Docker, and local environments.-- **Database Structure Optimization**: Refactored SQLite database table structures to improve data efficiency and query performance.-- **Enhanced Features**: Implemented date format standardization, data retention policies, timezone configuration support, and optimized time display. Fixed remote storage data persistence issues to ensure accurate data merging.-- **Cleanup and Compatibility**: Removed most legacy compatibility code and unified data storage and retrieval methods.+- StorageManager adds push record proxy methods+- S3 client switches to virtual-hosted style for better compatibility (supports Tencent Cloud COS and more services)### 2025/12/13 - mcp-v1.1.0@@ -388,6 +383,16 @@ Transform from "algorithm recommendation captivity" to "actively getting the inf<summary>👉 Click to expand: <strong>Historical Updates</strong></summary>+### 2025/12/13 - v4.0.0++**🎉 Major Update: Comprehensive Refactoring of Storage and Core Architecture**++- **Multi-Storage Backend Support**: Introduced a brand new storage module supporting local SQLite and remote cloud storage (S3-compatible protocols, Cloudflare R2 recommended for free tier), adaptable to GitHub Actions, Docker, and local environments.+- **Database Structure Optimization**: Refactored SQLite database table structures to improve data efficiency and query performance.+- **Enhanced Features**: Implemented date format standardization, data retention policies, timezone configuration support, and optimized time display. Fixed remote storage data persistence issues to ensure accurate data merging.+- **Cleanup and Compatibility**: Removed most legacy compatibility code and unified data storage and retrieval methods.++### 2025/12/03 - v3.5.0**🎉 Core Feature Enhancements**@@ -879,16 +884,6 @@ In GitHub Actions environment, data is stored in **Remote Cloud Storage** (suppoFor long-term stable operation, we recommend [Docker Deployment](#6-docker-deployment), with data stored locally and no check-in required—though it does require purchasing a cloud server.-<br>--> 🎉 **Now Supported: Multi-Cloud Storage Options**->-> This project now supports S3-compatible protocols. You can choose:-> - **Cloudflare R2** (Recommended, generous free tier)-> - Other S3-compatible storage services->-> Simply configure the corresponding `S3_ENDPOINT_URL`, `S3_BUCKET_NAME` and other environment variables to switch.----1. **Fork this project** to your GitHub account@@ -3196,7 +3191,7 @@ Cherry Studio provides GUI config interface, 5-minute quick deployment, complex> 💡 **Tip**: Actually not recommended to ask multiple questions at once. If your chosen AI model cannot even sequentially call as shown below, suggest switching models.-<img src="/_image/ai3.png" alt="MCP usage effect" width="600">+<img src="/_image/ai2.png" alt="MCP usage effect" width="600"></details>@@ -3522,51 +3517,6 @@ Any client supporting Model Context Protocol can connect to TrendRadar:## 🪄 Sponsors-### 🤖 302.AI - Enterprise AI Resource Platform--> **302.AI** is a pay-as-you-go enterprise-level AI resource platform-> Providing the latest and most comprehensive **AI models** and **APIs** on the market, plus various ready-to-use online AI applications--<div align="center">--[](https://share.302.ai/mEOUzG)-<a href="https://share.302.ai/mEOUzG" target="_blank">- <img src="_image/banner-302ai-en.jpg" alt="302.AI" width="700"/>-</a>-</div>---<details id="sponsor-tutorial">-<summary><b>👉 Click to expand: 302.AI Usage Tutorial</b></summary>---### Step 1: Get API Key--1. After registration, go to [Management Dashboard](https://302.ai/dashboard/overview) at top right-2. Click [API Keys](https://302.ai/apis/list) on the left-3. Find default API KEY at page bottom, **click eye icon to view**, then copy- (⚠️ Note: Don't click the copy button on the far right)---### Step 2: Configure in Cherry Studio--1. Open Cherry Studio, go to settings-2. Select **"302.AI"** as model provider-3. Paste the API Key you just copied-4. Click **Manage**, now you can use all supported AI models--**Tip:** Cherry Studio has natively integrated 302.AI, you can see the complete model list after configuration.---**Q: How long does $1 free credit last?**-A: Depends on usage frequency and model selection, can run multiple test sessions.--**Q: What after free credit runs out?**-A: You can top up as needed, pay-as-you-go. Major AI model prices are now relatively affordable.--</details>--> Tracking so many trending topics daily, writing reports, replying messages making your wrists tired?>> Try「FlashSpeak」AI Voice Input - Speak instead of type, 4x faster ⚡diff --git a/README.md b/README.mdindex f27ef9065a..e36833839a 100644--- a/README.md+++ b/README.md@@ -10,8 +10,7 @@<a href="https://trendshift.io/repositories/14726" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14726" alt="sansan0%2FTrendRadar | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>-<a href="https://share.302.ai/mEOUzG" target="_blank" title="一站式 AI 模型和 API 平台"><img src="_image/302ai.png" alt="302.AI logo" height="50"/></a>-<a href="https://shandianshuo.cn" target="_blank" title="AI 语音输入,比打字快 4 倍 ⚡"><img src="_image/shandianshuo.png" alt="闪电说 logo" height="51"/></a>+<a href="https://shandianshuo.cn" target="_blank" title="AI 语音输入,比打字快 4 倍 ⚡"><img src="_image/shandianshuo.png" alt="闪电说 logo" height="55"/></a>[](https://github.com/sansan0/TrendRadar/stargazers)[](https://github.com/sansan0/TrendRadar/network/members)@@ -411,15 +410,11 @@ GitHub 一键 Fork 即可使用,无需编程基础。- **大版本升级**:从 v1.x 升级到 v2.y,建议删除现有 fork 后重新 fork,这样更省力且避免配置冲突-### 2025/12/13 - v4.0.0-**🎉 重大更新:全面重构存储和核心架构**+### 2025/12/17 - v4.0.1-- **多存储后端支持**:引入全新的存储模块,支持本地 SQLite 和远程云存储(S3 兼容协议,推荐免费的 Cloudflare R2),适应 GitHub Actions、Docker 和本地环境。-- **数据库结构优化**:重构 SQLite 数据库表结构,提升数据效率和查询能力。-- **核心代码模块化**:将主程序逻辑拆分为 trendradar 包的多个模块,显著提升代码可维护性。-- **增强功能**:实现日期格式标准化、数据保留策略、时区配置支持、时间显示优化,并修复远程存储数据持久化问题,确保数据合并的准确性。-- **清理和兼容**:移除了大部分历史兼容代码,统一了数据存储和读取方式。+- StorageManager 添加推送记录代理方法+- S3 客户端切换至 virtual-hosted style 以提升兼容性(支持腾讯云 COS 等更多服务)### 2025/12/13 - mcp-v1.1.0@@ -436,6 +431,17 @@ GitHub 一键 Fork 即可使用,无需编程基础。<summary>👉 点击展开:<strong>历史更新</strong></summary>+### 2025/12/13 - v4.0.0++**🎉 重大更新:全面重构存储和核心架构**++- **多存储后端支持**:引入全新的存储模块,支持本地 SQLite 和远程云存储(S3 兼容协议,推荐免费的 Cloudflare R2),适应 GitHub Actions、Docker 和本地环境。+- **数据库结构优化**:重构 SQLite 数据库表结构,提升数据效率和查询能力。+- **核心代码模块化**:将主程序逻辑拆分为 trendradar 包的多个模块,显著提升代码可维护性。+- **增强功能**:实现日期格式标准化、数据保留策略、时区配置支持、时间显示优化,并修复远程存储数据持久化问题,确保数据合并的准确性。+- **清理和兼容**:移除了大部分历史兼容代码,统一了数据存储和读取方式。++### 2025/12/03 - v3.5.0**🎉 核心功能增强**@@ -917,16 +923,6 @@ GitHub Actions 环境下,数据存储在 **远程云存储**(支持 S3 兼如需长期稳定运行,建议使用 [Docker 部署](#6-docker-部署),数据存储在本地,无需签到,不过需要额外付费购买云服务器。-<br>--> 🎉 **已支持:多云存储方案**->-> 本项目现已支持 S3 兼容协议,你可以选择:-> - **Cloudflare R2**(推荐,免费额度充足)-> - 其他 S3 兼容存储服务->-> 只需配置对应的 `S3_ENDPOINT_URL`、`S3_BUCKET_NAME` 等环境变量即可切换。----1. **Fork 本项目**到你的 GitHub 账户@@ -3135,7 +3131,7 @@ Cherry Studio 提供 GUI 配置界面,5 分钟快速部署,复杂的部分> 💡 **提示**:实际不建议一次性问多个问题。如果你选择的 AI 模型连下图的按顺序调用都无法做到,建议换一个。-<img src="/_image/ai3.png" alt="mcp 使用效果图" width="600">+<img src="/_image/ai2.png" alt="mcp 使用效果图" width="600"></details>@@ -3541,52 +3537,6 @@ MCP Inspector 是官方调试工具,用于测试 MCP 连接:## 🪄 赞助商-> **302.AI** 是按用量付费的企业级 AI 资源平台-> 提供市场上最新、最全面的 **AI 模型**和 **API**,以及多种开箱即用的在线 AI 应用--<div align="center">--[](https://share.302.ai/mEOUzG)-<a href="https://share.302.ai/mEOUzG" target="_blank">- <img src="_image/banner-302ai-zh.jpg" alt="302.AI" width="700"/>-</a>-</div>---<details id="sponsor-tutorial">-<summary>👉 点击展开:<b>302.AI 使用教程</b></summary>-<br>--> 领取的 1 美元可用于调用各种 AI 大模型(如 Claude、GPT 等)-> 本项目 AI 分析功能需配置大模型使用,配置教程详见 [AI 智能分析](#-ai-智能分析)--### 第 1 步:获取 API Key--1. 注册后,进入右上角 [管理后台](https://302.ai/dashboard/overview)-2. 点击左侧 [API Keys](https://302.ai/apis/list)-3. 在页面下方找到默认 API KEY,**点击眼睛图标查看**,然后复制- (⚠️ 注意:不是点最右侧的复制按钮)---### 第 2 步:在 Cherry Studio 中配置--1. 打开 Cherry Studio,进入设置-2. 模型提供商选择 **"302.AI"**-3. 粘贴刚才复制的 API Key-4. 点击**管理**,现在可以使用所有支持的 AI 模型了--**提示:** Cherry Studio 已原生集成 302.AI,配置后即可看到完整模型列表。---**Q: 1 美元免费额度能用多久?**-A: 取决于使用频率和模型选择,可以进行多次测试体验。--**Q: 免费额度用完后怎么办?**-A: 可以按需充值,按量付费。目前大厂模型价格已相对亲民。--</details>--> 每天追踪这么多热点,写报告、回复消息是否让手腕疲惫?> 试试「闪电说」AI 语音输入法 —— 用说的,比打字快 4 倍 ⚡ 。从看热点到输出内容,让效率翻倍 👇diff --git a/trendradar/__init__.py b/trendradar/__init__.pyindex 31351770f7..ab0162f848 100644--- a/trendradar/__init__.py+++ b/trendradar/__init__.py@@ -9,5 +9,5 @@ TrendRadar - 热点新闻聚合与分析工具from trendradar.context import AppContext-__version__ = "4.0.0"+__version__ = "4.0.1"__all__ = ["AppContext", "__version__"]diff --git a/trendradar/storage/manager.py b/trendradar/storage/manager.pyindex c48865536c..eae15c1de1 100644--- a/trendradar/storage/manager.py+++ b/trendradar/storage/manager.py@@ -264,6 +264,33 @@ class StorageManager:"""是否支持 TXT 快照"""return self.get_backend().supports_txt+ # === 推送记录相关方法 ===++ def has_pushed_today(self, date: Optional[str] = None) -> bool:+ """+ 检查指定日期是否已推送过++ Args:+ date: 日期字符串(YYYY-MM-DD),默认为今天++ Returns:+ 是否已推送+ """+ return self.get_backend().has_pushed_today(date)++ def record_push(self, report_type: str, date: Optional[str] = None) -> bool:+ """+ 记录推送++ Args:+ report_type: 报告类型+ date: 日期字符串(YYYY-MM-DD),默认为今天++ Returns:+ 是否记录成功+ """+ return self.get_backend().record_push(report_type, date)+def get_storage_manager(backend_type: str = "auto",diff --git a/trendradar/storage/remote.py b/trendradar/storage/remote.pyindex e3486d0644..a9b071d81d 100644--- a/trendradar/storage/remote.py+++ b/trendradar/storage/remote.py@@ -21,11 +21,13 @@ from typing import Dict, List, Optional, Anytry:import boto3+ from botocore.config import Config as BotoConfigfrom botocore.exceptions import ClientErrorHAS_BOTO3 = Trueexcept ImportError:HAS_BOTO3 = Falseboto3 = None+ BotoConfig = NoneClientError = Exceptionfrom trendradar.storage.base import StorageBackend, NewsItem, NewsData@@ -90,10 +92,14 @@ class RemoteStorageBackend(StorageBackend):self.temp_dir.mkdir(parents=True, exist_ok=True)# 初始化 S3 客户端+ # 使用 virtual-hosted style addressing(主流)+ s3_config = BotoConfig(s3={"addressing_style": "virtual"})+client_kwargs = {"endpoint_url": endpoint_url,"aws_access_key_id": access_key_id,"aws_secret_access_key": secret_access_key,+ "config": s3_config,}if region:client_kwargs["region_name"] = regiondiff --git a/version b/versionindex 0c89fc927e..cc868b62c3 100644--- a/version+++ b/version@@ -1 +1 @@-4.0.0\ No newline at end of file+4.0.1\ No newline at end of file