mirror of
https://gitee.com/houhuan/TrendRadar.git
synced 2025-12-21 11:17:15 +08:00
v3.1.1
This commit is contained in:
parent
204094edab
commit
acb100552d
33
README-EN.md
33
README-EN.md
@ -13,7 +13,7 @@
|
||||
[](https://github.com/sansan0/TrendRadar/stargazers)
|
||||
[](https://github.com/sansan0/TrendRadar/network/members)
|
||||
[](LICENSE)
|
||||
[](https://github.com/sansan0/TrendRadar)
|
||||
[](https://github.com/sansan0/TrendRadar)
|
||||
[](https://github.com/sansan0/TrendRadar)
|
||||
|
||||
[](https://work.weixin.qq.com/)
|
||||
@ -251,6 +251,26 @@ 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/11/22 - v3.1.1
|
||||
|
||||
- **Fixed data anomaly crash issue**: Resolved `'float' object has no attribute 'lower'` error encountered by some users in GitHub Actions environment
|
||||
- Added dual protection mechanism: Filter invalid titles (None, float, empty strings) at data acquisition stage, with type checking at function call sites
|
||||
- Enhanced system stability to ensure normal operation even when data sources return abnormal formats
|
||||
|
||||
**Upgrade Instructions** (GitHub Fork Users):
|
||||
- Required update: `main.py`
|
||||
- Recommended: Use minor version upgrade method - copy and replace the file above
|
||||
|
||||
|
||||
### 2025/11/18 - mcp-v1.0.2
|
||||
|
||||
**MCP Module Update:**
|
||||
- Fix issue where today's news query may return articles from past dates
|
||||
|
||||
|
||||
<details>
|
||||
<summary><strong>👉 Click to expand: Historical Updates</strong></summary>
|
||||
|
||||
### 2025/11/20 - v3.1.0
|
||||
|
||||
- **Added Personal WeChat Push Support**: WeWork application can push to personal WeChat without installing WeWork APP
|
||||
@ -264,17 +284,6 @@ Transform from "algorithm recommendation captivity" to "actively getting the inf
|
||||
- Optional update: `.github/workflows/crawler.yml` (if using GitHub Actions)
|
||||
- Recommended: Use minor version upgrade method - copy and replace the files above
|
||||
|
||||
|
||||
|
||||
### 2025/11/18 - mcp-v1.0.2
|
||||
|
||||
**MCP Module Update:**
|
||||
- Fix issue where today's news query may return articles from past dates
|
||||
|
||||
|
||||
<details>
|
||||
<summary><strong>👉 Click to expand: Historical Updates</strong></summary>
|
||||
|
||||
### 2025/11/12 - v3.0.5
|
||||
|
||||
- Fixed email sending SSL/TLS port configuration logic error
|
||||
|
||||
33
README.md
33
README.md
@ -13,7 +13,7 @@
|
||||
[](https://github.com/sansan0/TrendRadar/stargazers)
|
||||
[](https://github.com/sansan0/TrendRadar/network/members)
|
||||
[](LICENSE)
|
||||
[](https://github.com/sansan0/TrendRadar)
|
||||
[](https://github.com/sansan0/TrendRadar)
|
||||
[](https://github.com/sansan0/TrendRadar)
|
||||
|
||||
[](https://work.weixin.qq.com/)
|
||||
@ -315,6 +315,26 @@ GitHub 一键 Fork 即可使用,无需编程基础。
|
||||
- **大版本升级**:从 v1.x 升级到 v2.y,建议删除现有 fork 后重新 fork,这样更省力且避免配置冲突
|
||||
|
||||
|
||||
### 2025/11/22 - v3.1.1
|
||||
|
||||
- **修复数据异常导致的崩溃问题**:解决部分用户在 GitHub Actions 环境中遇到的 `'float' object has no attribute 'lower'` 错误
|
||||
- 新增双重防护机制:在数据获取阶段过滤无效标题(None、float、空字符串),同时在函数调用处添加类型检查
|
||||
- 提升系统稳定性,确保在数据源返回异常格式时仍能正常运行
|
||||
|
||||
**升级说明**(GitHub Fork 用户):
|
||||
- 必须更新:`main.py`
|
||||
- 建议使用小版本升级方式:复制替换上述文件
|
||||
|
||||
|
||||
### 2025/11/18 - mcp-v1.0.2
|
||||
|
||||
**MCP 模块更新:**
|
||||
- 优化查询今日新闻却可能错误返回过去日期的情况
|
||||
|
||||
|
||||
<details>
|
||||
<summary>👉 点击展开:<strong>历史更新</strong></summary>
|
||||
|
||||
### 2025/11/20 - v3.1.0
|
||||
|
||||
- **新增个人微信推送支持**:企业微信应用可推送到个人微信,无需安装企业微信 APP
|
||||
@ -328,17 +348,6 @@ GitHub 一键 Fork 即可使用,无需编程基础。
|
||||
- 可选更新:`.github/workflows/crawler.yml`(如使用 GitHub Actions 部署)
|
||||
- 建议使用小版本升级方式:复制替换上述文件
|
||||
|
||||
|
||||
|
||||
### 2025/11/18 - mcp-v1.0.2
|
||||
|
||||
**MCP 模块更新:**
|
||||
- 优化查询今日新闻却可能错误返回过去日期的情况
|
||||
|
||||
|
||||
<details>
|
||||
<summary>👉 点击展开:<strong>历史更新</strong></summary>
|
||||
|
||||
### 2025/11/12 - v3.0.5
|
||||
|
||||
- 修复邮件发送 SSL/TLS 端口配置逻辑错误
|
||||
|
||||
18
main.py
18
main.py
@ -20,7 +20,7 @@ import requests
|
||||
import yaml
|
||||
|
||||
|
||||
VERSION = "3.1.0"
|
||||
VERSION = "3.1.1"
|
||||
|
||||
|
||||
# === SMTP邮件配置 ===
|
||||
@ -527,7 +527,11 @@ class DataFetcher:
|
||||
data = json.loads(response)
|
||||
results[id_value] = {}
|
||||
for index, item in enumerate(data.get("items", []), 1):
|
||||
title = item["title"]
|
||||
title = item.get("title")
|
||||
# 跳过无效标题(None、float、空字符串)
|
||||
if title is None or isinstance(title, float) or not str(title).strip():
|
||||
continue
|
||||
title = str(title).strip()
|
||||
url = item.get("url", "")
|
||||
mobile_url = item.get("mobileUrl", "")
|
||||
|
||||
@ -949,6 +953,12 @@ def matches_word_groups(
|
||||
title: str, word_groups: List[Dict], filter_words: List[str]
|
||||
) -> bool:
|
||||
"""检查标题是否匹配词组规则"""
|
||||
# 防御性类型检查:确保 title 是有效字符串
|
||||
if not isinstance(title, str):
|
||||
title = str(title) if title is not None else ""
|
||||
if not title.strip():
|
||||
return False
|
||||
|
||||
# 如果没有配置词组,则匹配所有标题(支持显示全部新闻)
|
||||
if not word_groups:
|
||||
return True
|
||||
@ -1152,8 +1162,8 @@ def count_word_frequency(
|
||||
source_url = title_data.get("url", "")
|
||||
source_mobile_url = title_data.get("mobileUrl", "")
|
||||
|
||||
# 找到匹配的词组
|
||||
title_lower = title.lower()
|
||||
# 找到匹配的词组(防御性转换确保类型安全)
|
||||
title_lower = str(title).lower() if not isinstance(title, str) else title.lower()
|
||||
for group in word_groups:
|
||||
required_words = group["required"]
|
||||
normal_words = group["normal"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user