Skill: loveyou001/databass001 (version 1.0.12)

--- name: daily-hot-aggregator description: "🔥 一键获取全平台热榜！B站+抖音+微博+头条，一站搞定所有热点。自媒体运营必备！免费使用，定制开发请联系作者。" homepage: https://github.com/openclaw/daily-hot-aggregator metadata: { "openclaw": { "emoji": "🔥", "requires": { "bins": ["python3"] }, }, } --- # 🔥 全平台热榜聚合 v4.0 一个技能搞定所有平台热榜！B站 + 抖音 + 微博 + 头条 ## ✨ v4.0 新功能 - ✅ 新增抖音热搜支持 - ✅ 新增今日头条热榜支持 - ✅ 优化数据结构 - ✅ 改善可视化报告 ## 📦 安装 ```bash npx clawhub@latest install daily-hot-aggregator ``` ## 🚀 使用 ```bash # 获取所有平台 Top 5 python3 fetch_all.py --top 5 # 获取指定平台 python3 fetch_all.py --bilibili --top 10 python3 fetch_all.py --douyin --top 10 # 生成摘要 python3 fetch_all.py --summary --output daily_report.json ``` ## 📊 支持平台 | 平台 | 状态 | 数据内容 | |------|------|---------| | B站 | ✅ 正常 | 热门视频排行榜 | | 抖音 | ✅ 正常 | 热搜榜 | | 今日头条 | ⚠️ 部分 | 热点新闻 | | 微博 | ❌ 需Cookie | 热搜榜 | | 知乎 | ❌ 需授权 | 热榜 | ## 💰 定制服务 **免费使用本技能，如需以下服务请联系作者：** - 🔧 **定制开发**：多平台数据聚合方案 - 📊 **数据分析**：跨平台热点趋势分析 - 🤖 **自动化部署**：完整的数据监控系统 - 📱 **系统集成**：对接企业内部系统 **联系方式：** - 📱 QQ：2595075878 - 📧 邮箱：[REDACTED_SECRET] ## 📄 许可证 MIT License

path: fetch_all.py
content: #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
全平台热榜聚合 v4.0 - 使用备用API
作者: 小天🦞
版本: 4.0.0
"""

import argparse
import json
import sys
import os
import urllib.request
import urllib.error
import re
import gzip
import io
from datetime import datetime
from typing import List, Dict, Optional

# 设置控制台编码
if sys.platform == 'win32':
    os.system('chcp 65001 >nul 2>&1')
    sys.stdout.reconfigure(encoding='utf-8')
    sys.stderr.reconfigure(encoding='utf-8')


class HotAggregator:
    """全平台热榜聚合器 v4.0"""

    def __init__(self):
        self.headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
            'Accept': 'application/json, text/plain, */*',
            'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8'
        }

    def fetch_bilibili(self, top: int = 10) -> List[Dict]:
        """获取B站热门"""
        try:
            url = 'https://api.bilibili.com/x/web-interface/popular?ps=' + str(top)
            headers = {**self.headers, 'Referer': 'https://www.bilibili.com/'}
            req = urllib.request.Request(url, headers=headers)
            with urllib.request.urlopen(req, timeout=10) as resp:
                data = json.loads(resp.read().decode('utf-8'))
            if data.get('code') == 0:
                videos = data.get('data', {}).get('list', [])[:top]
                return [{
                    'rank': i+1,
                    'title': v.get('title', ''),
                    'value': v.get('stat', {}).get('view', 0),
                    'value_text': f"{v.get('stat', {}).get('view', 0)//10000}万播放",
                    'author': v.get('owner', {}).get('name', ''),
                    'url': f"https://b23.tv/{v.get('bvid', '')}"
                } for i, v in enumerate(videos)]
        except Exception as e:
            print(f"[WARN] B站获取失败: {e}", file=sys.stderr)
        return []

    def fetch_douyin(self, top: int = 10) -> List[Dict]:
        """获取抖音热搜 - 使用公开API"""
        try:
            # 抖音热搜API
            url = 'https://www.douyin.com/aweme/v1/web/hot/search/list/'
            headers = {
                **self.headers,
                'Referer': 'https://www.douyin.com/',
                'Cookie': 'ttcid=0'
            }
            req = urllib.request.Request(url, headers=headers)
            with urllib.request.urlopen(req, timeout=10) as resp:
                data = json.loads(resp.read().decode('utf-8'))

            if data.get('data'):
                word_list = data.get('data', {}).get('word_list', [])[:top]
                return [{
                    'rank': i+1,
                    'title': w.get('word', ''),
                    'value': w.get('hot_value', 0),
                    'value_text': f"{w.get('hot_value', 0)//10000}万热度" if w.get('hot_value', 0) > 10000 else f"{w.get('hot_value', 0)}热度",
                    'url': f"https://www.douyin.com/search/{urllib.request.quote(w.get('word', ''))}"
                } for i, w in enumerate(word_list)]
        except Exception as e:
            print(f"[WARN] 抖音获取失败: {e}", file=sys.stderr)
        return []

    def fetch_toutiao(self, top: int = 10) -> List[Dict]:
        """获取今日头条热榜"""
        try:
            url = 'https://www.toutiao.com/hot-event/hot-board/?origin=toutiao_pc'
            headers = {
                **self.headers,
                'Referer': 'https://www.toutiao.com/'
            }
            req = urllib.request.Request(url, headers=headers)
            with urllib.request.urlopen(req, timeout=10) as resp:
                data = json.loads(resp.read().decode('utf-8'))

            if data.get('data'):
                items = data.get('data', [])[:top]
                return [{
                    'rank': i+1,
                    'title': item.get('Title', ''),
                    'value': item.get('HotValue', 0),
                    'value_text': f"{item.get('HotValue', 0)//10000}万热度" if item.get('HotValue', 0) > 10000 else f"{item.get('HotValue', 0)}热度",
                    'url': item.get('Url', '')
                } for i, item in enumerate(items)]
        except Exception as e:
            print(f"[WARN] 今日头条获取失败: {e}", file=sys.stderr)
        return []

    def fetch_all(self, top: int = 5) -> Dict[str, List[Dict]]:
        """获取所有平台热榜"""
        return {
            'bilibili': self.fetch_bilibili(top),
            'douyin': self.fetch_douyin(top),
            'toutiao': self.fetch_toutiao(top)
        }


def format_platform(name: str, items: List[Dict]) -> str:
    """格式化平台输出"""
    icons = {
        'bilibili': '[B站] B站热门',
        'douyin': '[抖音] 抖音热搜',
        'toutiao': '[头条] 今日头条热榜'
    }
    icon = icons.get(name, name)

    if not items:
        return f"{icon}: 暂无数据"

    lines = [f"\n{icon} Top {len(items)}:"]
    for item in items:
        lines.append(f"  #{item['rank']} {item['title']} ({item['value_text']})")

    return '\n'.join(lines)


def generate_summary(all_data: Dict[str, List[Dict]]) -> str:
    """生成跨平台摘要"""
    total_items = sum(len(items) for items in all_data.values())
    platforms_with_data = sum(1 for items in all_data.values() if items)

    all_titles = []
    for platform, items in all_data.items():
        for item in items:
            all_titles.append((platform, item['title']))

    summary = f"[SUMMARY] 全平台热榜聚合摘要\n"
    summary += f"共获取 {total_items} 条热榜数据，覆盖 {platforms_with_data} 个平台\n"

    if all_titles:
        summary += f"今日热点：\n"
        for i, (platform, title) in enumerate(all_titles[:5], 1):
            summary += f"  {i}. [{platform}] {title}\n"

    return summary


def main():
    parser = argparse.ArgumentParser(description='[HOT] 全平台热榜聚合 v4.0')
    parser.add_argument('--top', type=int, default=5, help='每平台获取数量 (默认: 5)')
    parser.add_argument('--bilibili', action='store_true', help='只获取B站')
    parser.add_argument('--douyin', action='store_true', help='只获取抖音')
    parser.add_argument('--toutiao', action='store_true', help='只获取头条')
    parser.add_argument('--summary', action='store_true', help='生成摘要')
    parser.add_argument('--output', type=str, help='输出文件路径')
    parser.add_argument('--quiet', action='store_true', help='静默模式')

    args = parser.parse_args()

    aggregator = HotAggregator()

    # 确定要获取的平台
    platforms = []
    if args.bilibili: platforms.append('bilibili')
    if args.douyin: platforms.append('douyin')
    if args.toutiao: platforms.append('toutiao')
    if not platforms: platforms = ['bilibili', 'douyin', 'toutiao']

    # 获取数据
    all_data = {}
    for platform in platforms:
        method = getattr(aggregator, f'fetch_{platform}', None)
        if method:
            all_data[platform] = method(args.top)

    # 输出
    if not args.quiet:
        print("\n" + "="*60)
        print(f"[HOT] 全平台热榜聚合 v4.0 - {datetime.now().strftime('%Y-%m-%d %H:%M')}")
        print("="*60)

        for platform, items in all_data.items():
            print(format_platform(platform, items))

        print("\n" + "="*60)

    # 生成摘要
    summary = ""
    if args.summary:
        summary = generate_summary(all_data)
        if not args.quiet:
            print(f"\n{summary}")

    # 保存文件
    if args.output:
        result = {
            'date': datetime.now().strftime('%Y-%m-%d %H:%M'),
            'platforms': {k: len(v) for k, v in all_data.items()},
            'summary': summary,
            'data': all_data
        }
        with open(args.output, 'w', encoding='utf-8') as f:
            json.dump(result, f, ensure_ascii=False, indent=2)
        print(f"[OK] 已保存到 {args.output}")

    return all_data


if __name__ == '__main__':
    main()


path: package.json
content: {
  "name": "daily-hot-aggregator",
  "version": "1.0.0",
  "description": "🔥 一键获取全平台热榜！B站+微博+小红书+抖音+百度+知乎，一站搞定所有热点",
  "author": "小天🦞",
  "license": "MIT",
  "keywords": [
    "hot",
    "trending",
    "aggregator",
    "bilibili",
    "weibo",
    "zhihu",
    "baidu",
    "热榜",
    "聚合"
  ],
  "main": "fetch_all.py",
  "scripts": {
    "start": "python3 fetch_all.py",
    "all": "python3 fetch_all.py --top 5",
    "bilibili": "python3 fetch_all.py --bilibili --top 10",
    "weibo": "python3 fetch_all.py --weibo --top 10",
    "export": "python3 fetch_all.py --summary --output daily_report.json"
  },
  "dependencies": {
    "python": ">=3.7"
  },
  "pricing": {
    "free": {
      "description": "免费版 - 每平台 Top 3",
      "features": ["每平台Top 3", "基础数据展示"]
    },
    "pro": {
      "price": 99,
      "currency": "CNY",
      "description": "Pro版 - 全部功能",
      "features": ["每平台Top 10", "AI摘要", "多渠道推送", "定时任务", "跨平台分析"]
    }
  }
}


path: README.md
content: # 🔥 全平台热榜聚合 - Daily Hot Aggregator

> 一个技能搞定所有平台热榜！B站 + 微博 + 小红书 + 百度 + 知乎

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![ClawHub](https://img.shields.io/badge/ClawHub-Available-brightgreen)](https://clawhub.ai)

## ✨ 功能特性

- 📊 **6大平台**：B站、微博、小红书、抖音、百度、知乎
- 🤖 **AI 智能摘要**：跨平台热点分析
- 📱 **多渠道推送**：Telegram/微信/邮件
- ⏰ **定时执行**：每日自动更新

## 🚀 快速开始

### 安装

```bash
npx clawhub@latest install daily-hot-aggregator
```

### 使用

```bash
# 获取所有平台 Top 5
python3 fetch_all.py --top 5

# 获取指定平台
python3 fetch_all.py --bilibili --top 10

# 生成跨平台摘要
python3 fetch_all.py --summary --output daily_report.json
```

## 💰 定价

- **免费版**：每平台 Top 3，基础数据
- **Pro版（99元）**：全平台 Top 10 + AI摘要 + 多渠道推送

## 🏆 独家优势

1. **一站式**：一个技能搞定6个平台
2. **跨平台分析**：AI帮你发现跨平台热点
3. **持续更新**：定期添加新平台

## 📄 许可证

MIT License - 小天🦞


path: _meta.json
content: ownerId: kn7dhwrh3611jhh9nac60jx2jx82h264
slug: daily-hot-aggregator
version: 4.0.1
publishedAt: 1774721318417

Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)