KitsuneKode/kitsunesnipe

GitHub: KitsuneKode/kitsunesnipe

一个交互式终端工具,自动绕过 DOM 陷阱提取流媒体清单并管理观看历史。

Stars: 0 | Forks: 0

# KitsuneSnipe 🦊🎯 一个快速、交互式的终端流媒体引擎。零配置 — 只需运行并跟随提示。 支持 **VidKing** 和 **Cineby** 作为提供者,无需 API 密钥。 ## ✨ 功能 - **完全交互式** — 无需标志;通过引导提示 + fzf 模糊搜索 - **观看历史** — 记住你暂停的位置,提供继续观看或跳转到下一集 - **后台预取** — 观看当前集时预加载下一集;`[n]` 即时加载 - **海报预览** — 即时显示 TMDB 海报(仅限 Kitty / Ghostty 终端,无需额外工具) - **fzf 集成** — 模糊选择标题和字幕轨道;若无 fzf 则回退到方向键选择 - **字幕支持** — 使用 wyzie 字幕 API 并选择语言,或通过 fzf 交互式选取 - **广告拦截** — 通过 Playwright `route()` 在网络层屏蔽 20 多个广告/追踪域名 - **无头模式默认** — 浏览器在后台无声运行;若提供者阻止则使用 `--no-headless` - **自动提供者回退** — 若主提供者失败,自动静默尝试另一个 - **1 小时流缓存** — 重新观看或恢复时完全跳过抓取器 - **智能缓存** — 会话内搜索结果缓存,避免重复查询触发限流 ## 🚀 先决条件 | 工具 | 必需 | 说明 | |------|----------|-------| | [Bun](https://bun.sh/) | ✅ | 运行时与包管理器 | | [mpv](https://mpv.io/) | ✅ | 媒体播放器 | | [fzf](https://github.com/junegunn/fzf) | 可选 | 模糊选择器 — 无则回退到方向键 | | Kitty / Ghostty 终端 | 可选 | 海报图片预览 | 安装 mpv 和 fzf: ``` # 架构 sudo pacman -S mpv fzf # Debian/Ubuntu sudo apt install mpv fzf # macOS brew install mpv fzf ``` ## 📦 安装 ``` git clone https://github.com/kitsunekode/kitsunesnipe.git cd kitsunesnipe bun install bunx playwright install chromium ``` ## 💻 用法 ### 完全交互式(推荐) ``` bun run index.ts ``` 你将被引导完成: 1. 按标题搜索(使用 fzf 从结果中模糊选择) 2. 海报预览(仅限 Kitty/Ghostty) 3. 提供者:VidKing(推荐)或 Cineby 4. 字幕语言(或使用 fzf 交互式选择) 5. 季 / 集 — 带有历史感知恢复提示 ### 使用标志跳过提示 所有标志均为可选 — 可混合搭配以预填充任意步骤: ``` bun run index.ts -S "Breaking Bad" # pre-fill search query bun run index.ts -S "Inception" -t movie # force movie type bun run index.ts -i 1396 -s 3 -e 5 # jump to S3E5 by TMDB ID bun run index.ts -S "The Boys" -l fzf # pick subtitle with fzf bun run index.ts -S "Breaking Bad" -l ar # Arabic subtitles bun run index.ts -S "Oppenheimer" -p cineby # force Cineby bun run index.ts -S "Breaking Bad" -H # visible browser (debug) ``` ### 所有标志 | 短选项 | 长选项 | 描述 | |-------|------|-------------| | `-S` | `--search` | 预填充搜索查询 | | `-i` | `--id` | 使用已知 TMDB ID(完全跳过搜索) | | `-T` | `--title` | 覆盖 MPV 中显示的标题 | | `-t` | `--type` | `movie` 或 `series`(与 `--id` 一起使用) | | `-s` | `--season` | 起始季 | | `-e` | `--episode` | 起始集 | | `-p` | `--provider` | `vidking`(默认)或 `cineby` | | `-l` | `--sub-lang` | `en`, `ar`, `fr`, `de`, `es`, `ja`, `fzf`, `none` | | `-H` | `--no-headless` | 强制显示浏览器窗口 | ## 🎮 播放菜单 每集或每部电影结束后,会出现一个一键菜单: **剧集:** ``` [n] next [p] prev [s] next season [o] other provider [q] quit ``` **电影:** ``` [r] replay [q] quit ``` 按其他任意键退出。 ## 📼 观看历史 历史记录存储在 `~/.local/share/kitsunesnipe/history.json`,以 TMDB ID 为键。 - **未完成的剧集** → 提示从精确时间戳恢复或重新开始 - **已完成的剧集**(观看进度 >85%)→ 提示跳转到下一集 - **无历史记录** → 从 S1E1 开始 ## 🗂️ 项目结构 ``` index.ts — main entry: prompts, playback loop, orchestration lib/ search.ts — db.videasy.net search (no API key needed) scraper.ts — Playwright scraper: stream + subtitle extraction, cache mpv.ts — MPV launcher with Lua position IPC history.ts — watch history read/write image.ts — Kitty/Ghostty poster preview via graphics protocol subtitle.ts — wyzie subtitle API ui.ts — dep check, fzf wrapper, @clack fallback stream_cache.json — 1-hour stream URL cache logs.txt — scrape log (auto-appended) ``` ## 🌐 提供者 URL 模式 | 提供者 | 类型 | 模式 | |----------|------|---------| | VidKing | 电影 | `https://www.vidking.net/embed/movie/{id}?autoPlay=true` | | VidKing | 剧集 | `https://www.vidking.net/embed/tv/{id}/{s}/{e}?autoPlay=true&episodeSelector=false&nextEpisode=false` | | Cineby | 电影 | `https://www.cineby.sc/movie/{id}?play=true` | | Cineby | 剧集 | `https://www.cineby.sc/tv/{id}/{s}/{e}?play=true` | ## ⚠️ 免责声明 本软件仅用于教育与研究目的 — 网络拦截、API 逆向工程与前端绕过技术。作者不托管、不提供、也不纵容任何受版权保护媒体的盗版行为。
标签:API 抓取, Bun 运行时, CLI 工具, fzf 模糊搜索, Playwright, Provider 备用, SEO: KitsuneSnipe, SEO: 交互式 CLI, SEO: 免 API 密钥, SEO: 终端流媒体, TMDB 海报, TypeScript, Waymore结果处理, 交互式提示, 反向工程, 后台预取, 域名屏蔽, 字幕提取, 安全插件, 广告拦截, 无头浏览器, 智能缓存, 流媒体工具, 流媒体解析, 特征检测, 缓存机制, 自动化侦察, 自动化攻击, 观看历史, 零配置