Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avivharuzi/m3u8-dln
A complete m3u8 downloader ๐บ
https://github.com/avivharuzi/m3u8-dln
hls javascript m3u8 m3u8-downloader nodejs npm npm-package typescript
Last synced: 3 months ago
JSON representation
A complete m3u8 downloader ๐บ
- Host: GitHub
- URL: https://github.com/avivharuzi/m3u8-dln
- Owner: avivharuzi
- License: mit
- Created: 2023-02-07T16:54:30.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-13T21:05:16.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T01:34:16.600Z (4 months ago)
- Topics: hls, javascript, m3u8, m3u8-downloader, nodejs, npm, npm-package, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/m3u8-dln
- Size: 62.5 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
m3u8-dln
A complete m3u8 downloader ๐บ
An npm package and CLI tool to download M3U8/HLS streams and merge all the chunks to a MP4 video.
---
## ๐ Table of Contents
- [Features](#-Features)
- [Prerequisites](#-Prerequisites)
- [Installation](#-Installation)
- [Usage](#-Usage)
- [License](#-License)## โจ Features
โ Vey fast ๐๏ธ
โ Can be used via CLI or in code
โ Support http headers in case of authentication
โ Can download from m3u8 master playlist and all his videos inside or specific one
โ Can merge video and audio together (works only if the m3u8 master playlist was provided)
โ Preserve original quality (without encoding)
## ๐ฏ Prerequisites
- [ffmpeg](https://ffmpeg.org) (ffmpeg will be used as the last step to create the mp4 file)
## ๐ ๏ธ Installation
Using via code (for CLI no need to install locally).
> NOTE: The package is using esm modules!
Install the package locally.
```
npm i m3u8-dln
```Basic example.
```ts
import { m3u8DLN } from 'm3u8-dln';await m3u8DLN('https://www.example.com/some-path/master.m3u8', './');
```With options.
```ts
import { m3u8DLN } from 'm3u8-dln';const response = await m3u8DLN(
'https://www.example.com/some-path/master.m3u8',
'./',
{
httpHeaders: {}, // HTTP headers that can be pass to the http calls.
segmentBatch: 8, // The number of segment files to download at the same time.
streamBatch: 4, // The number of streams to download at the same time.
streamSelection: {
// 'all' | 'first-one' | 'last-one' | 'highest-bandwidth' | 'highest-resolution'
strategy: 'highest-resolution', // Choose what streams to download.
},
}
);console.log(response); // [{ outputFilePaths: ['ced0b1120d6954b6229bbbc12c162c6a_1920x1080_25.mp4'] }]
```## โก๏ธ Usage
Using via CLI.
```sh
npx m3u8-dln --help
```Download example with input.
```sh
npx m3u8-dln -i https://www.example.com/some-path/master.m3u8
```## ๐ License
[MIT](LICENSE)