Skip to content

ray870211/daily-digest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daily Digest

每日資訊摘要 CLI 工具。自動抓取 Podcast、YouTube 頻道的最新內容,用 AI 產生詳細繁體中文報告,推送到 Discord。

功能

  • Podcast 抓取 — 透過 RSS feed 取得最新集數,下載音檔後用 faster-whisper 本地轉錄
  • YouTube 抓取 — 支援一般影片與直播回放,優先抓字幕,無字幕則下載音檔轉錄
  • AI 摘要 — 透過 Claude CLI 產生詳細繁體中文報告,保留原文細節與數據
  • 跨來源綜合分析 — 比對多個來源的觀點,找出共同主題、矛盾點與值得關注的趨勢
  • 去重機制digest-state.json 記錄已處理項目,避免重複摘要
  • Discord 推送 — Webhook 推送通知,自動分段處理超過 2000 字的內容

前置需求

  • Python 3.11+
  • uv — Python 套件管理
  • Claude CLI — 需登入或設定 API key
  • yt-dlp — YouTube 音檔下載(透過 uv 自動安裝)
  • ffmpeg — 音檔處理(需自行安裝,brew install ffmpeg

安裝

git clone https://github.com/你的帳號/daily-digest.git
cd daily-digest
uv sync

設定

1. LLM 後端

預設使用 Claude CLI(需先 claude login 登入)。

如需使用其他 OpenAI 相容 API,建立 .env

ANTHROPIC_BASE_URL=https://api.example.com/v1/
ANTHROPIC_API_KEY=sk-xxx

2. Discord Webhook

echo "https://discord.com/api/webhooks/..." > config/discord-webhook.txt

3. 來源設定

編輯 config/sources.yaml

sources:
  # Podcast — 透過 RSS feed 抓取
  - type: podcast
    name: "節目名稱"
    feed: "https://feeds.example.com/podcast.xml"
    limit: 1                    # 抓最新幾筆(預設 1)

  # YouTube 頻道
  - type: youtube-channel
    id: "@channel_handle"       # 頻道 handle
    filter: livestream          # 選填,只抓直播回放
    transcript: both            # 選填,先抓字幕,沒有則 whisper 轉錄

使用

# 預檢(測試 LLM 和 Discord 連線)
uv run daily-digest test

# 乾跑(不推送 Discord)
uv run daily-digest run --dry-run

# 完整執行
uv run daily-digest run

# 跳過預檢
uv run daily-digest run --skip-check

# 指定設定與輸出目錄
uv run daily-digest run --config-dir ./config --output-dir ./summaries

輸出結構

summaries/
├── 2026-03-08.md              # 當日摘要報告 + 綜合分析
└── transcripts/
    └── 2026-03-08_標題.txt     # 原始轉錄文字

自動排程(macOS)

專案附帶 launchd 設定,每天早上 9:00 自動執行:

# 安裝排程
cp scripts/com.ray.daily-digest.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.ray.daily-digest.plist

# 查看狀態
launchctl list | grep daily-digest

# 移除排程
launchctl unload ~/Library/LaunchAgents/com.ray.daily-digest.plist

使用前請先修改 scripts/daily-digest.sh 和 plist 中的路徑。

專案結構

src/daily_digest/
├── cli.py              # CLI 入口(click)
├── config.py           # 載入 sources.yaml 與 webhook
├── state.py            # 去重狀態管理
├── summarizer.py       # LLM 摘要與跨來源分析
├── transcriber.py      # faster-whisper 音檔轉錄
├── notifier.py         # Discord webhook 推送
└── fetchers/
    ├── podcast.py      # Podcast RSS 抓取 + 音檔下載
    └── youtube.py      # YouTube 影片/字幕抓取

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors