
Weibo Hotspot Analyzer
- 352 installs
- Updated August 5, 2026
- violin86318/weibo-hotspot-analyzer
Helps with ai & agent building tasks.
About
weibo_hotspot_analyzer is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- weibo_hotspot_analyzer
- AI & Agent Building
- AI-coding skill
Weibo Hotspot Analyzer by the numbers
- 352 all-time installs (skills.sh)
- +1 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #2,132 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/violin86318/weibo-hotspot-analyzer --skill weibo_hotspot_analyzerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 352 |
|---|---|
| Last updated | August 5, 2026 |
| Repository | violin86318/weibo-hotspot-analyzer ↗ |
What it does
Helps with ai & agent building tasks.
Files
[技能说明] 自动化分析微博热搜并转化为产品创意的智能助手。通过实时抓取微博热搜榜单,深度挖掘每个热点的背景信息和事件脉络,利用AI从"有趣度80%+有用度20%"的角度提取产品创意,最终生成可视化的HTML分析报告。帮助产品经理、创业者、开发者快速发现市场机会,将热点转化为可执行的产品方案。
[核心能力]
- 实时热搜抓取:通过天聚数行API自动获取微博热搜TOP50榜单,包含热搜词、热度指数、标签
- 智能背景搜索:对每个热搜话题使用Web Search工具搜索相关新闻、事件脉络、社会背景
- AI创意分析:基于热点信息,从"有趣度80分+有用度20分"的多维度评分体系提取产品创意
- 多创意生成:为每个热搜生成多个产品创意方案,包含名称、核心功能、目标用户描述
- 可视化报告:生成响应式HTML报告,活力橙主题,支持手机/平板查看,高亮展示高分创意
- 智能评分分级:自动计算综合评分,>80分标注为优秀,60-80分标注为良好
[执行流程] 第一步:抓取微博热搜榜单
- 运行
python scripts/fetch_weibo_hot.py调用天聚数行API - 获取热搜TOP50数据:热搜词、热度指数、热搜标签
- 解析JSON格式返回结果,验证数据完整性
第二步:深度搜索热点背景
- 对每个热搜词使用Web Search工具搜索相关新闻
- 搜索关键词格式:"<热搜词> 事件 背景 最新进展"
- 收集搜索结果中的关键信息:事件时间线、涉及主体、社会影响、用户讨论热点
第三步:AI分析生成产品创意
- 基于热搜背景信息,分析产品化机会点
- 从以下维度生成多个产品创意(至少3-5个):
- 有趣度分析(80分权重):创意新颖性、话题热度、用户参与度、传播潜力
- 有用度分析(20分权重):实用价值、用户需求强度、市场痛点解决程度
- 为每个创意生成结构化信息:
- 产品名称(简洁易记,体现热点元素)
- 核心功能(3-5个关键功能点)
- 目标用户画像(年龄、兴趣、需求场景)
- 综合评分(有趣度×0.8 + 有用度×0.2)
第四步:生成HTML分析报告
- 读取 templates/report_template.html 模板
- 填充以下内容到模板:
1. 报告头部:生成日期、热搜总数、分析时间 2. 热搜概览:榜单TOP10快速预览 3. 详细分析:每个热搜的完整信息
- 热搜词、热度指数、标签
- 事件脉络(时间线形式)
- 产品创意列表(评分从高到低排序)
- 评分等级标识(优秀>80分、良好60-80分、普通<60分)
4. 创意排行:所有创意按评分降序展示 5. 数据统计:高分创意数量、平均评分、热度分布
- 应用响应式样式和活力橙配色
- 自动创建目录结构并保存文件:
BASE_DIR="/Users/wanglingwei/Movies/violinvault/SynologyDrive/Clipping/19-ClaudeCode/微博热搜"
# 创建 YYYY/MM/ 目录结构
OUTPUT_DIR="${BASE_DIR}/$(date +%Y/%m)"
mkdir -p "${OUTPUT_DIR}"
# 输出文件
OUTPUT_FILE="${OUTPUT_DIR}/$(date +%Y-%m-%d)_weibo_hotspot_report.html"- 输出文件名格式:
<YYYY-MM-DD>_weibo_hotspot_report.html - 完整路径示例:
/Users/wanglingwei/Movies/violinvault/SynologyDrive/Clipping/19-ClaudeCode/微博热搜/2026/01/2026-01-04_weibo_hotspot_report.html
第五步:完成并输出
- 确认HTML文件生成成功
- 确认目录结构已正确创建(年/月文件夹)
- 返回:"✅ 微博热搜产品创意报告已生成"
- 提供完整文件路径(包含年月目录)
- 提示用户可直接在Finder中打开对应目录查看
[注意事项]
- 输出目录结构:报告自动按年月组织到
/Users/wanglingwei/Movies/violinvault/SynologyDrive/Clipping/19-ClaudeCode/微博热搜/YYYY/MM/目录,每月一个文件夹,便于管理和归档 - 目录自动创建:使用
mkdir -p命令自动创建不存在的年月目录,无需手动创建 - 文件覆盖提示:同一天多次运行会覆盖之前的报告,如需保留请手动重命名文件
- API调用限制:天聚数行API有每日调用次数限制(普通会员100次/天),合理控制分析频率
- 搜索深度控制:每个热搜建议搜索3-5条相关新闻,避免过度搜索消耗token
- 评分客观性:AI评分基于信息完整度,如果背景信息不足可能导致评分偏差,可手动调整
- 创意多样性:确保为不同类型的热搜生成差异化创意,避免模板化输出
- HTML文件编码:使用UTF-8编码保存,确保中文正常显示
- 报告更新策略:建议每日分析一次,避免重复分析相同热搜
- Vercel部署:生成的HTML可直接拖拽到Vercel部署,无需额外配置
- 数据时效性:微博热搜每30分钟更新一次,报告生成时间戳很重要
- 敏感内容过滤:如遇违法违规热搜,跳过分析并记录日志
- 评分体系说明:有趣度权重更高(80%),因为热点产品通常依赖话题性和传播力
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from datetime import datetime
# 读取产品创意数据
with open('weibo_ideas_20260104_205541.json', 'r', encoding='utf-8') as f:
hotspots_data = json.load(f)
# 准备数据
report_data = {
"date": datetime.now().strftime('%Y-%m-%d'),
"time": datetime.now().strftime('%H:%M:%S'),
"total_count": len(hotspots_data),
"hotspots": hotspots_data
}
# 统计所有创意
all_ideas = []
for h in hotspots_data:
for idea in h['ideas']:
idea['source_hotword'] = h['hotword']
idea['source_rank'] = h['rank']
all_ideas.append(idea)
# 按评分排序
all_ideas_sorted = sorted(all_ideas, key=lambda x: x['total_score'], reverse=True)
# 生成HTML内容
html_content = f"""<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>微博热搜产品创意分析报告 - {report_data['date']}</title>
<style>
* {{
margin: 0;
padding: 0;
box-sizing: border-box;
}}
body {{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
line-height: 1.6;
}}
.container {{
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
overflow: hidden;
}}
.header {{
background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
color: white;
padding: 40px;
text-align: center;
}}
.header h1 {{
font-size: 2.5em;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}}
.header .meta {{
font-size: 1.1em;
opacity: 0.95;
}}
.stats {{
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
padding: 30px 40px;
background: #f8f9fa;
}}
.stat-card {{
background: white;
padding: 20px;
border-radius: 12px;
text-align: center;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.3s;
}}
.stat-card:hover {{
transform: translateY(-5px);
}}
.stat-card .number {{
font-size: 2em;
font-weight: bold;
color: #FF6B35;
margin-bottom: 5px;
}}
.stat-card .label {{
color: #666;
font-size: 0.9em;
}}
.section {{
padding: 40px;
}}
.section-title {{
font-size: 1.8em;
color: #333;
margin-bottom: 30px;
padding-bottom: 15px;
border-bottom: 3px solid #FF6B35;
}}
.hotspot-item {{
background: #f8f9fa;
border-radius: 12px;
padding: 25px;
margin-bottom: 25px;
border-left: 5px solid #FF6B35;
}}
.hotspot-header {{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}}
.hotspot-rank {{
background: #FF6B35;
color: white;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 1.2em;
}}
.hotword {{
font-size: 1.4em;
font-weight: bold;
color: #333;
flex: 1;
margin-left: 15px;
}}
.hot-info {{
display: flex;
gap: 15px;
color: #666;
font-size: 0.9em;
margin-bottom: 15px;
}}
.tag {{
background: #e9ecef;
padding: 3px 10px;
border-radius: 15px;
font-size: 0.85em;
}}
.tag.new {{
background: #28a745;
color: white;
}}
.tag.hot {{
background: #FF6B35;
color: white;
}}
.background {{
background: white;
padding: 15px;
border-radius: 8px;
margin-bottom: 15px;
color: #555;
line-height: 1.8;
}}
.idea-list {{
display: grid;
gap: 15px;
}}
.idea-card {{
background: white;
border-radius: 10px;
padding: 20px;
border: 2px solid #e9ecef;
transition: all 0.3s;
}}
.idea-card:hover {{
border-color: #FF6B35;
box-shadow: 0 4px 12px rgba(255,107,53,0.2);
}}
.idea-card.excellent {{
border-color: #FFD700;
background: linear-gradient(135deg, #fffdf0 0%, #ffffff 100%);
}}
.idea-header {{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}}
.idea-name {{
font-size: 1.2em;
font-weight: bold;
color: #FF6B35;
}}
.idea-score {{
font-size: 1.5em;
font-weight: bold;
color: #FF6B35;
}}
.idea-score.excellent {{
color: #FFD700;
}}
.idea-score.good {{
color: #28a745;
}}
.idea-features {{
margin: 12px 0;
}}
.idea-features h4 {{
color: #666;
font-size: 0.9em;
margin-bottom: 8px;
}}
.idea-features ul {{
list-style: none;
padding-left: 0;
}}
.idea-features li {{
padding: 6px 0;
padding-left: 20px;
position: relative;
color: #555;
}}
.idea-features li:before {{
content: "✓";
position: absolute;
left: 0;
color: #FF6B35;
font-weight: bold;
}}
.idea-target {{
background: #f8f9fa;
padding: 10px 15px;
border-radius: 6px;
margin-top: 12px;
font-size: 0.9em;
color: #666;
}}
.idea-target strong {{
color: #333;
}}
.ranking {{
padding: 40px;
background: #f8f9fa;
}}
.ranking-item {{
background: white;
padding: 20px;
margin-bottom: 15px;
border-radius: 12px;
display: flex;
align-items: center;
gap: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}}
.ranking-number {{
font-size: 2em;
font-weight: bold;
color: #FF6B35;
min-width: 50px;
}}
.ranking-info {{
flex: 1;
}}
.ranking-name {{
font-size: 1.3em;
font-weight: bold;
color: #333;
margin-bottom: 5px;
}}
.ranking-source {{
color: #666;
font-size: 0.9em;
}}
.ranking-score {{
font-size: 2em;
font-weight: bold;
color: #FF6B35;
}}
.footer {{
background: #333;
color: white;
padding: 30px;
text-align: center;
}}
@media (max-width: 768px) {{
.header h1 {{
font-size: 1.8em;
}}
.section {{
padding: 20px;
}}
.hotspot-header {{
flex-direction: column;
align-items: flex-start;
}}
.hotword {{
margin-left: 0;
margin-top: 10px;
}}
}}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>📊 微博热搜产品创意分析报告</h1>
<div class="meta">
📅 {report_data['date']} | 🕐 {report_data['time']} | 🔥 分析TOP{report_data['total_count']}热搜
</div>
</div>
<div class="stats">
<div class="stat-card">
<div class="number">{report_data['total_count']}</div>
<div class="label">分析热搜数</div>
</div>
<div class="stat-card">
<div class="number">{len(all_ideas)}</div>
<div class="label">生成创意数</div>
</div>
<div class="stat-card">
<div class="number">{len([i for i in all_ideas if i['total_score'] > 80])}</div>
<div class="label">优秀创意(>80分)</div>
</div>
<div class="stat-card">
<div class="number">{sum(i['total_score'] for i in all_ideas) / len(all_ideas):.1f}</div>
<div class="label">平均评分</div>
</div>
</div>
<div class="section">
<h2 class="section-title">🔥 TOP10热搜详细分析</h2>
"""
# 添加每个热搜的详细分析
for hotspot in hotspots_data:
score_class = "excellent" if hotspot['ideas'][0]['total_score'] > 80 else ""
tag_class = ""
if hotspot.get('hot_tag') == '新':
tag_class = "new"
elif hotspot.get('hot_tag') == '沸':
tag_class = "hot"
tag_html = f'<span class="tag {tag_class}">{hotspot["hot_tag"]}</span>' if hotspot.get('hot_tag') else ''
category_html = f'<span class="tag">{hotspot["category"]}</span>'
html_content += f"""
<div class="hotspot-item">
<div class="hotspot-header">
<div class="hotspot-rank">{hotspot['rank']}</div>
<div class="hotword">{hotspot['hotword']}</div>
</div>
<div class="hot-info">
<span>🔥 热度: {hotspot['hotword_num']}</span>
{tag_html}
{category_html}
</div>
<div class="background">
<strong>📝 事件背景:</strong>{hotspot['background']}
</div>
<div class="idea-list">
"""
for idea in hotspot['ideas']:
idea_score_class = "excellent" if idea['total_score'] > 80 else ("good" if idea['total_score'] >= 60 else "")
features_html = "".join(f'<li>{feature}</li>' for feature in idea['features'])
html_content += f"""
<div class="idea-card {idea_score_class}">
<div class="idea-header">
<div class="idea-name">💡 {idea['name']}</div>
<div class="idea-score {idea_score_class}">{idea['total_score']}分</div>
</div>
<div class="idea-features">
<h4>核心功能:</h4>
<ul>
{features_html}
</ul>
</div>
<div class="idea-target">
<strong>👥 目标用户:</strong>{idea['target_users']}
</div>
<div class="idea-target">
<strong>📊 评分分解:</strong>有趣度 {idea['fun_score']}分 × 80% + 有用度 {idea['useful_score']}分 × 20%
</div>
</div>
"""
html_content += """
</div>
</div>
"""
# 添加TOP10创意排行
html_content += """
</div>
<div class="ranking">
<h2 class="section-title">🏆 TOP10产品创意排行</h2>
"""
for i, idea in enumerate(all_ideas_sorted[:10], 1):
score_class = "excellent" if idea['total_score'] > 80 else ("good" if idea['total_score'] >= 60 else "")
html_content += f"""
<div class="ranking-item">
<div class="ranking-number">#{i}</div>
<div class="ranking-info">
<div class="ranking-name">{idea['name']}</div>
<div class="ranking-source">来源: #{idea['source_rank']} {idea['source_hotword']}</div>
</div>
<div class="ranking-score {score_class}">{idea['total_score']}分</div>
</div>
"""
# 添加页脚
html_content += f"""
</div>
<div class="footer">
<p>📊 报告生成时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</p>
<p>💡 本报告由AI自动生成,基于微博热搜实时数据与智能分析</p>
<p style="margin-top: 10px; opacity: 0.7;">Powered by 微博热搜智能分析系统</p>
</div>
</div>
</body>
</html>
"""
# 保存HTML文件
output_filename = f"weibo_hotspot_report_{datetime.now().strftime('%Y-%m-%d')}.html"
with open(output_filename, 'w', encoding='utf-8') as f:
f.write(html_content)
print(f"✅ HTML报告生成成功!")
print(f"📄 文件名: {output_filename}")
print(f"📏 文件大小: {len(html_content)} 字符")
print(f"\n📊 报告包含:")
print(f" • {len(hotspots_data)} 个热搜详细分析")
print(f" • {len(all_ideas)} 个产品创意")
print(f" • TOP10创意排行榜")
print(f"\n💡 提示: 可以直接在浏览器中打开查看")
# 天聚数行 API 密钥
# 获取地址: https://www.tianapi.com/
TIANAPI_KEY=your_tianapi_key_here
# Claude AI API 配置
# 自定义 API 端点
API_ENDPOINT=https://your-api-endpoint.com/v1/chat/completions
API_KEY=your_api_key_here
API_MODEL=claude-sonnet-4-5
# 或者使用官方 Anthropic API
# ANTHROPIC_API_KEY=your_anthropic_api_key_here
name: 微博热搜每日分析
on:
schedule:
# 每天 UTC 02:00 执行 (北京时间 10:00)
- cron: '0 2 * * *'
# 每天 UTC 14:00 执行 (北京时间 22:00)
- cron: '0 14 * * *'
workflow_dispatch: # 支持手动触发
permissions:
contents: write
jobs:
weibo-analysis:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: 设置 Python 环境
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 安装依赖
run: |
python -m pip install --upgrade pip
- name: 抓取微博热搜
env:
TIANAPI_KEY: ${{ secrets.TIANAPI_KEY }}
run: |
python scripts/fetch_weibo_hot.py
- name: Claude AI 分析创意
env:
API_ENDPOINT: ${{ secrets.API_ENDPOINT }}
API_KEY: ${{ secrets.API_KEY }}
API_MODEL: ${{ secrets.API_MODEL }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
python scripts/claude_analysis.py
- name: 生成 HTML 报告
run: |
python scripts/generate_html_report.py
- name: 验证报告并更新 latest
run: |
TODAY=$(date +%Y-%m-%d)
YEAR_MONTH=$(date +%Y/%m)
echo "🔍 查找今天生成的报告文件..."
# 精确查找 generate_html_report.py 生成的今日报告
# 格式: reports/YYYY/MM/YYYY-MM-DD_weibo_hotspot_report.html
REPORT_FILE="reports/${YEAR_MONTH}/${TODAY}_weibo_hotspot_report.html"
if [ -f "$REPORT_FILE" ]; then
echo "✅ 找到今日报告: $REPORT_FILE"
echo "📄 报告标题:"
grep '<title>' "$REPORT_FILE" | head -1
else
echo "❌ 未找到今日报告: $REPORT_FILE"
echo "📂 reports/${YEAR_MONTH}/ 目录内容:"
ls -la "reports/${YEAR_MONTH}/" 2>/dev/null || echo "目录不存在"
exit 1
fi
# 用今日报告更新 latest 副本
cp "$REPORT_FILE" "reports/${YEAR_MONTH}/latest_weibo_hotspot_report.html"
echo "✅ 已更新 latest 副本"
echo "📄 latest 标题:"
grep '<title>' "reports/${YEAR_MONTH}/latest_weibo_hotspot_report.html" | head -1
- name: 更新首页重定向
run: |
YEAR_MONTH=$(date +%Y/%m)
LATEST_PATH="/reports/${YEAR_MONTH}/latest_weibo_hotspot_report.html"
echo "🔄 更新 index.html 中的重定向路径..."
echo "原内容:"
grep 'meta http-equiv="refresh"' index.html || true
# 使用更可靠的 sed 命令
sed -i.bak "s|url=/reports/[0-9]\{4\}/[0-9]\{2\}/latest_weibo_hotspot_report\.html|url=${LATEST_PATH}|g" index.html
sed -i.bak "s|href=\"/reports/[0-9]\{4\}/[0-9]\{2\}/latest_weibo_hotspot_report\.html\"|href=\"${LATEST_PATH}\"|g" index.html
sed -i.bak "s|window\.location\.href = '/reports/[0-9]\{4\}/[0-9]\{2\}/latest_weibo_hotspot_report\.html'|window.location.href = '${LATEST_PATH}'|g" index.html
rm -f index.html.bak
echo "新内容:"
grep 'meta http-equiv="refresh"' index.html || true
echo "✅ 已更新 index.html 重定向到: $LATEST_PATH"
- name: 提交报告
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
echo "📋 检查待提交的文件..."
git status
# 明确添加所有需要提交的文件
git add reports/
git add index.html
echo "📦 待提交的更改:"
git diff --staged --stat
# 只有有更改时才提交
if ! git diff --staged --quiet; then
git commit -m "🤖 自动生成微博热搜报告 $(date +%Y-%m-%d)"
echo "✅ 提交成功"
else
echo "ℹ️ 没有需要提交的更改"
fi
# 推送到主分支触发 Vercel 部署
git push origin main
'EOF'
name: 微博热搜每日分析
on:
schedule:
# 每天 UTC 14:00 执行 (北京时间 22:00)
- cron: '0 14 * * *'
workflow_dispatch: # 支持手动触发
permissions:
contents: write
pages: write
id-token: write
# 并发控制
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
weibo-analysis:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: 设置 Python 环境
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 安装依赖
run: |
python -m pip install --upgrade pip
- name: 抓取微博热搜
env:
TIANAPI_KEY: ${{ secrets.TIANAPI_KEY }}
run: |
python scripts/fetch_weibo_hot.py
- name: Claude AI 分析创意
env:
API_ENDPOINT: ${{ secrets.API_ENDPOINT }}
API_KEY: ${{ secrets.API_KEY }}
API_MODEL: ${{ secrets.API_MODEL }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
python scripts/claude_analysis.py
- name: 生成 HTML 报告
run: |
python scripts/generate_html_report.py
- name: 创建输出目录
run: |
mkdir -p reports/$(date +%Y/%m)
- name: 移动报告到输出目录
run: |
REPORT_FILE=$(ls -t weibo_hotspot_report_*.html 2>/dev/null | head -1)
if [ -n "$REPORT_FILE" ]; then
cp "$REPORT_FILE" "reports/$(date +%Y/%m)/$(date +%Y-%m-%d)_weibo_hotspot_report.html"
echo "✅ 报告已复制到: reports/$(date +%Y/%m)/$(date +%Y-%m-%d)_weibo_hotspot_report.html"
else
echo "❌ 未找到生成的报告文件"
exit 1
fi
- name: 提交报告
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add reports/
git diff --staged --quiet || git commit -m "🤖 自动生成微博热搜报告 $(date +%Y-%m-%d)"
git push
# 部署到 GitHub Pages
- name: 准备 Pages 部署
run: |
mkdir -p pages
# 复制最新报告到 pages 根目录(作为首页)
LATEST_REPORT=$(ls -t reports/*/*/*.html 2>/dev/null | head -1)
if [ -n "$LATEST_REPORT" ]; then
cp "$LATEST_REPORT" pages/index.html
fi
# 复制所有历史报告
cp -r reports/* pages/ 2>/dev/null || true
# 创建列表页
cat > pages/reports.html << 'HTMLEOF'
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>微博热搜产品创意分析报告 - 历史报告</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #FF6B35, #FF8C42);
color: #2D3142;
line-height: 1.6;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
background: white;
padding: 40px;
border-radius: 16px;
margin-bottom: 32px;
text-align: center;
box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}
.header h1 {
font-size: 32px;
margin-bottom: 16px;
color: #FF6B35;
}
.header p {
font-size: 16px;
color: #666;
}
.reports-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
}
.report-card {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.2s;
}
.report-card:hover {
transform: translateY(-4px);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.report-card h3 {
color: #FF6B35;
margin-bottom: 12px;
font-size: 18px;
}
.report-card a {
display: inline-block;
margin-top: 12px;
padding: 8px 16px;
background: #FF6B35;
color: white;
text-decoration: none;
border-radius: 8px;
font-size: 14px;
}
.report-card a:hover {
background: #FF8C42;
}
.footer {
text-align: center;
margin-top: 40px;
color: white;
padding: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🤖 微博热搜产品创意分析报告</h1>
<p>历史报告列表 - 每日自动更新</p>
</div>
<div class="reports-grid">
HTMLEOF
# 列出所有报告
find pages -name "*.html" -type f ! -name "index.html" ! -name "reports.html" | sort -r | head -30 | while read report; do
filename=$(basename "$report" .html)
date=$(echo "$filename" | sed 's/_weibo_hotspot_report//')
cat >> pages/reports.html << HTMLEOF
<div class="report-card">
<h3>📅 $date</h3>
<p>微博热搜产品创意分析报告</p>
<a href="$filename">查看报告 →</a>
</div>
HTMLEOF
done
cat >> pages/reports.html << 'HTMLEOF'
</div>
<div class="footer">
<p>自动生成时间: $(date '+%Y-%m-%d %H:%M:%S')</p>
<p>Powered by Claude AI & GitHub Actions</p>
</div>
</div>
</body>
</html>
HTMLEOF
- name: 上传到 GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: pages
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: weibo-analysis
steps:
- name: 部署到 GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
EOF
echo "✅ Workflow 文件已更新"
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
venv/
env/
ENV/
*.egg-info/
dist/
build/
# 虚拟环境
venv/
ENV/
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# 日志文件
logs/*.log
*.log
# 数据文件(每次生成新的)
weibo_hotspots_*.json
weibo_ideas_*.json
*.json.bak
# 生成的 HTML 报告(在 GitHub Actions 中会提交到 reports/ 目录)
weibo_hotspot_report_*.html
# macOS
.DS_Store
.AppleDouble
.LSOverride
# 临时文件
*.tmp
*.temp
.latest_ideas
# 环境变量文件
.env
.env.local
# 测试文件
test_*.py
*_test.py
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>微博热搜产品创意分析报告 - 2026年1月14日</title>
<style>
:root {
--primary-color: #FF6B35;
--secondary-color: #FF8C42;
--accent-excellent: #FFD23F;
--accent-good: #06A77D;
--bg-color: #FFF8F0;
--text-color: #2D3142;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
padding: 20px;
}
.container { max-width: 1200px; margin: 0 auto; }
.report-header {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: white;
padding: 40px;
border-radius: 16px;
margin-bottom: 32px;
}
.report-header h1 { font-size: 32px; margin-bottom: 16px; }
.meta-info { display: flex; gap: 16px; flex-wrap: wrap; }
.meta-info span {
background: rgba(255,255,255,0.2);
padding: 8px 16px;
border-radius: 20px;
}
h2 {
font-size: 24px;
margin-bottom: 20px;
color: var(--primary-color);
border-left: 4px solid var(--primary-color);
padding-left: 12px;
}
.hotspot-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 16px;
margin-bottom: 32px;
}
.hotspot-card {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.hotspot-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rank {
background: var(--primary-color);
color: white;
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.hotword { font-weight: 600; font-size: 16px; flex: 1; }
.hotness { font-size: 13px; color: #666; }
.tag { background: var(--primary-color); color: white; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.hotspot-detail {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
margin-bottom: 24px;
}
.idea-card {
background: var(--bg-color);
padding: 20px;
border-radius: 12px;
margin-bottom: 16px;
border-left: 5px solid #E0E0E0;
}
.idea-card.excellent { border-left-color: var(--accent-excellent); }
.idea-card.good { border-left-color: var(--accent-good); }
.idea-header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.idea-name { font-size: 18px; font-weight: 600; }
.score { font-size: 20px; font-weight: 700; color: var(--primary-color); }
.badge {
display: inline-block;
padding: 4px 12px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
margin-left: 8px;
}
.badge.excellent { background: var(--accent-excellent); }
.badge.good { background: var(--accent-good); color: white; }
.idea-body p { margin-bottom: 8px; }
.idea-body ul { margin-left: 20px; margin-bottom: 12px; }
.idea-body strong { color: var(--primary-color); }
.statistics {
background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
color: white;
padding: 32px;
border-radius: 16px;
margin-bottom: 32px;
}
.statistics h2 { color: white; border-left-color: white; }
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 24px;
}
.stat-item { text-align: center; padding: 20px; background: rgba(255,255,255,0.1); border-radius: 12px; }
.stat-value { font-size: 36px; font-weight: 700; display: block; }
.stat-label { font-size: 14px; opacity: 0.9; }
.footer { text-align: center; padding: 32px; color: #666; }
</style>
</head>
<body>
<div class="container">
<header class="report-header">
<h1>微博热搜产品创意分析报告</h1>
<div class="meta-info">
<span>生成日期:2026-01-14</span>
<span>热搜总数:10</span>
<span>创意总数:20</span>
</div>
</header>
<h2>📊 热搜TOP10概览</h2>
<div class="hotspot-list">
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">1</span>
<span class="hotword">男子从喉咙痛到进ICU只用1小时</span>
</div>
<div class="hotness">热度:1164309 </div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">2</span>
<span class="hotword">我是证人</span>
</div>
<div class="hotness">热度:电影 867343 <span class="tag">新</span></div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">3</span>
<span class="hotword">14亿多人用电自由是怎么做到的</span>
</div>
<div class="hotness">热度:694408 </div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">4</span>
<span class="hotword">0118周杰伦送双重福利</span>
</div>
<div class="hotness">热度: <span class="tag">新</span></div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">5</span>
<span class="hotword">王鹤棣演唱会</span>
</div>
<div class="hotness">热度:演出 545625 </div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">6</span>
<span class="hotword">家中凌晨进贼女子全程装睡</span>
</div>
<div class="hotness">热度:310587 <span class="tag">火热</span></div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">7</span>
<span class="hotword">毕业11年存350万的5个消费习惯</span>
</div>
<div class="hotness">热度:292692 </div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">8</span>
<span class="hotword">王鹤棣2026DPARTY演唱会</span>
</div>
<div class="hotness">热度: <span class="tag">热</span></div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">9</span>
<span class="hotword">U23国足vs乌兹别克斯坦</span>
</div>
<div class="hotness">热度:243547 </div>
</div>
<div class="hotspot-card">
<div class="hotspot-header">
<span class="rank">10</span>
<span class="hotword">春晚</span>
</div>
<div class="hotness">热度:晚会 241546 </div>
</div>
</div>
<h2>🔍 详细产品创意分析</h2>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">1</span>
<span class="hotword">男子从喉咙痛到进ICU只用1小时</span>
</div>
<p><strong>热度指数:</strong>1164309</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"男子从喉咙痛到进ICU只用1小时"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"男子从喉咙痛到进ICU只用1小时"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"男子从喉咙痛到进ICU只用1小时"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"男子从喉咙痛到进ICU只用1小时"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">2</span>
<span class="hotword">我是证人 [新]</span>
</div>
<p><strong>热度指数:</strong>867343</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"我是证人"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"我是证人"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"我是证人"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"我是证人"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">3</span>
<span class="hotword">14亿多人用电自由是怎么做到的</span>
</div>
<p><strong>热度指数:</strong>694408</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"14亿多人用电自由是怎么做到的"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"14亿多人用电自由是怎么做到的"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"14亿多人用电自由是怎么做到的"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"14亿多人用电自由是怎么做到的"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">4</span>
<span class="hotword">0118周杰伦送双重福利 [新]</span>
</div>
<p><strong>热度指数:</strong>0</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"0118周杰伦送双重福利"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"0118周杰伦送双重福利"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"0118周杰伦送双重福利"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"0118周杰伦送双重福利"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">5</span>
<span class="hotword">王鹤棣演唱会</span>
</div>
<p><strong>热度指数:</strong>545625</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"王鹤棣演唱会"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"王鹤棣演唱会"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"王鹤棣演唱会"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"王鹤棣演唱会"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">6</span>
<span class="hotword">家中凌晨进贼女子全程装睡 [火热]</span>
</div>
<p><strong>热度指数:</strong>310587</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"家中凌晨进贼女子全程装睡"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"家中凌晨进贼女子全程装睡"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"家中凌晨进贼女子全程装睡"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"家中凌晨进贼女子全程装睡"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">7</span>
<span class="hotword">毕业11年存350万的5个消费习惯</span>
</div>
<p><strong>热度指数:</strong>292692</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"毕业11年存350万的5个消费习惯"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"毕业11年存350万的5个消费习惯"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"毕业11年存350万的5个消费习惯"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"毕业11年存350万的5个消费习惯"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">8</span>
<span class="hotword">王鹤棣2026DPARTY演唱会 [热]</span>
</div>
<p><strong>热度指数:</strong>0</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"王鹤棣2026DPARTY演唱会"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"王鹤棣2026DPARTY演唱会"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"王鹤棣2026DPARTY演唱会"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"王鹤棣2026DPARTY演唱会"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">9</span>
<span class="hotword">U23国足vs乌兹别克斯坦</span>
</div>
<p><strong>热度指数:</strong>243547</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"U23国足vs乌兹别克斯坦"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"U23国足vs乌兹别克斯坦"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"U23国足vs乌兹别克斯坦"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"U23国足vs乌兹别克斯坦"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">10</span>
<span class="hotword">春晚</span>
</div>
<p><strong>热度指数:</strong>241546</p>
<div class="product-ideas">
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"春晚"内容创作助手</span>
<span>
<span class="score">70分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>热点素材库</li><li>创作灵感生成</li><li>多格式导出</li><li>一键发布</li></ul>
<p><strong>目标用户:</strong>内容创作者、自媒体</p>
<p><strong>产品描述:</strong>基于"春晚"热点,为创作者提供相关素材和创作灵感,快速生成符合平台调性的内容。</p>
<p><strong>评分:</strong>有趣度 72分 × 80% + 有用度 68分 × 20%</p>
</div>
</div>
<div class="idea-card good">
<div class="idea-header">
<span class="idea-name">"春晚"知识卡片</span>
<span>
<span class="score">65分</span>
<span class="badge good">良好</span>
</span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul><li>关键信息提炼</li><li>视觉化呈现</li><li>知识关联</li><li>收藏复习</li></ul>
<p><strong>目标用户:</strong>学习型用户</p>
<p><strong>产品描述:</strong>将"春晚"相关的核心知识提炼成易读的卡片式内容,方便用户快速了解和分享。</p>
<p><strong>评分:</strong>有趣度 68分 × 80% + 有用度 62分 × 20%</p>
</div>
</div>
</div>
</div>
<div class="statistics">
<h2>📈 数据统计</h2>
<div class="stat-grid">
<div class="stat-item">
<span class="stat-value">20</span>
<span class="stat-label">创意总数</span>
</div>
<div class="stat-item">
<span class="stat-value">0</span>
<span class="stat-label">优秀创意(>80分)</span>
</div>
<div class="stat-item">
<span class="stat-value">20</span>
<span class="stat-label">良好创意(60-80分)</span>
</div>
<div class="stat-item">
<span class="stat-value">67.5</span>
<span class="stat-label">平均评分</span>
</div>
</div>
</div>
<footer class="footer">
<p>本报告由AI自动生成 | 仅供参考 | 微博热搜数据来源:天聚数行API</p>
<p>生成时间:2026-01-17 22:00:01</p>
</footer>
</div>
</body>
</html>
API 调用失败问题分析
🔍 问题摘要
时间: 2026-01-30 04:14 (UTC) Workflow: 微博热搜每日分析 Run ID: 21504150539 状态: ✅ 完成(但所有 AI 分析失败)
❌ 错误信息
❌ 分析失败: API 响应中未找到有效的 JSON 数据影响范围: 所有 10 个热搜话题的 AI 分析都失败
🔎 问题分析
1. API 调用情况
根据日志显示:
- ✅ API 端点可访问:
https://nwcvxulatwfv.sg-members-1.clawcloudrun.com - ✅ 没有 HTTP 错误(401、403、500 等)
- ✅ 环境变量已正确配置(
API_ENDPOINT,API_KEY,API_MODEL) - ❌ 但返回的响应无法解析为有效的 JSON
2. 可能的原因
原因 A:API 返回格式错误(最可能)
Claude 模型返回的内容可能包含:
- 额外的解释文字(在 JSON 之外)
- Markdown 格式的代码块
- 不完整的 JSON 结构
当前代码的解析逻辑(scripts/claude_analysis.py:281-316):
def parse_response(self, content: str) -> List[Dict]:
# 1. 尝试直接解析
try:
data = json.loads(content)
return data.get('ideas', [])
except json.JSONDecodeError:
pass
# 2. 尝试提取 JSON 代码块
json_match = re.search(r'```json\s*(\{[\s\S]*?\})\s*```', content)
if not json_match:
json_match = re.search(r'```\s*(\{[\s\S]*?\})\s*```', content)
if not json_match:
json_match = re.search(r'\{[\s\S]*"ideas"[\s\S]*\}', content)
# 3. 如果都失败,抛出错误
if not json_match:
raise ValueError("API 响应中未找到有效的 JSON 数据")原因 B:API 端点配置问题
可能的配置问题:
- API 端点返回的不是 OpenAI 兼容格式
choices[0].message.content路径不正确- API 需要额外的参数
原因 C:模型名称错误
当前使用的模型:claude-sonnet-4-5
- 可能 API 不支持这个模型名称
- 需要确认正确的模型名称(如
claude-3-5-sonnet-20241022)
原因 D:API 超时或限流
- 虽然没有明确的超时错误
- 但可能返回了空响应或错误页面
🛠️ 调试步骤
步骤 1:使用调试脚本测试 API
运行提供的调试脚本:
export API_ENDPOINT="https://nwcvxulatwfv.sg-members-1.clawcloudrun.com/antigravity/v1/chat/completions"
export API_KEY="your_api_key"
export API_MODEL="claude-sonnet-4-5"
python debug_api.py这将显示:
- API 的原始响应
- JSON 解析结果
- 响应结构
步骤 2:检查 API 端点配置
访问 API 提供商的文档,确认: 1. 正确的端点 URL 2. 支持的模型名称 3. 请求格式要求 4. 响应格式说明
步骤 3:检查 GitHub Secrets
确保以下 Secrets 正确配置:
API_ENDPOINT = https://your-api-endpoint.com/v1/chat/completions
API_KEY = your_actual_api_key
API_MODEL = correct_model_name (可选)💡 解决方案
解决方案 1:改进 JSON 解析逻辑(推荐)
更新 claude_analysis.py 的 parse_response 方法,增加调试输出和更宽松的解析:
def parse_response(self, content: str) -> List[Dict]:
"""解析 API 响应,提取 JSON 数据"""
# 调试:打印原始响应(前 200 字符)
print(f" 📥 API 响应预览: {content[:200]}...")
# 1. 尝试直接解析
try:
data = json.loads(content)
if 'ideas' in data:
return data['ideas']
except json.JSONDecodeError:
pass
# 2. 尝试提取 JSON 代码块(支持多种格式)
patterns = [
r'```json\s*(\{[\s\S]*?\})\s*```', # ```json {...} ```
r'```\s*(\{[\s\S]*?\})\s*```', # ``` {...} ```
r'(\{[\s\S]*?"ideas"[\s\S]*?\})', # 直接查找包含 "ideas" 的 JSON
r'(\{[^{]*?"ideas"[^}]*?\[[^\]]*?\]\s*\})' # 更宽松的匹配
]
for pattern in patterns:
json_match = re.search(pattern, content)
if json_match:
try:
json_str = json_match.group(1)
data = json.loads(json_str)
if 'ideas' in data:
return data['ideas']
except (json.JSONDecodeError, IndexError):
continue
# 3. 如果都失败,打印完整响应并抛出错误
print(f" 📄 完整响应内容:\n{content}")
raise ValueError("API 响应中未找到有效的 JSON 数据")解决方案 2:验证 API 配置
1. 检查 API 端点 URL 是否完整 2. 验证 API Key 是否有效 3. 确认模型名称正确
解决方案 3:切换到官方 Anthropic API
如果自定义 API 不稳定,可以切换到官方 API:
# 在 GitHub Secrets 中配置
ANTHROPIC_API_KEY = sk-ant-xxxxx并使用 scripts/claude_analysis_anthropic.py(如果存在)
解决方案 4:添加重试机制
在 call_api 方法中添加重试逻辑:
def call_api(self, prompt: str, max_retries: int = 3) -> str:
"""调用 API(带重试)"""
for attempt in range(max_retries):
try:
# ... API 调用代码 ...
return result
except Exception as e:
if attempt < max_retries - 1:
print(f" ⚠️ 尝试 {attempt + 1}/{max_retries} 失败,重试中...")
time.sleep(2)
else:
raise📊 历史数据
查看最近成功的运行:
| Run ID | 时间 | 状态 | 备注 |
|---|---|---|---|
| 21482177424 | 18小时前 | ✅ 成功 | 7分40秒 |
| 21465326245 | 1天前 | ✅ 成功 | 7分6秒 |
| 21441919214 | 1天前 | ✅ 成功 | 10分42秒 |
| 21504150539 | 4小时前 | ⚠️ 部分失败 | AI 分析失败 |
观察: 之前的运行都成功了,说明 API 配置本身是正确的,可能是:
- 临时的 API 故障
- 模型响应格式变化
- API 限流
🎯 下一步行动
立即执行:
1. 运行调试脚本:
python debug_api.py2. 查看调试输出,确定问题根源
3. 根据调试结果,选择合适的解决方案
长期改进:
1. 添加更详细的日志输出 2. 实现重试机制 3. 添加 API 健康检查 4. 设置告警通知(API 失败时发送邮件/Slack 消息)
📝 相关文件
scripts/claude_analysis.py- 主要的 AI 分析脚本debug_api.py- API 调试工具(新创建).github/workflows/weibo-daily.yml- GitHub Actions 配置
🔗 相关链接
---
最后更新: 2026-01-30 状态: 🔍 待调试
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
API 调试脚本 - 测试 Claude API 连接和响应
用法:
export API_ENDPOINT="your_api_endpoint"
export API_KEY="your_api_key"
python debug_api.py
"""
import json
import os
import sys
import urllib.request
import urllib.error
def test_api():
"""测试 API 连接"""
endpoint = os.environ.get('API_ENDPOINT')
api_key = os.environ.get('API_KEY')
model = os.environ.get('API_MODEL', 'claude-sonnet-4-5')
if not endpoint or not api_key:
print("❌ 错误: 请设置 API_ENDPOINT 和 API_KEY 环境变量")
sys.exit(1)
print("=" * 60)
print("Claude API 调试工具")
print("=" * 60)
print(f"\n📡 API 端点: {endpoint}")
print(f"🤖 模型: {model}")
print(f"🔑 API Key: {api_key[:10]}...{api_key[-5:]}")
# 简单的测试请求
test_prompt = "请返回一个JSON格式的数据:{\"test\": \"success\", \"message\": \"API正常工作\"}"
payload = {
"model": model,
"messages": [
{"role": "user", "content": test_prompt}
],
"stream": False
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
print(f"\n📤 发送测试请求...")
print(f" Prompt: {test_prompt}")
try:
req = urllib.request.Request(
endpoint,
data=json.dumps(payload).encode('utf-8'),
headers=headers,
method='POST'
)
with urllib.request.urlopen(req, timeout=30) as response:
status = response.status
response_data = response.read().decode('utf-8')
print(f"\n✅ HTTP 状态码: {status}")
print(f"\n📥 原始响应 (前 500 字符):")
print("-" * 60)
print(response_data[:500])
if len(response_data) > 500:
print(f"\n... (还有 {len(response_data) - 500} 个字符)")
print("-" * 60)
# 尝试解析 JSON
try:
result = json.loads(response_data)
print(f"\n✅ JSON 解析成功")
print(f"\n📊 响应结构:")
print(json.dumps(result, indent=2, ensure_ascii=False)[:1000])
# 检查是否有 OpenAI 格式的 choices
if 'choices' in result:
print(f"\n✅ 找到 'choices' 字段")
if len(result['choices']) > 0:
content = result['choices'][0].get('message', {}).get('content', '')
print(f"\n📝 AI 返回内容:")
print("-" * 60)
print(content[:500])
print("-" * 60)
else:
print(f"\n⚠️ 'choices' 数组为空")
else:
print(f"\n❌ 未找到 'choices' 字段")
print(f"\n可用的字段: {list(result.keys())}")
except json.JSONDecodeError as e:
print(f"\n❌ JSON 解析失败: {e}")
print(f"\n这可能是问题所在!API 返回的不是有效的 JSON。")
except urllib.error.HTTPError as e:
error_body = e.read().decode('utf-8')
print(f"\n❌ HTTP 错误 {e.code}")
print(f"\n错误响应:")
print(error_body)
sys.exit(1)
except urllib.error.URLError as e:
print(f"\n❌ 网络错误: {str(e)}")
sys.exit(1)
except Exception as e:
print(f"\n❌ 未知错误: {str(e)}")
import traceback
traceback.print_exc()
sys.exit(1)
print(f"\n" + "=" * 60)
print("✅ 调试完成")
print("=" * 60)
if __name__ == "__main__":
test_api()
GitHub Pages 配置指南
问题诊断
如果你的 GitHub Pages 显示 404 错误,可能的原因:
1. ❌ 仓库是私有的(免费账户不支持) 2. ❌ GitHub Pages 未启用 3. ❌ Pages 构建失败 4. ❌ DNS/CNAME 配置错误
✅ 解决步骤
第一步:确认仓库可见性
- 免费账户:仓库必须是 Public
- 付费账户(GitHub Pro+):可以使用 Private 仓库
检查方式:
gh repo view --json isPrivate如果是 "isPrivate": true 且你是免费账户,需要将仓库改为 Public: 1. Settings → 滚动到底部 "Danger Zone" 2. Change visibility → Change to public
第二步:启用 GitHub Pages
1. 访问:https://github.com/violin86318/weibo-hotspot-analyzer/settings/pages
2. 在 "Build and deployment" 部分:
- Source: 选择
GitHub Actions(重要!) - 不要选择 "Deploy from a branch"
3. 点击保存
第三步:验证 Pages 配置
检查 Pages 是否已启用:
gh api repos/violin86318/weibo-hotspot-analyzer/pages成功响应示例:
{
"url": "https://violin86318.github.io/weibo-hotspot-analyzer/",
"status": "built",
"html_url": "https://violin86318.github.io/weibo-hotspot-analyzer/"
}第四步:手动触发 Workflow
gh workflow run weibo-daily.yml或者在 GitHub 网页上: 1. Actions 标签页 2. 左侧选择 "微博热搜每日分析" 3. 右侧点击 "Run workflow"
第五步:检查部署状态
# 查看最近的运行
gh run list --workflow="weibo-daily.yml" --limit 5
# 查看特定运行的日志
gh run view <RUN_ID> --log确保两个 job 都成功:
- ✅
weibo-analysis- 生成报告 - ✅
deploy- 部署到 Pages
🌐 访问你的网站
配置成功后,你的网站将在以下地址可用:
主域名:https://violin86318.github.io/weibo-hotspot-analyzer/
自定义域名(可选): 如果你配置了 CNAME(如 weibo.violin86318.github.io),确保: 1. CNAME 文件存在于部署的 pages 目录 2. DNS 记录正确配置
📋 快速检查清单
- [ ] 仓库是 Public(或有 GitHub Pro)
- [ ] Settings → Pages 中 Source 设置为 "GitHub Actions"
- [ ] Workflow 至少成功运行过一次
- [ ]
deployjob 显示成功 - [ ] 等待 2-5 分钟让 Pages 完成部署
🔧 常见问题
问题 1:404 Not Found
可能原因:
- Pages 未启用
- 部署失败
- 文件路径不正确
解决: 1. 检查 Actions 标签页是否有错误 2. 确认 pages 目录包含 index.html 3. 重新运行 workflow
问题 2:自定义域名不工作
解决: 1. 确保 CNAME 文件存在 2. 检查 DNS 记录:dig weibo.violin86318.github.io 3. 等待 DNS 传播(最多 24 小时)
问题 3:仓库是私有的
选项 A:改为 Public(免费) 选项 B:升级到 GitHub Pro($4/月) 选项 C:使用 Vercel 托管(免费,支持私有仓库)
📊 Workflow 执行时间
- 定时执行:
- 北京时间 10:00 (UTC 02:00)
- 北京时间 22:00 (UTC 14:00)
- 手动触发:随时可以在 Actions 页面点击 "Run workflow"
🆘 需要帮助?
如果问题仍未解决,检查:
# 查看最新的 workflow 日志
gh run view --log
# 检查 Pages 部署状态
gh api repos/violin86318/weibo-hotspot-analyzer/pages/builds/latest---
最后更新: 2026-01-30
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="0; url=/reports/2026/06/latest_weibo_hotspot_report.html">
<title>微博热搜分析报告 - 跳转中...</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.container {
text-align: center;
color: white;
padding: 2rem;
}
h1 {
font-size: 2rem;
margin-bottom: 1rem;
animation: fadeIn 0.5s ease-in;
}
.spinner {
border: 4px solid rgba(255, 255, 255, 0.3);
border-top: 4px solid white;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
margin: 2rem auto;
}
.link {
margin-top: 2rem;
font-size: 1rem;
opacity: 0.8;
}
.link a {
color: white;
text-decoration: none;
border-bottom: 1px solid white;
transition: opacity 0.3s;
}
.link a:hover {
opacity: 0.7;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(-20px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body>
<div class="container">
<h1>🔥 微博热搜分析报告</h1>
<div class="spinner"></div>
<p>正在跳转到最新报告...</p>
<div class="link">
<p>如果没有自动跳转,请<a href="/reports/2026/06/latest_weibo_hotspot_report.html">点击这里</a></p>
</div>
</div>
<script>
// 备用 JavaScript 重定向
setTimeout(function() {
window.location.href = '/reports/2026/06/latest_weibo_hotspot_report.html';
}, 100);
</script>
</body>
</html>
#!/bin/bash
# 微博热搜分析器 - GitHub Actions 迁移脚本
#
# 功能:
# 1. 复制 skill 到独立目录
# 2. 初始化 Git 仓库
# 3. 创建必要的配置文件
#
# 用法:
# bash migrate_to_github.sh
#
# 版本:v1.0.0 (2026-01-18)
set -e # 遇到错误立即退出
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# 配置
SOURCE_DIR="/Users/wanglingwei/Movies/violinvault/SynologyDrive/Clipping/.claude/skills/weibo_hotspot_analyzer"
TARGET_DIR="/tmp/weibo-hotspot-analyzer"
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}微博热搜分析器 - GitHub 迁移工具${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
# 检查源目录
if [ ! -d "$SOURCE_DIR" ]; then
echo -e "${RED}❌ 错误: 源目录不存在${NC}"
echo "路径: $SOURCE_DIR"
exit 1
fi
echo -e "${GREEN}✓ 源目录确认${NC}"
echo " $SOURCE_DIR"
echo ""
# 询问是否继续
echo -e "${YELLOW}⚠️ 即将创建独立仓库${NC}"
echo " 源目录: $SOURCE_DIR"
echo " 目标目录: $TARGET_DIR"
echo ""
read -p "是否继续?(y/n) " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}取消操作${NC}"
exit 0
fi
# 步骤1: 复制文件
echo -e "${BLUE}[步骤 1/5] 复制项目文件...${NC}"
echo " 清理目标目录..."
rm -rf "$TARGET_DIR"
echo " 复制文件..."
cp -r "$SOURCE_DIR" "$TARGET_DIR"
echo -e "${GREEN}✓ 文件复制完成${NC}"
echo ""
# 步骤2: 重命名脚本文件
echo -e "${BLUE}[步骤 2/5] 更新脚本文件...${NC}"
cd "$TARGET_DIR/scripts"
# 备份原文件
if [ -f "fetch_weibo_hot.py" ]; then
mv fetch_weibo_hot.py fetch_weibo_hot_legacy.py
fi
if [ -f "generate_html_report.py" ]; then
mv generate_html_report.py generate_html_report_legacy.py
fi
# 使用 v2 版本
if [ -f "fetch_weibo_hot_v2.py" ]; then
mv fetch_weibo_hot_v2.py fetch_weibo_hot.py
echo " ✓ fetch_weibo_hot.py 已更新"
fi
if [ -f "generate_html_report_v2.py" ]; then
mv generate_html_report_v2.py generate_html_report.py
echo " ✓ generate_html_report.py 已更新"
fi
echo -e "${GREEN}✓ 脚本文件更新完成${NC}"
echo ""
# 步骤3: 创建 GitHub 配置
echo -e "${BLUE}[步骤 3/5] 创建 GitHub Actions 配置...${NC}"
cd "$TARGET_DIR"
# 创建 .github/workflows 目录
mkdir -p .github/workflows
# 如果 workflow 文件不存在,从备份复制
if [ ! -f ".github/workflows/weibo-daily.yml" ]; then
echo " ⚠️ 警告: weibo-daily.yml 不存在,请手动创建"
echo " 位置: .github/workflows/weibo-daily.yml"
else
echo " ✓ GitHub Actions workflow 已存在"
fi
echo -e "${GREEN}✓ GitHub 配置准备完成${NC}"
echo ""
# 步骤4: 初始化 Git
echo -e "${BLUE}[步骤 4/5] 初始化 Git 仓库...${NC}"
# 检查是否已经是 Git 仓库
if [ -d ".git" ]; then
echo " ⚠️ 目录已经是 Git 仓库,跳过初始化"
else
git init
echo " ✓ Git 仓库初始化完成"
fi
# 检查 .gitignore
if [ ! -f ".gitignore" ]; then
echo " ⚠️ .gitignore 不存在,请手动创建"
else
echo " ✓ .gitignore 已存在"
fi
echo -e "${GREEN}✓ Git 初始化完成${NC}"
echo ""
# 步骤5: 创建迁移文档
echo -e "${BLUE}[步骤 5/5] 创建迁移指南...${NC}"
cat > MIGRATION_GUIDE.md << 'EOF'
# GitHub Actions 迁移指南
本文档指导如何将微博热搜分析器迁移到 GitHub Actions。
## 前置准备
### 1. 创建 GitHub 仓库
```bash
# 在 GitHub 上创建新仓库: weibo-hotspot-analyzer
# 访问: https://github.com/new
```
### 2. 配置 GitHub Secrets
在仓库页面设置以下 Secrets:
**路径**: Settings → Secrets and variables → Actions
| Secret 名称 | 值 | 获取方式 |
|------------|---|---------|
| `TIANAPI_KEY` | `your-tianapi-key` | [tianapi.com](https://www.tianapi.com/) |
| `ANTHROPIC_API_KEY` | `sk-ant-xxx` | [console.anthropic.com](https://console.anthropic.com/) |
### 3. 推送代码到 GitHub
```bash
cd /tmp/weibo-hotspot-analyzer
# 添加远程仓库
git remote add origin https://github.com/YOUR_USERNAME/weibo-hotspot-analyzer.git
# 提交代码
git add .
git commit -m "Initial commit: 微博热搜分析器"
# 推送
git branch -M main
git push -u origin main
```
### 4. 测试 Workflow
1. 访问 Actions 页面: `https://github.com/YOUR_USERNAME/weibo-hotspot-analyzer/actions`
2. 点击 "weibo-daily" workflow
3. 点击 "Run workflow" 按钮手动触发
4. 查看执行日志
### 5. 查看生成的报告
报告会保存在仓库的 `reports/YYYY/MM/` 目录下。
## 目录结构
```
weibo-hotspot-analyzer/
├── .github/
│ └── workflows/
│ └── weibo-daily.yml # GitHub Actions 配置
├── scripts/
│ ├── fetch_weibo_hot.py # 热搜抓取 (v2)
│ ├── claude_analysis.py # Claude 分析 (新增)
│ └── generate_html_report.py # 报告生成 (v2)
├── reports/ # 生成的报告
│ └── 2026/01/
│ └── 2026-01-18_weibo_hotspot_report.html
├── .gitignore
├── requirements.txt
└── README_GITHUB.md
```
## 本地测试
在推送前,可以先本地测试:
```bash
# 安装依赖
pip install -r requirements.txt
# 设置环境变量
export TIANAPI_KEY='your-key'
export ANTHROPIC_API_KEY='your-key'
# 运行测试
python scripts/fetch_weibo_hot.py
python scripts/claude_analysis.py
python scripts/generate_html_report.py
```
## 常见问题
### Q1: Workflow 执行失败?
**A**: 检查以下几点:
1. Secrets 是否正确配置
2. 脚本是否有执行权限
3. Python 版本是否兼容
4. 查看日志中的具体错误信息
### Q2: 如何修改执行时间?
**A**: 编辑 `.github/workflows/weibo-daily.yml`:
```yaml
schedule:
# 每天 UTC 14:00 (北京时间 22:00)
- cron: '0 14 * * *'
```
### Q3: 如何停止自动执行?
**A**: 有两种方法:
1. 删除或禁用 workflow 文件
2. 在 workflow 文件中注释掉 `schedule` 部分
## 成本估算
| 服务 | 免费额度 | 预计成本 |
|-----|---------|---------|
| GitHub Actions | 2000分钟/月 | 免费 |
| 天聚数行 API | 100次/天 | 免费 |
| Claude API | - | $2-5/月 |
**总计**: 约 $2-5/月
## 下一步
1. ✅ 推送代码到 GitHub
2. ✅ 配置 Secrets
3. ✅ 测试 Workflow
4. ✅ 查看生成的报告
5. ✅ 根据需要调整配置
---
**生成时间**: 2026-01-18
**版本**: v1.0.0
EOF
echo " ✓ 迁移指南已创建: MIGRATION_GUIDE.md"
echo -e "${GREEN}✓ 迁移指南创建完成${NC}"
echo ""
# 完成
echo -e "${BLUE}========================================${NC}"
echo -e "${GREEN}✅ 迁移准备完成!${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
echo "📁 目标目录: $TARGET_DIR"
echo ""
echo -e "${YELLOW}下一步操作:${NC}"
echo " 1. 检查文件: cd $TARGET_DIR"
echo " 2. 查看指南: cat MIGRATION_GUIDE.md"
echo " 3. 创建 GitHub 仓库"
echo " 4. 配置 GitHub Secrets"
echo " 5. 推送代码"
echo ""
echo -e "${BLUE}详细说明请查看: ${NC}MIGRATION_GUIDE.md"
echo ""
GitHub Actions 迁移指南
本文档指导如何将微博热搜分析器迁移到 GitHub Actions。
前置准备
1. 创建 GitHub 仓库
# 在 GitHub 上创建新仓库: weibo-hotspot-analyzer
# 访问: https://github.com/new2. 配置 GitHub Secrets
在仓库页面设置以下 Secrets:
路径: Settings → Secrets and variables → Actions
| Secret 名称 | 值 | 获取方式 |
|---|---|---|
TIANAPI_KEY | your-tianapi-key | tianapi.com |
ANTHROPIC_API_KEY | sk-ant-xxx | console.anthropic.com |
3. 推送代码到 GitHub
cd /tmp/weibo-hotspot-analyzer
# 添加远程仓库
git remote add origin https://github.com/YOUR_USERNAME/weibo-hotspot-analyzer.git
# 提交代码
git add .
git commit -m "Initial commit: 微博热搜分析器"
# 推送
git branch -M main
git push -u origin main4. 测试 Workflow
1. 访问 Actions 页面: https://github.com/YOUR_USERNAME/weibo-hotspot-analyzer/actions 2. 点击 "weibo-daily" workflow 3. 点击 "Run workflow" 按钮手动触发 4. 查看执行日志
5. 查看生成的报告
报告会保存在仓库的 reports/YYYY/MM/ 目录下。
目录结构
weibo-hotspot-analyzer/
├── .github/
│ └── workflows/
│ └── weibo-daily.yml # GitHub Actions 配置
├── scripts/
│ ├── fetch_weibo_hot.py # 热搜抓取 (v2)
│ ├── claude_analysis.py # Claude 分析 (新增)
│ └── generate_html_report.py # 报告生成 (v2)
├── reports/ # 生成的报告
│ └── 2026/01/
│ └── 2026-01-18_weibo_hotspot_report.html
├── .gitignore
├── requirements.txt
└── README_GITHUB.md本地测试
在推送前,可以先本地测试:
# 安装依赖
pip install -r requirements.txt
# 设置环境变量
export TIANAPI_KEY='your-key'
export ANTHROPIC_API_KEY='your-key'
# 运行测试
python scripts/fetch_weibo_hot.py
python scripts/claude_analysis.py
python scripts/generate_html_report.py常见问题
Q1: Workflow 执行失败?
A: 检查以下几点: 1. Secrets 是否正确配置 2. 脚本是否有执行权限 3. Python 版本是否兼容 4. 查看日志中的具体错误信息
Q2: 如何修改执行时间?
A: 编辑 .github/workflows/weibo-daily.yml:
schedule:
# 每天 UTC 14:00 (北京时间 22:00)
- cron: '0 14 * * *'Q3: 如何停止自动执行?
A: 有两种方法: 1. 删除或禁用 workflow 文件 2. 在 workflow 文件中注释掉 schedule 部分
成本估算
| 服务 | 免费额度 | 预计成本 |
|---|---|---|
| GitHub Actions | 2000分钟/月 | 免费 |
| 天聚数行 API | 100次/天 | 免费 |
| Claude API | - | $2-5/月 |
总计: 约 $2-5/月
下一步
1. ✅ 推送代码到 GitHub 2. ✅ 配置 Secrets 3. ✅ 测试 Workflow 4. ✅ 查看生成的报告 5. ✅ 根据需要调整配置
---
生成时间: 2026-01-18 版本: v1.0.0
📦 GitHub Actions 迁移 - 项目文件清单
🎯 已创建的文件
1. GitHub Actions 配置
`.github/workflows/weibo-daily.yml`
- GitHub Actions workflow 配置
- 每天 22:00 (北京时间) 自动执行
- 包含 6 个步骤:检出、设置环境、抓取热搜、Claude 分析、生成报告、提交代码
2. 核心脚本
`scripts/claude_analysis.py` ⭐ 新增
- 使用 Claude API 分析热搜创意
- 支持批量分析 TOP10 热搜
- 自动生成 3 个创意/热搜
- 输出结构化 JSON 数据
`scripts/fetch_weibo_hot_v2.py` ⭐ 升级
- 支持环境变量
TIANAPI_KEY - 改进错误处理
- 自动保存最新文件名标记
`scripts/generate_html_report_v2.py` ⭐ 升级
- 适配 Claude 生成的创意数据
- 响应式设计
- 美化的样式和布局
- 支持统计和排行榜
3. 配置文件
`.gitignore`
- Python 缓存和虚拟环境
- 日志文件
- 临时数据文件
- macOS 系统文件
`requirements.txt`
- anthropic >= 0.18.0
4. 文档
`README_GITHUB.md`
- GitHub 仓库说明文档
- 功能介绍和使用方法
- GitHub Actions 配置说明
`MIGRATION_GUIDE.md`
- 详细迁移步骤
- 常见问题解答
- 成本估算
`QUICKSTART.md` ⭐ 推荐
- 6 步快速开始指南
- 验证清单
- 相关文档链接
`migrate_to_github.sh`
- 自动化迁移脚本
- 一键完成所有准备工作
---
🔑 GitHub Secrets 配置清单
必需的 Secrets
| Secret 名称 | 说明 | 示例值 | 来源 |
|---|---|---|---|
TIANAPI_KEY | 天聚数行 API 密钥 | <your_tianapi_key> | tianapi.com |
ANTHROPIC_API_KEY | Claude API 密钥 | sk-ant-xxxxxx... | console.anthropic.com |
可选的 Secrets
| Secret 名称 | 说明 | 用途 |
|---|---|---|
SLACK_WEBHOOK | Slack 通知 Webhook | 发送执行完成通知 |
EMAIL_NOTIFICATION | 邮件地址 | 发送报告到邮箱 |
---
📁 目录结构对比
原始结构(本地 Skill)
.claude/skills/weibo_hotspot_analyzer/
├── scripts/
│ ├── fetch_weibo_hot.py ← 原版
│ ├── generate_html_report.py ← 原版
│ └── daily_weibo_analysis.sh ← 本地定时脚本
├── templates/
├── logs/
├── SKILL.md
└── README.md迁移后结构(GitHub 仓库)
weibo-hotspot-analyzer/ # 独立 GitHub 仓库
├── .github/
│ └── workflows/
│ └── weibo-daily.yml ← 新增
├── scripts/
│ ├── fetch_weibo_hot.py ← v2 版本(支持环境变量)
│ ├── claude_analysis.py ← 新增
│ └── generate_html_report.py ← v2 版本(适配 Claude 数据)
├── templates/
├── reports/ ← 新增(GitHub Actions 生成)
│ └── 2026/01/
│ └── 2026-01-18_weibo_hotspot_report.html
├── .gitignore ← 新增
├── requirements.txt ← 新增
├── README_GITHUB.md ← 新增
├── QUICKSTART.md ← 新增
└── MIGRATION_GUIDE.md ← 新增---
🔄 数据流程图
┌─────────────────────────────────────────────────────────────┐
│ GitHub Actions 触发 │
│ (每天 22:00 或手动触发) │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Step 1: 抓取微博热搜 │
│ - 调用天聚数行 API │
│ - 获取 TOP50 热搜 │
│ - 保存为 weibo_hotspots_YYYYMMDD_HHMMSS.json │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Step 2: Claude AI 分析创意 │
│ - 读取热搜数据 │
│ - 调用 Claude API (3-5-sonnet) │
│ - 为每个热搜生成 3 个创意 │
│ - 保存为 weibo_ideas_YYYYMMDD_HHMMSS.json │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Step 3: 生成 HTML 报告 │
│ - 读取创意数据 │
│ - 生成响应式 HTML │
│ - 包含概览、详情、排行榜、统计 │
│ - 保存为 weibo_hotspot_report_YYYYMMDD_HHMMSS.html │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Step 4: 提交到 GitHub │
│ - 创建 reports/YYYY/MM/ 目录 │
│ - 移动 HTML 文件到报告目录 │
│ - git commit && git push │
└──────────────────────┬──────────────────────────────────────┘
│
▼
✅ 完成
可在 GitHub 上查看报告---
💰 成本估算
免费额度
| 服务 | 免费额度 | 实际使用 |
|---|---|---|
| GitHub Actions | 2000 分钟/月 | ~30 分钟/月 ✅ |
| 天聚数行 API | 100 次/天 | 1 次/天 ✅ |
付费服务
| 服务 | 预计用量 | 月成本 |
|---|---|---|
| Claude API | ~300K tokens/天 | $2-5/月 |
| 总计 | - | $2-5/月 |
节省成本
相比本地运行:
- ✅ 无需服务器费用
- ✅ 无需电费
- ✅ 无需维护
- ✅ 自动备份到 Git
---
📊 执行时间统计
| 步骤 | 预计耗时 | 说明 |
|---|---|---|
| 环境设置 | ~30s | 安装依赖 |
| 抓取热搜 | ~5s | API 调用 |
| Claude 分析 | ~3-5min | 10个热搜 × ~20s/个 |
| 生成报告 | ~2s | HTML 生成 |
| Git 提交 | ~10s | Push 到仓库 |
| 总计 | ~4-6分钟 | 每天 1 次 |
---
✅ 下一步操作
方式 A: 使用迁移脚本(推荐)
cd /Users/wanglingwei/Movies/violinvault/SynologyDrive/Clipping/.claude/skills/weibo_hotspot_analyzer
bash migrate_to_github.sh脚本会自动完成所有准备工作。
方式 B: 手动迁移
1. 创建 GitHub 仓库 2. 复制相关文件到新目录 3. 配置 GitHub Secrets 4. 推送代码 5. 测试 Workflow
详细步骤见 MIGRATION_GUIDE.md
---
🎓 学习资源
Claude Agent SDK
- 官方文档: https://docs.anthropic.com/
- API 参考: https://docs.anthropic.com/api-reference
- Python SDK: https://github.com/anthropics/anthropic-sdk-python
GitHub Actions
- 官方文档: https://docs.github.com/en/actions
- Workflow 语法: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
- Secrets 管理: https://docs.github.com/en/actions/security-guides/encrypted-secrets
---
📞 支持与反馈
如有问题,请: 1. 查看 MIGRATION_GUIDE.md 的常见问题部分 2. 检查 GitHub Actions 执行日志 3. 提交 Issue 到 GitHub 仓库
---
生成时间: 2026-01-18 版本: v1.0.0 作者: Claude Code
🚀 GitHub Actions 迁移 - 快速开始
📋 前置准备
1️⃣ 运行迁移脚本
cd /Users/wanglingwei/Movies/violinvault/SynologyDrive/Clipping/.claude/skills/weibo_hotspot_analyzer
bash migrate_to_github.sh脚本会:
- ✅ 复制项目到
/tmp/weibo-hotspot-analyzer - ✅ 更新脚本文件到 v2 版本
- ✅ 创建 GitHub Actions 配置
- ✅ 初始化 Git 仓库
- ✅ 生成迁移指南
2️⃣ 创建 GitHub 仓库
访问 https://github.com/new 创建新仓库:
- 仓库名:
weibo-hotspot-analyzer - 可见性: Public 或 Private
- 不要初始化 README(因为我们已有代码)
3️⃣ 配置 GitHub Secrets
在新建的仓库中配置 Secrets:
路径: Settings → Secrets and variables → Actions → New repository secret
Secret 1: TIANAPI_KEY
名称: TIANAPI_KEY
值: <你的天聚数行 API 密钥>⚠️ 安全提示:使用你自己的 API 密钥,不要使用示例中的密钥。 获取地址:https://www.tianapi.com/
Secret 2: ANTHROPIC_API_KEY
名称: ANTHROPIC_API_KEY
值: sk-ant-xxxxxx...获取 Claude API Key: https://console.anthropic.com/
4️⃣ 推送代码到 GitHub
# 进入迁移后的目录
cd /tmp/weibo-hotspot-analyzer
# 添加远程仓库(替换 YOUR_USERNAME)
git remote add origin https://github.com/YOUR_USERNAME/weibo-hotspot-analyzer.git
# 提交所有文件
git add .
git commit -m "Initial commit: 微博热搜分析器 with GitHub Actions"
# 推送到 GitHub
git branch -M main
git push -u origin main5️⃣ 测试 Workflow
1. 访问 Actions 页面:
https://github.com/YOUR_USERNAME/weibo-hotspot-analyzer/actions2. 点击左侧的 weibo-daily workflow
3. 点击右侧的 Run workflow 按钮
4. 选择分支,点击绿色的 Run workflow 确认
5. 等待执行完成,查看日志
6️⃣ 查看生成的报告
成功后,在仓库的 reports 目录查看报告:
reports/2026/01/2026-01-18_weibo_hotspot_report.html可以直接在 GitHub 上预览 HTML 文件!
---
🔧 手动配置(可选)
如果你想手动创建文件而不是使用迁移脚本:
文件清单
| 文件路径 | 说明 |
|---|---|
.github/workflows/weibo-daily.yml | GitHub Actions 配置 |
scripts/claude_analysis.py | Claude AI 分析脚本 |
scripts/fetch_weibo_hot_v2.py | 热搜抓取脚本 v2 |
scripts/generate_html_report_v2.py | 报告生成脚本 v2 |
.gitignore | Git 忽略规则 |
requirements.txt | Python 依赖 |
README_GITHUB.md | GitHub 仓库说明 |
MIGRATION_GUIDE.md | 详细迁移指南 |
文件结构
weibo-hotspot-analyzer/
├── .github/
│ └── workflows/
│ └── weibo-daily.yml ← GitHub Actions 配置
├── scripts/
│ ├── fetch_weibo_hot.py ← 使用 v2 版本
│ ├── claude_analysis.py ← 新增
│ └── generate_html_report.py ← 使用 v2 版本
├── reports/ ← GitHub Actions 自动生成
│ └── 2026/01/
├── templates/
│ └── report_template.html
├── .gitignore
├── requirements.txt
├── README_GITHUB.md
└── MIGRATION_GUIDE.md---
📊 执行时间说明
默认配置: 每天北京时间 22:00 自动执行
修改执行时间,编辑 .github/workflows/weibo-daily.yml:
schedule:
# 每天 UTC 14:00 (北京时间 22:00)
- cron: '0 14 * * *'
# 其他示例:
# - cron: '0 6 * * *' # 北京时间 14:00
# - cron: '0 2 * * *' # 北京时间 10:00
# - cron: '0 */6 * * *' # 每6小时一次Cron 格式:分 时 日 月 周
---
✅ 验证清单
迁移完成后,检查以下项目:
- [ ] GitHub 仓库已创建
- [ ] 代码已推送到 GitHub
- [ ] TIANAPI_KEY 已配置
- [ ] ANTHROPIC_API_KEY 已配置
- [ ] Workflow 手动执行成功
- [ ] 报告已生成到 reports 目录
- [ ] 可以在 GitHub 上预览 HTML 报告
---
🎉 完成!
现在你的微博热搜分析器已经完全自动化了!
每天 22:00,GitHub Actions 会自动: 1. 抓取微博热搜数据 2. 调用 Claude 分析创意 3. 生成 HTML 报告 4. 提交到 Git 仓库
你可以随时访问 GitHub 仓库查看最新报告!
---
📝 相关文档
- 详细迁移指南
- GitHub 仓库说明
- Claude API 文档
- 天聚数行 API 文档
---
生成时间: 2026-01-18 版本: v1.0.0
微博热搜产品创意分析器

功能概述
这是一个自动化的微博热搜分析工具,能够:
- 🔥 实时抓取:通过天聚数行 API 获取微博热搜 TOP50
- 🤖 AI 分析:利用 Claude API 生成产品创意
- 📊 可视化报告:生成精美的 HTML 分析报告
- ⏰ 自动化执行:每天定时运行并提交到 GitHub
技术栈
- Python 3.11+
- Anthropic Claude API (AI 分析)
- 天聚数行 API (微博热搜数据)
- GitHub Actions (自动化 CI/CD)
快速开始
1. 克隆仓库
git clone https://github.com/YOUR_USERNAME/weibo-hotspot-analyzer.git
cd weibo-hotspot-analyzer2. 安装依赖
pip install -r requirements.txt或手动安装:
pip install anthropic3. 配置环境变量
创建 .env 文件:
# 天聚数行 API 密钥
TIANAPI_KEY=your_api_key_here
# Claude API 密钥
ANTHROPIC_API_KEY=sk-ant-your_key_here4. 运行分析
# 抓取热搜数据
python scripts/fetch_weibo_hot.py
# Claude AI 分析
python scripts/claude_analysis.py
# 生成 HTML 报告
python scripts/generate_html_report.pyGitHub Actions 自动化
配置 Secrets
在 GitHub 仓库设置中添加以下 Secrets:
1. 访问 Settings → Secrets and variables → Actions 2. 添加以下 secrets:
| Secret 名称 | 说明 | 获取方式 |
|---|---|---|
TIANAPI_KEY | 天聚数行 API 密钥 | tianapi.com |
ANTHROPIC_API_KEY | Claude API 密钥 | console.anthropic.com |
执行时间
- 默认时间:每天 22:00 (北京时间)
- 手动触发:在 Actions 页面点击 "Run workflow"
查看报告
生成的报告会保存在 reports/YYYY/MM/ 目录下。
例如:reports/2026/01/2026-01-18_weibo_hotspot_report.html
项目结构
weibo-hotspot-analyzer/
├── .github/
│ └── workflows/
│ └── weibo-daily.yml # GitHub Actions 配置
├── scripts/
│ ├── fetch_weibo_hot.py # 热搜数据抓取
│ ├── claude_analysis.py # Claude AI 分析
│ └── generate_html_report.py # HTML 报告生成
├── templates/
│ └── report_template.html # 报告模板
├── reports/ # 生成的报告
│ └── 2026/01/
│ └── 2026-01-18_weibo_hotspot_report.html
├── logs/ # 日志文件
├── .gitignore
├── README.md
└── requirements.txt评分体系
产品创意采用有趣度 80% + 有用度 20% 的评分标准:
有趣度 (80%)
- 创意新颖性 (25分)
- 话题热度 (25分)
- 用户参与度 (20分)
- 传播潜力 (30分)
有用度 (20%)
- 实用价值 (8分)
- 需求强度 (7分)
- 市场痛点 (5分)
等级划分
- 优秀 (>80分):金黄色,高有趣度+高实用价值
- 良好 (60-80分):绿色,有潜力可考虑
- 普通 (<60分):灰色,需要优化
本地开发
安装 Python 虚拟环境
python -m venv venv
source venv/bin/activate # macOS/Linux
# 或
venv\Scripts\activate # Windows运行测试
# 测试热搜抓取
python scripts/fetch_weibo_hot.py
# 测试 Claude 分析(需要 API Key)
export ANTHROPIC_API_KEY='your-key'
python scripts/claude_analysis.pyAPI 限制
| 服务 | 免费额度 | 付费方案 |
|---|---|---|
| 天聚数行 | 100次/天 | ¥20-65/月 |
| Claude API | 按 token 计费 | 约 $2-5/月 |
| GitHub Actions | 2000分钟/月 | 付费套餐 |
常见问题
Q1: Claude API 调用失败?
A: 检查以下几点: 1. API 密钥是否正确 2. 账户是否有足够额度 3. 网络连接是否正常 4. 模型名称是否正确
Q2: 报告没有生成?
A: 1. 检查 GitHub Actions 日志 2. 确认所有步骤都成功执行 3. 查看是否有错误信息
Q3: 如何调整执行时间?
A: 修改 .github/workflows/weibo-daily.yml 中的 cron 表达式:
schedule:
# 每天 UTC 时间 14:00 (北京时间 22:00)
- cron: '0 14 * * *'Cron 格式:分 时 日 月 周
贡献指南
欢迎提交 Issue 和 Pull Request!
许可证
MIT License
联系方式
- GitHub Issues: 提交问题
- Email: your@email.com
---
生成时间: 2026-01-18 版本: v2.0.0
微博热搜产品创意分析器
功能概述
这是一个智能化的微博热搜分析工具,能够自动抓取微博实时热搜榜单,深度挖掘每个热点的背景信息,利用AI从"有趣度80%+有用度20%"的角度生成产品创意,最终输出一份精美的HTML分析报告。
适用于产品经理、创业者、开发者、市场人员,帮助你快速发现热点背后的产品机会,将社交媒体热度转化为可执行的产品方案。
---
使用场景
- 产品灵感挖掘:快速发现当前热点话题,生成产品创意
- 创业机会分析:评估热点话题的商业价值和用户需求
- 市场趋势洞察:了解公众关注的焦点,把握市场脉搏
- 内容创作参考:为内容创作者提供热点话题和切入角度
- 竞品分析辅助:通过热搜了解行业动态和用户关注点
---
快速开始
触发Skill
直接对Claude说以下任一句:
- "帮我分析一下微博热搜的产品创意"
- "生成今天的热搜分析报告"
- "微博热搜榜有什么可以做的产品?"
- "挖掘一下当前热点的产品机会"
示例对话
User:
帮我分析一下微博热搜的产品创意Claude: [识别到微博热搜产品创意分析器] 1. 正在抓取微博热搜榜单... 2. 已获取50个热搜话题 3. 开始深度搜索背景信息(1/50)... 4. 正在AI分析产品创意... 5. 正在生成HTML报告... 6. ✅ 微博热搜产品创意报告已生成:weibo_hotspot_report_2025-01-04.html
Output: 打开生成的HTML文件,你可以看到:
- 📊 热搜榜单TOP10概览
- 🔍 每个热搜的详细分析(事件脉络、背景信息)
- 💡 3-5个产品创意(含名称、功能、用户画像、评分)
- 🏆 高分创意排行(>80分优秀,60-80分良好)
实际效果
生成的HTML报告支持:
- 📱 响应式设计,手机/平板完美显示
- 🎨 活力橙配色,视觉友好
- 🎯 分级展示,优秀创意高亮突出
- 📈 数据统计,一目了然
---
输入/输出
输入
- API密钥:天聚数行API密钥(已内置)
- 分析数量:可选,默认分析全部50个热搜
输出
- HTML报告文件:
weibo_hotspot_report_<YYYY-MM-DD>.html - 包含热搜榜单概览
- 每个热搜的详细分析
- 产品创意列表(3-5个/热搜)
- 评分和等级标识
- 创意排行榜
- 数据统计图表
输出格式
- 单页HTML文件(UTF-8编码)
- 内嵌CSS和JavaScript
- 可直接在浏览器打开
- 可部署到Vercel/GitHub Pages
---
配置说明
API密钥配置
⚠️ 安全注意:为了保护您的 API 密钥安全,请使用环境变量配置。
本地开发
1. 复制环境变量模板:
cp .env.example .env2. 编辑 .env 文件,填入你的 API 密钥:
TIANAPI_KEY=your_tianapi_key_here
API_ENDPOINT=https://your-api-endpoint.com/v1/chat/completions
API_KEY=your_api_key_here3. 运行脚本时,它会自动从环境变量读取 API 密钥
GitHub Actions
在 GitHub 仓库设置中配置 Secrets: 1. Settings → Secrets and variables → Actions 2. 添加以下 Secrets:
TIANAPI_KEY: 天聚数行 API 密钥API_ENDPOINT: Claude API 端点API_KEY: Claude API 密钥
🔒 重要:绝不要将 API 密钥硬编码到代码中,否则会导致密钥泄露。
API 资源
- 天聚数行 API: https://www.tianapi.com/
- 免费账户每日限额 100 次调用
抓取频率建议
- 微博热搜每30分钟更新一次
- 建议每日分析1-2次
- 避免短时间内重复调用(浪费API配额)
评分体系调整
当前评分标准:
- 有趣度:80%(创意新颖性、话题热度、传播潜力)
- 有用度:20%(实用价值、市场需求)
如需调整,请修改 SKILL.md 中的评分说明。
---
相关文档
- REFERENCE_API.md - API接口文档和HTML模板规范
- templates/report_template.html - HTML报告模板
- scripts/fetch_weibo_hot.py - API调用脚本
---
故障排除
问题1:API调用失败
症状:脚本返回错误码230(key错误)或150(次数不足)
原因:
- API密钥无效或未配置
- 超过每日调用限额
解决: 1. 检查API密钥是否正确 2. 查看账户剩余调用次数 3. 升级会员或等待次日重置
---
问题2:生成的HTML显示乱码
症状:中文显示为乱码或方框
原因:文件编码不是UTF-8
解决: 1. 使用文本编辑器(VS Code)打开HTML文件 2. 选择"通过编码重新打开" → UTF-8 3. 保存文件时确保编码为UTF-8
---
问题3:搜索结果不相关
症状:某些热搜的搜索结果与话题无关
原因:
- 热搜词过于简短或歧义
- 新闻源覆盖不全面
解决: 1. 优化搜索关键词(添加限定词) 2. 增加搜索结果数量 3. 手动补充背景信息
---
问题4:评分普遍偏低
症状:大部分创意评分低于60分
原因:
- 搜索信息不够详细
- AI对热点理解不充分
- 评分标准过于严格
解决: 1. 增加搜索深度和数量 2. 调整评分权重(SKILL.md) 3. 提供更具体的创意生成提示
---
问题5:HTML无法在手机上正常显示
症状:手机打开布局错乱
原因:浏览器缓存或CSS加载问题
解决: 1. 清除浏览器缓存 2. 强制刷新页面(Ctrl+F5) 3. 使用Chrome/Safari最新版浏览器
---
使用技巧
提高分析质量
1. 选择最佳时间:早上9-10点、晚上8-10点是热搜活跃期 2. 关注爆点热搜:优先分析热度>100万的话题 3. 组合分析:对比多天的热搜,发现持续性热点 4. 人工优化:AI生成的创意可作为起点,人工进一步优化
高效使用报告
1. 快速浏览:先看"创意排行"部分,找到高分创意 2. 深入研究:点击感兴趣的热搜,查看详细分析 3. 团队协作:将报告分享给团队,头脑风暴优化创意 4. 跟踪迭代:定期生成报告,跟踪热点变化趋势
部署到Vercel
1. 生成HTML报告后 2. 访问 Vercel 3. 拖拽HTML文件到部署页面 4. 几秒后获得公开链接 5. 分享给团队成员查看
---
更新日志
- v1.0.0 (2025-01-04):
- 初始版本
- 支持微博热搜抓取
- AI产品创意分析
- HTML报告生成
- 响应式设计
REFERENCE_API.md - API接口与模板规范
本文档包含微博热搜API接口说明、HTML报告模板规范、评分标准详解。
---
微博热搜API接口
接口基本信息
| 项目 | 内容 |
|---|---|
| 接口名称 | 微博热搜榜API |
| 服务提供商 | 天聚数行TianAPI |
| 接口地址 | https://apis.tianapi.com/weibohot/index |
| 请求方式 | GET/POST |
| 返回格式 | UTF-8 JSON |
| 更新频率 | 每30分钟 |
| 数据范围 | TOP50热搜话题 |
请求参数
| 参数名 | 类型 | 是否必需 | 说明 |
|---|---|---|---|
key | string | ✅ 是 | API密钥(注册后获得) |
请求示例:
https://apis.tianapi.com/weibohot/index?key=<your_api_key>返回参数
公共参数
| 参数名 | 类型 | 说明 |
|---|---|---|
code | int | 状态码(200=成功) |
msg | string | 错误信息 |
result | object | 返回结果集 |
应用参数(result数组内)
| 参数名 | 类型 | 示例值 | 说明 |
|---|---|---|---|
hotword | string | "失踪女童确认曾在漳州出现" | 热搜话题 |
hotwordnum | string | "129940" | 热搜指数 |
hottag | string | "热" | 热搜标签(热/新/爆等) |
返回示例
{
"code": 200,
"msg": "success",
"result": [
{
"hotword": "失踪女童确认曾在漳州出现",
"hotwordnum": "129940",
"hottag": "热"
},
{
"hotword": "春节档电影票房破百亿",
"hotwordnum": "256780",
"hottag": "爆"
}
]
}错误码说明
| 错误码 | 说明 | 解决方案 |
|---|---|---|
| 200 | 成功 | - |
| 230 | key错误或为空 | 检查API密钥是否正确 |
| 150 | 可用次数不足 | 等待次日重置或升级会员 |
| 130 | 调用频率超限 | 降低请求频率 |
| 250 | 数据返回为空 | 稍后重试或检查API状态 |
调用限制
| 会员等级 | 每日调用量 | QPS限制 | 价格 |
|---|---|---|---|
| 普通会员 | 100次 | 5-10 | 免费 |
| 高级会员 | 10,000次 | 20 | ¥20/月 |
| 黄金会员 | 500,000次 | 30 | ¥65/月 |
| 钻石会员 | 不限次 | 60 | ¥1690/年 |
热搜链接格式
单个热搜的微博搜索链接:
https://s.weibo.com/weibo?q=<热搜词URL编码>例如:https://s.weibo.com/weibo?q=%E5%A4%B1%E8%B8%AA%E5%A5%B3%E7%AB%A5
---
HTML报告模板规范
文件结构
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>微博热搜产品创意分析报告</title>
<style>/* CSS样式 */</style>
</head>
<body>
<div class="container">
<!-- 报告内容 -->
</div>
<script>/* JavaScript逻辑 */</script>
</body>
</html>配色方案(活力橙主题)
| 用途 | 颜色代码 | CSS变量 |
|---|---|---|
| 主色(活力橙) | #FF6B35 | --primary-color |
| 辅助色 | #FF8C42 | --secondary-color |
| 强调色(优秀) | #FFD23F | --accent-excellent |
| 良好色 | #06A77D | --accent-good |
| 背景色 | #FFF8F0 | --bg-color |
| 文字色 | #2D3142 | --text-color |
| 卡片背景 | #FFFFFF | --card-bg |
排版规范
字体大小
- 标题(h1):28px(手机)/ 36px(桌面)
- 副标题(h2):22px(手机)/ 28px(桌面)
- 小标题(h3):18px(手机)/ 20px(桌面)
- 正文:14px(手机)/ 16px(桌面)
- 小字:12px
间距规范
- 页面边距:16px(手机)/ 40px(桌面)
- 卡片间距:16px(手机)/ 24px(桌面)
- 元素内边距:12px(手机)/ 16px(桌面)
- 章节间距:32px(手机)/ 48px(桌面)
响应式断点
/* 手机 */
@media (max-width: 768px) { }
/* 平板 */
@media (min-width: 769px) and (max-width: 1024px) { }
/* 桌面 */
@media (min-width: 1025px) { }内容区域规范
1. 报告头部
<header class="report-header">
<h1>微博热搜产品创意分析报告</h1>
<div class="meta-info">
<span class="date">生成日期:2025-01-04</span>
<span class="count">热搜总数:50</span>
<span class="duration">分析耗时:15分钟</span>
</div>
</header>2. 热搜概览(TOP10)
<section class="hotspot-overview">
<h2>📊 热搜TOP10概览</h2>
<div class="hotspot-list">
<!-- 10个热搜卡片,每个包含:排名、热搜词、热度、标签 -->
</div>
</section>3. 详细分析(每个热搜)
<section class="hotspot-detail">
<div class="hotspot-header">
<span class="rank">#1</span>
<h3 class="hotword">春节档电影票房破百亿</h3>
<span class="hotness">热度:256,780</span>
<span class="tag">爆</span>
</div>
<div class="event-timeline">
<h4>📅 事件脉络</h4>
<ul class="timeline">
<li><strong>2025-01-01</strong>:春节档电影开始预售</li>
<li><strong>2025-01-03</strong>:多部影片票房破10亿</li>
<li><strong>2025-01-04</strong>:总票房突破100亿</li>
</ul>
</div>
<div class="product-ideas">
<h4>💡 产品创意</h4>
<div class="idea-card excellent"> <!-- 优秀创意 -->
<div class="idea-header">
<span class="idea-name">🎬 影票拼团小程序</span>
<span class="score">92分 <span class="badge excellent">优秀</span></span>
</div>
<div class="idea-body">
<p><strong>核心功能:</strong></p>
<ul>
<li>多人拼团购票优惠(3-10人团)</li>
<li>智能推荐热门场次和座位</li>
<li>影后评分和讨论区</li>
<li>会员积分兑换爆米花套餐</li>
</ul>
<p><strong>目标用户:</strong></p>
<p>18-35岁年轻观影群体,喜欢社交分享,对价格敏感但追求体验。</p>
</div>
</div>
<div class="idea-card good"> <!-- 良好创意 -->
<!-- 创意内容 -->
</div>
</div>
</section>4. 创意排行榜
<section class="idea-ranking">
<h2>🏆 产品创意排行榜</h2>
<div class="ranking-list">
<!-- 所有创意按评分降序展示 -->
</div>
</section>5. 数据统计
<section class="statistics">
<h2>📈 数据统计</h2>
<div class="stat-grid">
<div class="stat-item">
<span class="stat-value">150</span>
<span class="stat-label">创意总数</span>
</div>
<div class="stat-item">
<span class="stat-value">45</span>
<span class="stat-label">优秀创意(>80分)</span>
</div>
<div class="stat-item">
<span class="stat-value">78.5</span>
<span class="stat-label">平均评分</span>
</div>
</div>
</section>交互功能
搜索过滤
// 实时搜索功能
function filterHotspots(keyword) {
// 根据关键词过滤热搜
}排序功能
// 按热度/评分排序
function sortBy(criteria) {
// 'hotness' 或 'score'
}折叠展开
// 长列表自动折叠
function toggleDetail(id) {
// 展开/收起详情
}---
评分标准详解
评分公式
综合评分 = 有趣度 × 0.8 + 有用度 × 0.2有趣度评分标准(80分权重)
| 维度 | 评分点 | 分值范围 |
|---|---|---|
| 创意新颖性 | 是否有创新点、差异化 | 0-25分 |
| 话题热度 | 当前社交媒体讨论量 | 0-25分 |
| 用户参与度 | 互动性、UGC潜力 | 0-20分 |
| 传播潜力 | 病毒式传播可能性 | 0-30分 |
有趣度总分:0-100分
评分示例
- 25-30分(传播潜力):具备强社交属性,易于二次创作
- 20-25分(创意新颖性):有独特切入点,非传统产品形态
- 18-20分(用户参与度):高频互动,用户可贡献内容
- 20-25分(话题热度):热搜榜前列,讨论量>100万
有用度评分标准(20分权重)
| 维度 | 评分点 | 分值范围 |
|---|---|---|
| 实用价值 | 解决实际问题的程度 | 0-8分 |
| 需求强度 | 用户刚需程度 | 0-7分 |
| 市场痛点 | 解决现有产品不足 | 0-5分 |
有用度总分:0-20分
评分示例
- 6-8分(实用价值):直接解决用户痛点,高频使用场景
- 5-7分(需求强度):强需求,用户愿意付费
- 4-5分(市场痛点):填补市场空白,优于现有方案
等级划分
| 等级 | 分数范围 | 标识颜色 | 说明 |
|---|---|---|---|
| 优秀 | >80分 | 金黄色 | 高有趣度+高实用价值,优先推荐 |
| 良好 | 60-80分 | 绿色 | 有潜力,可考虑开发 |
| 普通 | <60分 | 灰色 | 需要优化或暂缓 |
评分注意事项
1. 权重偏向:有趣度占80%,因为热点产品依赖话题性和传播力 2. 动态调整:评分基于当前信息,后续可能调整 3. 主观性:AI评分有主观性,仅作参考 4. 市场验证:高分创意需进一步市场验证
---
Web Search使用规范
搜索关键词格式
// 基础搜索
`"${hotword}" 事件 背景`
// 时间限定
`"${hotword}" 最新进展 2025`
// 多维度搜索
`"${hotword}" 影响分析 用户讨论`搜索结果筛选
- 优先选择权威新闻源(新华社、人民日报等)
- 关注事件时间线信息
- 收集用户评论和讨论热点
- 提取关键数据(时间、地点、涉及主体)
搜索频率控制
- 每个热搜搜索3-5次
- 避免重复搜索相同内容
- 控制总体搜索次数(节省token)
---
开发调试建议
本地测试
# 测试API调用
python scripts/fetch_weibo_hot.py
# 验证HTML渲染
# 直接在浏览器打开生成的HTML文件常见问题
1. 中文乱码:确保文件保存为UTF-8编码 2. 样式错乱:检查CSS是否完整加载 3. 脚本错误:查看浏览器控制台错误信息 4. 数据为空:验证API返回的数据格式
优化建议
1. 性能优化:使用虚拟滚动处理长列表 2. 离线访问:考虑使用Service Worker 3. 数据缓存:避免重复调用API 4. 移动端优化:减少动画效果,提升加载速度