搜索

PythonReactSEOPDF
OpenClaw

m3u8-downloader

Download encrypted m3u8/HLS videos using parallel downloads. Use when given an m3u8 URL to download a video, especially encrypted HLS streams with AES-128.

easonc130 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install easonc13/m3u8-downloader

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

M3U8 Video Downloader

Download HLS/m3u8 videos with parallel segment downloads and automatic decryption.

Prerequisites

  • aria2c (install: brew install aria2)
  • ffmpeg (install: brew install ffmpeg)

Full Workflow (From Webpage to MP4)

Step 1: Extract m3u8 URL from webpage

If given a webpage URL (not a direct m3u8), use browser automation to find the stream URL:

// In browser console or via browser tool evaluate
(() => {
  // Check HLS.js player instance
  if (window.hls && window.hls.url) return window.hls.url;
  if (window.player && window.player.hls && window.player.hls.url) return window.player.hls.url;
  
  // Search window objects for m3u8 URLs
  const allVars = Object.keys(window).filter(k => {
    try {
      return window[k] && typeof window[k] === 'object' && 
             window[k].url && window[k].url.includes('m3u8');
    } catch(e) { return false; }
  });
  return allVars.length > 0 ? allVars.map(k => window[k].url) : 'not found';
})()

Use profile=openclaw (isolated browser) to avoid browser history.

Step 2: Handle Master Playlist (Multi-Quality)

Master playlists list quality variants, not segments:

curl -s "https://example.com/playlist.m3u8"
# Output example:
# #EXT-X-STREAM-INF:BANDWIDTH=8247061,RESOLUTION=1920x1080
# 1080p/video.m3u8
# #EXT-X-STREAM-INF:BANDWIDTH=4738061,RESOLUTION=1280x720
# 720p/video.m3u8

Pick the highest quality (e.g., 1080p) and fetch that sub-playlist:

BASE_URL="https://example.com"
curl -s "${BASE_URL}/1080p/video.m3u8"
Step 3: Extract Segment URLs

Segments may have non-standard extensions (e.g., .jpeg instead of .ts):

mkdir -p /tmp/video_download && cd /tmp/video_download

BASE_URL="https://example.com/1080p"
curl -s "${BASE_URL}/video.m3u8" | grep -E "^[^#]" | while read seg; do
  echo "${BASE_URL}/${seg}"
done > urls.txt

# Count segments
wc -l urls.txt
Step 4: Parallel Download with aria2c
aria2c -i urls.txt...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/easonc13/m3u8-downloader
Version
—
Commit
78fe7dd8f10dbbfc93e25412ec5458768fa3a0ba
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
# M3U8 Video Downloader

Download HLS/m3u8 videos with parallel segment downloads and automatic decryption.

## Prerequisites

- `aria2c` (install: `brew install aria2`)
- `ffmpeg` (install: `brew install ffmpeg`)

## Full Workflow (From Webpage to MP4)

### Step 1: Extract m3u8 URL from webpage

If given a webpage URL (not a direct m3u8), use browser automation to find the stream URL:

```javascript
// In browser console or via browser tool evaluate
(() => {
  // Check HLS.js player instance
  if (window.hls && window.hls.url) return window.hls.url;
  if (window.player && window.player.hls && window.player.hls.url) return window.player.hls.url;
  
  // Search window objects for m3u8 URLs
  const allVars = Object.keys(window).filter(k => {
    try {
      return window[k] && typeof window[k] === 'object' && 
             window[k].url && window[k].url.includes('m3u8');
    } catch(e) { return false; }
  });
  return allVars.length > 0 ? allVars.map(k => window[k].url) : 'not found';
})()
```

Use `profile=openclaw` (isolated browser) to avoid browser history.

### Step 2: Handle Master Playlist (Multi-Quality)

Master playlists list quality variants, not segments:

```bash
curl -s "https://example.com/playlist.m3u8"
# Output example:
# #EXT-X-STREAM-INF:BANDWIDTH=8247061,RESOLUTION=1920x1080
# 1080p/video.m3u8
# #EXT-X-STREAM-INF:BANDWIDTH=4738061,RESOLUTION=1280x720
# 720p/video.m3u8
```

Pick the highest quality (e.g., 1080p) and fetch that sub-playlist:

```bash
BASE_URL="https://example.com"
curl -s "${BASE_URL}/1080p/video.m3u8"
```

### Step 3: Extract Segment URLs

Segments may have non-standard extensions (e.g., `.jpeg` instead of `.ts`):

```bash
mkdir -p /tmp/video_download && cd /tmp/video_download

BASE_URL="https://example.com/1080p"
curl -s "${BASE_URL}/video.m3u8" | grep -E "^[^#]" | while read seg; do
  echo "${BASE_URL}/${seg}"
done > urls.txt

# Count segments
wc -l urls.txt
```

### Step 4: Parallel Download with aria2c

```bash
aria2c -i urls.txt...

相关技能

OpenClaw

1password

daggerkun007

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.