深夜提醒

现在是深夜,建议您注意休息,不要熬夜哦~

🏮 🏮 🏮

新年快乐

祝君万事如意心想事成!

share-image
中
ESC

Deploying the DailyHot Trending Service with OpenClaw and Automating Content Generation

English 阅读中文版

Preface

In our daily work and study, we often need to keep up with trending topics across major platforms. Browsing multiple platforms by hand is both time-consuming and prone to missing important information. This article will introduce how to use OpenClaw to deploy the DailyHot trending service, automate the collection of trending topics across the web, and configure scheduled tasks to achieve:

  1. 8 AM every day - automatically push trending news from across the web
  2. 10 AM every day - fetch AI news and automatically generate blog articles

Deploying the DailyHot Trending Service with OpenClaw and Automating Content Generation

Project Introduction

What is DailyHot?

DailyHotApi is an API project that aggregates trending data, supporting trending data from 56 platforms, including:

  • Social media: Weibo, Zhihu, Tieba, V2EX, NGA, Hupu
  • Video and live streaming: Bilibili, Douyin, Kuaishou, AcFun, Coolapk
  • News: Baidu, The Paper, 36Kr, Tencent News, NetEase News
  • Tech communities: ITHome, SSPai, Juejin, CSDN
  • Games: Genshin Impact, Miyoushe, Honkai, League of Legends
  • Other: Today in History, weather warnings, earthquake bulletins

What is OpenClaw?

OpenClaw is an AI assistant platform that supports extending functionality through Skills. By configuring scheduled tasks, it enables automated information processing and task execution.

Deployment Process

1. Environment Preparation

First make sure the system has installed:

# Check Docker
docker --version

# Check Python
python3 --version

# Check pip
pip3 --version

2. Configure the Docker Image Source

Due to the domestic network environment, the official Docker source may be inaccessible, so a domestic mirror needs to be configured:

sudo tee /etc/docker/daemon.json << 'EOF'
{
"registry-mirrors": [
"https://docker.1panel.live",
"https://hub.rat.dev",
"https://docker.m.daocloud.io"
]
}
EOF

sudo systemctl daemon-reload
sudo systemctl restart docker

3. Deploy the DailyHotApi Service

# Pull the image
docker pull imsyy/dailyhot-api:latest

# Start the container
docker run -d \
--name dailyhotapi \
-p 6688:6688 \
--restart unless-stopped \
imsyy/dailyhot-api:latest

# Verify the service
curl http://localhost:6688/all

4. Install Python Dependencies

cd ~/openclaw-daily-hot-news

# Install dependencies
pip3 install -r requirements.txt --break-system-packages

# Or use a virtual environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

5. Configure Environment Variables

Create a .env file:

cat > .env << 'EOF'
DAILY_HOT_API_URL=http://localhost:6688
DAILY_HOT_MAX_ITEMS=20
DAILY_HOT_TIMEOUT=10
DAILY_HOT_DATA_DIR=/home/wenjun/openclaw-daily-hot-news/data
DAILY_HOT_AUTO_SAVE=true

# Feishu notification (optional)
FEISHU_WEBHOOK=https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
EOF

Problems Encountered and Solutions

Problem 1: Docker Image Pull Failed

Symptom:

Error response from daemon: failed to resolve reference "docker.io/imsyy/dailyhot-api:latest": 
dial tcp [2a03:2880:f107:83:face:b00c:0:25de]:443: i/o timeout

Solution: Configure a domestic Docker image source, using the docker.1panel.live or hub.rat.dev mirror.

Problem 2: Python Relative Import Error

Symptom:

ImportError: attempted relative import with no known parent package

Solution: Create a standalone CLI entry script cli.py, use absolute imports, and load environment variables at runtime:

# Load environment variables first
env_file = Path(__file__).parent / '.env'
if env_file.exists():
with open(env_file) as f:
for line in f:
if line.strip() and '=' in line:
key, value = line.split('=', 1)
os.environ[key] = value

# Then import other modules
from api_client import api_client

Problem 3: Permission Error

Symptom:

PermissionError: [Errno 13] Permission denied: '/root/.openclaw'

Solution: Modify config.py to change the default data directory to the current working directory:

# Before
self.data_dir = os.getenv("DAILY_HOT_DATA_DIR", "/root/.openclaw/...")

# After
default_data_dir = os.path.join(os.getcwd(), "data")
self.data_dir = os.getenv("DAILY_HOT_DATA_DIR", default_data_dir)

Scheduled Task Configuration

1. Create the Scheduled Task Scripts

Create cron_jobs.py implementing two core functions:

async def fetch_hot_news():
"""Fetch trending news (cross-platform aggregation)"""
platforms = [
('weibo', 'Weibo'),
('zhihu', 'Zhihu'),
('bilibili', 'Bilibili'),
('36kr', '36Kr'),
('baidu', 'Baidu'),
]

all_hot = []
for source_id, name in platforms:
result = await api_client.fetch_hot_list(source_id)
if result and result.get('data'):
for item in result.get('data', [])[:3]:
all_hot.append({
'title': item.get('title', ''),
'platform': name,
'hot': item.get('hot', ''),
})

# Sort by heat
all_hot.sort(key=lambda x: parse_hot_num(x['hot']), reverse=True)
return all_hot[:15]

Function Two: AI News Blog Generation

async def fetch_ai_news():
"""Fetch AI-related news"""
ai_platforms = [
('36kr', '36Kr'),
('ithome', 'ITHome'),
('juejin', 'Juejin'),
]

ai_keywords = ['AI', 'Artificial Intelligence', 'ChatGPT', 'Large Model', 'LLM', 'OpenAI', 'Claude']

ai_news = []
for source_id, name in ai_platforms:
result = await api_client.fetch_hot_list(source_id)
for item in result.get('data', []):
title = item.get('title', '')
if any(kw in title for kw in ai_keywords):
ai_news.append(item)

return ai_news[:10]

2. Configure the OpenClaw Scheduled Tasks

Create a setup_cron.py script:

jobs = {
"version": 1,
"jobs": [
{
"id": "daily_hot_news_morning",
"name": "Daily trending news push",
"schedule": "0 8 * * *",
"command": "python3 cron_jobs.py morning_hot_news",
"enabled": True
},
{
"id": "daily_ai_blog",
"name": "Daily AI news blog generation",
"schedule": "0 10 * * *",
"command": "python3 cron_jobs.py generate_ai_blog",
"enabled": True
}
]
}

3. Feishu Notification Integration

async def send_feishu_notification(title, content):
"""Send a Feishu notification"""
if not FEISHU_WEBHOOK:
return False

message = {
"msg_type": "post",
"content": {
"post": {
"zh_cn": {
"title": title,
"content": [[{"tag": "text", "text": content}]]
}
}
}
}

resp = requests.post(FEISHU_WEBHOOK, json=message, timeout=30)
return resp.json().get('code') == 0

Usage Results

At 8 AM every day, the Feishu group receives a message like this:

🔥 March 4, 2026 Trending News Top 15

📅 March 4, 2026 Web-Wide Trends TOP15

1. [Zhihu] Several provinces propose advancing the construction of "good houses, good communities"... [4340000]
2. [Zhihu] The 2026 National Two Sessions — which topics concern you most?... [3920000]
3. [Bilibili] "Honkai: Star Rail" Sparkle character PV... [22211]
...

💡 Data sources: Weibo, Zhihu, Bilibili, 36Kr, Baidu

Auto-Generated Blog Article

At 10 AM every day, a Markdown article is automatically generated in the blog directory:

---
title: "AI News Digest - March 4, 2026"
date: 2026-03-04 10:00:00
categories: AI News
tags: [AI, Artificial Intelligence, Daily Digest, Auto-generated]
---

## Today's AI Highlights (2026-03-04)

### 1. Claude goes down worldwide, data center explodes...

[View the original article](https://www.36kr.com/p/xxxx)

*Source: 36Kr*

---
*This article was auto-generated by the OpenClaw DailyHot Skill*

Technical Architecture Diagram

┌─────────────────────────────────────────────────────────────┐
│ Scheduled Task Layer │
│ ┌─────────────────┐ ┌─────────────────────┐ │
│ │ 8:00 AM │ │ 10:00 AM │ │
│ │ Trending news │ │ AI news blog │ │
│ │ push │ │ generation │ │
│ └────────┬────────┘ └──────────┬──────────┘ │
└───────────┼────────────────────────────────────┼──────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ DailyHot Skill Layer │
│ (Python + OpenClaw) │
└─────────────────────────────────────────────────────────────┘
│ │
▼ ▼
┌────────────────────────────┐ ┌──────────────────────┐
│ DailyHotApi Service │ │ Blog Publishing │
│ (Docker: dailyhotapi) │ │ Assistant │
│ Port: 6688 │ │ (blog-publisher) │
└────────────────────────────┘ └──────────────────────┘
│ │
▼ ▼
┌────────────────────────────┐ ┌──────────────────────┐
│ 56 platforms' trending │ │ Hexo Blog Site │
│ data │ │ + Cover image gen │
│ - Weibo, Zhihu, Bilibili │ │ + OSS upload │
│ - 36Kr, ITHome, etc. │ │ │
└────────────────────────────┘ └──────────────────────┘

Summary

Through the combination of OpenClaw + DailyHot + Docker, we’ve built a complete automated information workflow:

  1. Information aggregation: one-stop access to trending data from 56 platforms
  2. Smart filtering: automatically filter AI-related news based on keywords
  3. Auto-publishing: generate blog articles with cover images on a schedule
  4. Instant notification: real-time trending pushes via the Feishu bot

This system not only improves the efficiency of information gathering, but also automatically accumulates quality content into the blog, forming a knowledge base. In the future, we could consider integrating more data sources, or using an LLM to intelligently analyze and summarize trending topics.


Tech stack mentioned in this article: Docker, Python 3.12, OpenClaw, aiohttp, requests

文章作者:阿文
文章链接: https://www.awen.me/post/7d3eb770.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 阿文的博客!
本文于 2026-03-04 14:00 发布,已超过半年(226天),请注意甄别内容是否已过期。

评论

0 条评论
😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️
加载中...

留言反馈

😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️