Daily News Briefing Skill
Automated daily news briefing system that generates comprehensive tech and financial reports with AI-powered commentary and delivers them via configured messaging channels. Supports dual-search architecture with Baidu API (preferred when configured) and DuckDuckGo fallback (always available, no API key required).
Installation & Configuration
Step 1: Install via ClawHub
Option A: From ClawHub (Published)
CODEBLOCK0
Option B: From Local Directory
CODEBLOCK1
Step 2: Configure Environment Variables (Optional)
Note: The skill has a built-in fallback to DuckDuckGo if no Baidu API key is configured. Baidu API provides better structured data, but DuckDuckGo works perfectly fine without any API keys.
With Baidu API (Recommended for Better Results):
Create a configuration file with your Baidu Search API key:
Option A: System-wide (Recommended for servers)
CODEBLOCK2
Option B: User-specific
CODEBLOCK3
Without API Key (Uses DuckDuckGo):
The skill will automatically use DuckDuckGo web search if no Baidu API key is configured:
CODEBLOCK4
Compare Search Methods:
| Feature | Baidu API | DuckDuckGo |
|---|
| API Key Required | ✅ Yes (75 chars) | ❌ No |
| Result Quality |
🏆 Better structured data | 👍 Good for most use cases |
|
Rate Limits | ⚠️ API quota applies | ✅ None |
|
Setup Time | ~2 mins (get API key) | 0 mins (works out of box) |
|
Content Preview | Full article snippets | Title + URL only |
Recommendation: Start with DuckDuckGo to test quickly, add Baidu API later if you need better content previews.
Step 3: Customize Delivery Settings (Optional)
Edit the delivery script to match your preferences:
CODEBLOCK5
Key settings to modify:
CODEBLOCK6
Step 4: Set Up Cron Job for Automated Delivery
For daily delivery at 9:00 AM:
CODEBLOCK7
Add these lines (adjust paths if needed):
CODEBLOCK8
Custom delivery times:
| Time | Cron Entry (Generate + Deliver) | Use Case |
|---|
| 7:00 AM | INLINECODE0 ...<br>1 7 * * * ... | Early morning briefing |
| 7:30 AM |
30 7 * * * ...
31 7 * * * ... | After system fully up (recommended) |
| 6:00 PM |
0 18 * * * ...
1 18 * * * ... | Evening summary |
Step 5: Test the Setup
Test API Key:
CODEBLOCK9
Generate News Manually:
CODEBLOCK10
Check log: INLINECODE6
Test Delivery:
CODEBLOCK11
Check log: INLINECODE7
Verify Cron is Running:
CODEBLOCK12
Step 6: Customize News Content (Optional)
Modify search queries in generate-briefing.py:
CODEBLOCK13
Adjust article count: Change count=3 to 1-5 articles per category.
Customize AI commentary rules: See references/CONFIGURATION.md for pattern examples.
Components
Scripts
- - generate-briefing.py: Main news generation script. Fetches from 4 categories:
- China Tech News (AI, chips, Huawei, etc.)
- International Tech News (NVIDIA, Apple, Microsoft, etc.)
- China Financial Markets (A-shares, HK stocks)
- International Finance (US stocks, Fed, crypto)
- - deliver-briefing.sh: Delivery wrapper with multiple fallback strategies:
- Method A: Direct OpenClaw CLI message send
- Method B: Python delivery script
- Method C: Create notification file
- - news-deliver-direct.py: Alternative Python-based delivery with headline extraction
References
See references/ for:
- - CONFIGURATION.md: Detailed setup guide and customization options
- APIREFERENCE.md: Baidu API integration details and search query examples
- TEMPLATEEXAMPLES.md: Sample briefing outputs and markdown templates
Customization
Change Delivery Time
Edit crontab lines (format: minute hour day month weekday):
CODEBLOCK14
Modify Search Queries
Edit queries in generate-briefing.py:
CODEBLOCK15
Add Custom Commentary Rules
See references/API_REFERENCE.md for commentary rule patterns.
Troubleshooting
No results from Baidu API:
- - Verify
BAIDU_API_KEY is set and valid (length > 20 chars) - Check
/var/log/daily-news.log for detailed errors
Delivery fails:
- - Check INLINECODE18
- Verify OpenClaw CLI is installed: INLINECODE19
- Confirm target user ID is correct in script config
Wrong headlines extracted:
- - Script supports both Chinese and English headers
- Ensure markdown file has proper structure with
## 🖥️ and ## 📈 sections
Multi-Channel Delivery Configuration
Supported Channels
The skill supports any OpenClaw-configured messaging channel:
| Channel | Target Format | Example Value | Notes |
|---|
| QQBot | INLINECODE22 | INLINECODE23 | Default, for private QQ messages |
| Telegram |
@username or chat ID |
@mychannel or
123456789 | Bot must be added to channel |
|
Discord |
guild-id/channel-id |
1234567890/9876543210 | Bot needs permissions |
|
Slack |
#channel-name or
@user |
#general or
U123456 | Slack app configured |
Configure Channel in Script
Method 1: Environment Variable
CODEBLOCK16
Method 2: Edit deliver-briefing.sh
Find line ~50 and modify:
CODEBLOCK17
Channel-Specific Setup
For Telegram:
- 1. Create a bot via @BotFather
- Add bot to channel/group
- Get chat ID using INLINECODE33
- Set
NEWS_TARGET_USER="@channelname" or numeric ID
For Discord:
- 1. Create application in Discord Developer Portal
- Invite bot to server with proper permissions
- Use format: INLINECODE35
- Test with: INLINECODE36
For QQBot:
- - Ensure QQ Bot is configured in OpenClaw
- Use c2c format for private messages
- Target user ID available from chat metadata
Output Format
Generated briefing includes:
- - Date and timestamp header
- 4 news categories with 3 articles each (customizable)
- AI-powered Jarvis commentary for each article
- Source attribution and read-more links
- File size: typically 10-15KB
Delivery message includes:
- - Preview with first headlines from tech & finance sections
- INLINECODE37 attachment tag for full markdown report
- Footer with next delivery time notice
Logs & Monitoring
| Log File | Location | Purpose |
|---|
| News generation | INLINECODE38 | Search results, article counts, errors |
| Delivery attempts |
/var/log/news-delivery.log | Send status, fallback methods used |
View recent logs:
CODEBLOCK18
Troubleshooting
No results from Baidu API:
- - Verify
BAIDU_API_KEY is set and valid (length > 20 chars) - Check
/var/log/daily-news.log for "Found X results" messages - Test: INLINECODE42
- Fallback: If Baidu API fails, script automatically uses DuckDuckGo (look for "falling back to DuckDuckGo" in logs)
No results from any source:
- - Check network connectivity: INLINECODE43
- Verify firewall isn't blocking outbound HTTP/HTTPS
- Test DuckDuckGo directly: INLINECODE44
- Review
/var/log/daily-news.log for detailed error messages
Delivery fails:
- - Check
/var/log/news-delivery.log for specific error - Verify OpenClaw CLI is installed: INLINECODE47
- Confirm target user/channel ID is correct in script config
- Test manual delivery: INLINECODE48
Wrong headlines extracted:
- - Script supports both Chinese (
## 🖥️ 中国科技新闻) and English headers - Ensure markdown file has proper structure with section markers
- Check log shows file size > 1KB (not empty fallback)
- DuckDuckGo results may have longer titles - this is normal
Cron job not running:
- - Verify cron service: INLINECODE50
- Check crontab entries: INLINECODE51
- Test cron timing: wait for scheduled time or adjust to test immediately
- Check log rotation: old logs may be archived
Check which search method is being used:
CODEBLOCK19
Expected output: 📊 Search method used: baidu or INLINECODE53
Notes
- - Script auto-generates filename with current date: INLINECODE54
- Logs stored in
/var/log/daily-news.log and INLINECODE56 - Fallback content generated if search returns no results (graceful degradation)
- Supports multiple messaging channels via OpenClaw CLI
- All credentials managed via environment variables (no hardcoded secrets)
Version: 1.0
Last Updated: 2026-03-28
Maintained by: Jarvis AI Assistant
每日新闻简报技能
自动化每日新闻简报系统,可生成包含AI评论的综合科技与财经报告,并通过配置的消息渠道进行投递。支持双搜索架构,使用百度API(配置后优先)和DuckDuckGo备用方案(始终可用,无需API密钥)。
安装与配置
步骤1:通过ClawHub安装
选项A:从ClawHub安装(已发布)
bash
搜索并安装
clawhub search daily-news-briefing
clawhub install daily-news-briefing
验证安装
ls ~/.openclaw/skills/daily-news-briefing/
选项B:从本地目录安装
bash
将技能复制到OpenClaw技能目录
cp -r /path/to/daily-news-briefing ~/.openclaw/skills/
验证结构
ls ~/.openclaw/skills/daily-news-briefing/scripts/
步骤2:配置环境变量(可选)
注意:如果未配置百度API密钥,该技能内置了DuckDuckGo备用方案。百度API提供更好的结构化数据,但DuckDuckGo无需任何API密钥即可完美运行。
使用百度API(推荐以获得更好结果):
使用百度搜索API密钥创建配置文件:
选项A:系统级(推荐用于服务器)
bash
创建配置文件
sudo nano /etc/profile.d/daily-news-briefing.sh
添加配置
export BAIDU
APIKEY=bce-v3/ALTAK-your-api-key-here
export NEWS
TARGETUSER=9C12E02D9038B14FCEDCE1B69AAEAB3F # QQ用户ID
export NEWS_CHANNEL=qqbot # qqbot, telegram, discord
重新加载配置
source /etc/profile.d/daily-news-briefing.sh
选项B:用户级
bash
添加到~/.bashrc或~/.zshrc
echo export BAIDU
APIKEY=your-api-key >> ~/.bashrc
echo export NEWS
TARGETUSER=target-user-id >> ~/.bashrc
source ~/.bashrc
无API密钥(使用DuckDuckGo):
如果未配置百度API密钥,技能将自动使用DuckDuckGo网页搜索:
bash
只需设置目标用户和渠道——仅此而已!
export NEWS
TARGETUSER=your-qq-user-id
export NEWS_CHANNEL=qqbot
搜索方法对比:
| 特性 | 百度API | DuckDuckGo |
|---|
| 需要API密钥 | ✅ 是(75个字符) | ❌ 否 |
| 结果质量 |
🏆 更好的结构化数据 | 👍 适用于大多数用例 |
|
速率限制 | ⚠️ 有API配额 | ✅ 无限制 |
|
设置时间 | 约2分钟(获取API密钥) | 0分钟(开箱即用) |
|
内容预览 | 完整文章摘要 | 标题+仅URL |
建议:先用DuckDuckGo快速测试,如果需要更好的内容预览,再添加百度API。
步骤3:自定义投递设置(可选)
编辑投递脚本以匹配您的偏好:
bash
nano ~/.openclaw/skills/daily-news-briefing/scripts/deliver-briefing.sh
需要修改的关键设置:
bash
更改目标用户ID
TARGET_USER=your-qq-user-id # 约第10行
更改投递渠道(--channel参数)
--channel qqbot # QQ机器人(默认)
--channel telegram # Telegram
--channel discord # Discord
步骤4:设置定时任务实现自动投递
每天上午9:00投递:
bash
编辑crontab
crontab -e
添加以下行(根据需要调整路径):
cron
上午9:00生成新闻
0 9
* source /etc/profile && cd ~/.openclaw/skills/daily-news-briefing/scripts && python3 generate-briefing.py >> /var/log/daily-news.log 2>&1
上午9:01投递
1 9
* source /etc/profile && bash ~/.openclaw/skills/daily-news-briefing/scripts/deliver-briefing.sh >> /var/log/news-delivery.log 2>&1
自定义投递时间:
| 时间 | Cron条目(生成+投递) | 使用场景 |
|---|
| 上午7:00 | 0 7 ...<br>1 7 ... | 早间简报 |
| 上午7:30 |
30 7
...
31 7 ... | 系统完全启动后(推荐) |
| 下午6:00 | 0 18
...
1 18 ... | 晚间总结 |
步骤5:测试设置
测试API密钥:
bash
python3 -c from generatebriefing import searchbaidu; print(search_baidu(test, count=1))
手动生成新闻:
bash
cd ~/.openclaw/skills/daily-news-briefing/scripts
python3 generate-briefing.py
检查日志:tail -20 /var/log/daily-news.log
测试投递:
bash
bash deliver-briefing.sh
检查日志:tail -30 /var/log/news-delivery.log
验证Cron是否运行:
bash
检查cron服务
systemctl status cron
查看计划任务
crontab -l
检查上次执行
grep Starting news generation /var/log/daily-news.log | tail -1
步骤6:自定义新闻内容(可选)
修改generate-briefing.py中的搜索查询:
python
约第85-90行,自定义关键词
china
tech = searchbaidu(科技新闻 人工智能 芯片 AI 华为, count=3)
intl
tech = searchbaidu(NVIDIA Broadcom Apple Microsoft AI, count=3)
china
finance = searchbaidu(A 股 上证指数 港股 财经, count=3)
intl
finance = searchbaidu(美股 纳斯达克 道琼斯 比特币, count=3)
调整文章数量: 将count=3改为每类1-5篇文章。
自定义AI评论规则: 参见references/CONFIGURATION.md中的模式示例。
组件
脚本
- - generate-briefing.py:主要新闻生成脚本。从4个类别获取:
- 中国科技新闻(AI、芯片、华为等)
- 国际科技新闻(NVIDIA、Apple、Microsoft等)
- 中国金融市场(A股、港股)
- 国际金融(美股、美联储、加密货币)
- - deliver-briefing.sh:具有多种备用策略的投递封装脚本:
- 方法A:直接OpenClaw CLI消息发送
- 方法B:Python投递脚本
- 方法C:创建通知文件
- - news-deliver-direct.py:基于Python的替代投递方式,包含标题提取
参考文档
参见references/目录:
- - CONFIGURATION.md:详细设置指南和自定义选项
- APIREFERENCE.md:百度API集成详情和搜索查询示例
- TEMPLATEEXAMPLES.md:示例简报输出和Markdown模板
自定义
更改投递时间
编辑crontab行(格式:分钟 小时 日 月 星期):
cron
上午7:30投递
30 7
* ...
31 7
* ...
上午6:00投递
0 6
* ...
1 6
* ...
修改搜索查询
编辑generate-briefing.py中的查询:
python
chinatech = searchbaidu(科技新闻 人工智能 芯片 AI 华为, count=3)
intltech = searchbaidu(NVIDIA Broadcom Apple Microsoft AI, count=3)
添加自定义评论规则
参见references/API_REFERENCE.md中的评论规则模式。
故障排除
百度API无结果:
- - 验证BAIDUAPIKEY已设置且有效(长度>20个字符)
- 检查/var/log/daily-news.log中的详细错误
投递失败:
- - 检查/var/log/news-delivery.log
- 验证OpenClaw CLI已安装:openclaw --version