+
+
+🚀 Deploy in 30 seconds — Your Smart Trending News Assistant
+
+
+
+
+[](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://work.weixin.qq.com/)
+[](https://weixin.qq.com/)
+[](https://telegram.org/)
+[](#)
+[](https://www.feishu.cn/)
+[](#)
+[](https://github.com/binwiederhier/ntfy)
+[](https://github.com/Finb/Bark)
+[](https://slack.com/)
+
+
+[](https://github.com/sansan0/TrendRadar)
+[](https://sansan0.github.io/TrendRadar)
+[](https://hub.docker.com/r/wantcat/trendradar)
+[](https://modelcontextprotocol.io/)
+
+
+
+ As shown above, each row is a configuration item:
+ - **Name**: Must use the fixed names listed in the expanded sections below (e.g., `WEWORK_WEBHOOK_URL`)
+ - **Secret (Value)**: Fill in the actual content obtained from the corresponding platform (e.g., Webhook URL, Token, etc.)
+
+
+
+ **Notes**:
+ - Uses the same Webhook address as WeWork bot
+ - Difference is message format: `text` for plain text, `markdown` for rich text (default)
+ - Plain text format will automatically remove all markdown syntax (bold, links, etc.)
+
+
+
+
|
+
+
+
+
+
+
+
+
+🚀 最快30秒部署的热点助手 —— 告别无效刷屏,只看真正关心的新闻资讯
+
+
+
+
+[](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://work.weixin.qq.com/)
+[](https://weixin.qq.com/)
+[](https://telegram.org/)
+[](#)
+[](https://www.feishu.cn/)
+[](#)
+[](https://github.com/binwiederhier/ntfy)
+[](https://github.com/Finb/Bark)
+[](https://slack.com/)
+
+
+[](https://github.com/sansan0/TrendRadar)
+[](https://sansan0.github.io/TrendRadar)
+[](https://hub.docker.com/r/wantcat/trendradar)
+[](https://modelcontextprotocol.io/)
+
+|
+优化前 +
+ |
+
+优化后 +
+ |
+
+
+ 如上图所示,每一行是一个配置项:
+ - **Name(名称)**:必须使用下方展开内容中列出的固定名称(如 `WEWORK_WEBHOOK_URL`)
+ - **Secret(值)**:填写你从对应平台获取的实际内容(如 Webhook 地址、Token 等)
+
+
+
+ **说明**:
+ - 与企业微信机器人使用相同的 Webhook 地址
+ - 区别在于消息格式:`text` 为纯文本,`markdown` 为富文本(默认)
+ - 纯文本格式会自动去除所有 markdown 语法(粗体、链接等)
+
+
+
+
|
+
+
+
+
+
+- {title_data['time_display']}"
+ if title_data["count"] > 1:
+ result += f" ({title_data['count']}次)"
+
+ return result
+
+ elif platform == "ntfy":
+ if link_url:
+ formatted_title = f"[{cleaned_title}]({link_url})"
+ else:
+ formatted_title = cleaned_title
+
+ title_prefix = "🆕 " if title_data.get("is_new") else ""
+
+ if show_source:
+ result = f"[{title_data['source_name']}] {title_prefix}{formatted_title}"
+ else:
+ result = f"{title_prefix}{formatted_title}"
+
+ if rank_display:
+ result += f" {rank_display}"
+ if title_data["time_display"]:
+ result += f" `- {title_data['time_display']}`"
+ if title_data["count"] > 1:
+ result += f" `({title_data['count']}次)`"
+
+ return result
+
+ elif platform == "html":
+ rank_display = format_rank_display(
+ title_data["ranks"], title_data["rank_threshold"], "html"
+ )
+
+ link_url = title_data["mobile_url"] or title_data["url"]
+
+ escaped_title = html_escape(cleaned_title)
+ escaped_source_name = html_escape(title_data["source_name"])
+
+ if link_url:
+ escaped_url = html_escape(link_url)
+ formatted_title = f'[{escaped_source_name}] {escaped_title}'
+ else:
+ formatted_title = (
+ f'[{escaped_source_name}] {escaped_title}'
+ )
+
+ if rank_display:
+ formatted_title += f" {rank_display}"
+ if title_data["time_display"]:
+ escaped_time = html_escape(title_data["time_display"])
+ formatted_title += f" - {escaped_time}"
+ if title_data["count"] > 1:
+ formatted_title += f" ({title_data['count']}次)"
+
+ if title_data.get("is_new"):
+ formatted_title = f"报告类型: 当日汇总
" + print(f"Telegram消息分为 {len(batches)} 批次发送 [{report_type}]") - # 基本信息 - now = TimeHelper.get_beijing_time() - html += f"总标题数: {total_titles}
" - html += f"生成时间: {now.strftime('%Y-%m-%d %H:%M:%S')}
" + # 逐批发送 + for i, batch_content in enumerate(batches, 1): + batch_size = len(batch_content.encode("utf-8")) + print( + f"发送Telegram第 {i}/{len(batches)} 批次,大小:{batch_size} 字节 [{report_type}]" + ) - # 失败的请求信息 - if failed_ids and len(failed_ids) > 0: - html += """ -| 排名 | -频率词 | -出现次数 | -占比 | -相关标题 | -
|---|---|---|---|---|
| {i} | -{stat['word']} | -{stat['count']} | -{stat['percentage']}% | -{" ".join(stat['titles'])} |
-