Hacker News 中文摘要

RSS订阅

自动存档YouTube视频的浏览器扩展与本地后端 -- Browser extension and local backend that automatically archives YouTube videos

文章摘要

GitHub上的starchive项目是一个浏览器插件,旨在将YouTube视频发送到本地后端进行处理。该项目提供了多种GitHub功能的导航菜单,包括Copilot、Spark、Models、Advanced Security、Actions等,帮助开发者更好地管理和优化代码。

文章总结

GitHub项目:starchive - 将YouTube视频发送到本地后端的浏览器插件

项目概述
starchive是一个浏览器扩展和本地后端系统,旨在自动存档用户访问的YouTube视频。该系统由两部分组成:一个Firefox浏览器扩展,用于检测YouTube视频页面;以及一个用Go语言编写的后端,负责使用yt-dlp工具下载视频。

主要组件
1. 后端(Go语言)
- HTTP服务器main.go):运行在端口3009上,包含两个端点:
- /:用于基本健康检查。
- /youtube:POST端点,接收视频ID并触发下载。
- 视频下载器youtube.go):使用yt-dlp和ffmpeg下载YouTube视频,并将其转换为MOV格式,采用h264_videotoolbox编码。
- 字幕支持:下载英文字幕(VTT格式),目前重试循环中已禁用。

  1. 浏览器扩展(Firefox)
    • 清单文件manifest.json):定义扩展的权限和结构。
    • 内容脚本content.js):自动检测YouTube视频页面并从URL中提取视频ID。
    • 后台脚本background.js):处理内容脚本与后端API之间的通信。
    • 弹出界面popup.html/js):提供手动数据获取的简单用户界面。

工作原理
1. 当用户访问YouTube视频页面时,内容脚本自动从URL中提取视频ID。
2. 视频ID被发送到后台脚本,后者向http://localhost:3009/youtube发送POST请求。
3. Go后端接收视频ID,并使用yt-dlp下载视频。
4. 视频被保存到./data/目录,并通过ffmpeg转换为MOV格式,支持硬件加速。
5. 系统还支持字幕下载(目前仅限一次尝试)。

安装与使用
1. 启动Go后端:go run .
2. 从firefox/目录加载Firefox扩展。
3. 访问任何YouTube视频页面,系统将自动触发存档。

依赖项
- yt-dlp:用于下载YouTube视频。
- ffmpeg:用于视频格式转换和处理。
- Go:后端服务器运行时。

其他说明
该项目与https://www.starchive.io/无关。

评论总结

评论内容主要围绕视频存档工具和技术展开,观点多样,涵盖了技术实现、存档的必要性、以及存档行为的反思等。以下是总结:

  1. 技术实现与工具

    • 一些评论者分享了他们使用的工具或技术,如yt-dlp脚本、Tubearchivist扩展等。
      • "Ive been using Tubearchivist with the extension for this."(erinnh)
      • "I'm achieving this with a single yt-dlp script reading url from a clipboard."(ivanjermakov)
  2. 存档的必要性与价值

    • 部分评论者认为存档非常重要,尤其是为了防止视频消失。
      • "Oh, this is huge and important. The number of things I watch that're just gone when I go back to look again!"(myself248)
      • "It would be nice if the extension wrote them to some shared repository. That way, the videos could be preserved for humanity without Google having a say in it."(amelius)
  3. 存档行为的反思

    • 有评论者质疑存档的必要性,认为过度存档可能导致资源浪费。
      • "Cool but ... this also sounds like hording behavior. The number of things I've saved over the years only to throw them away years later and realize that saving them in the first place was a waste of time."(socalgal2)
  4. 技术改进与创新

    • 一些评论者提出了技术改进的建议,如使用DHT进行分布式下载、或通过WebCodecs在浏览器中处理视频。
      • "Now add DHT so clients can download videos from each other as a torrent and you solved global video distribution."(WithinReason)
      • "I was looking into creating an extension that manually manipulates and intercepts the vnd.yt-ump requests, then use webcodecs to process everything in the browser."(computegabe)
  5. 其他相关工具

    • 评论者还提到了其他类似工具,如ArchiveBox,支持多种内容的存档。
      • "See also ArchiveBox, which supports YT saving as well, but can save other content too."(untech)

总结:评论者普遍认可视频存档的价值,但也有人对过度存档提出质疑。技术实现方面,多种工具和方法被提及,且有人提出了进一步的技术改进建议。