Concatenates segments from a m3u8/dash-mpd playlist into a consumable stream.
Installations
npm install m3u8stream
Developer
fent
Developer Guide
Module System
CommonJS
Min. Node Version
>=12
Typescript Support
Yes
Node Version
16.13.1
NPM Version
7.24.2
Statistics
217 Stars
146 Commits
54 Forks
7 Watching
4 Branches
7 Contributors
Updated on 09 Nov 2024
Languages
TypeScript (96.74%)
JavaScript (3.26%)
Total Downloads
Cumulative downloads
Total Downloads
25,038,770
Last day
5.9%
27,462
Compared to previous day
Last week
12.6%
193,610
Compared to previous week
Last month
7.8%
710,519
Compared to previous month
Last year
138.3%
7,103,338
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
node-m3u8stream
Reads segments from a m3u8 playlist or DASH MPD file into a consumable stream.
Usage
1const fs = require('fs'); 2const m3u8stream = require('m3u8stream') 3 4m3u8stream('http://somesite.com/link/to/the/playlist.m3u8') 5 .pipe(fs.createWriteStream('videofile.mp4'));
API
m3u8stream(url, [options])
Creates a readable stream of binary media data. options
can have the following
begin
- Where to begin playing the video. Accepts an absolute unix timestamp or date and a relative time in the formats1:23:45.123
and1m2s
.liveBuffer
- How much buffer in milliseconds to have for live streams. Default is20000
.chunkReadahead
- How many chunks to preload ahead. Default is3
.highWaterMark
- How much of the download to buffer into the stream. See node's docs for more. Note that the actual amount buffered can be higher since each chunk request maintains its own buffer.requestOptions
- Any options you want to pass to miniget, such asheaders
.parser
- Either "m3u8" or "dash-mpd". Defaults to guessing based on the playlist url ending in.m3u8
or.mpd
.id
- For playlist containing multiple media options. If not given, the first representation will be picked.
Stream#end()
If called, stops requesting segments, and refreshing the playlist.
Event: progress
Object
- Current segment with the following fields,number
- numnumber
- sizenumber
- durationstring
- url
number
- Total number of segments.number
- Bytes downloaded up to this point.
For static non-live playlists, emitted each time a segment has finished downloading. Since total download size is unknown until all segment endpoints are hit, progress is calculated based on how many segments are available.
miniget events
All miniget events are forwarded and can be listened to from the returned stream.
m3u8stream.parseTimestamp(time)
Converts human friendly time to milliseconds. Supports the format
00:00:00.000 for hours, minutes, seconds, and milliseconds respectively.
And 0ms, 0s, 0m, 0h, and together 1m1s.
time
- A string (or number) giving the user-readable input data
Limitations
Currently, it does not support encrypted media segments. This is because the sites where this was tested on and intended for, YouTube and Twitch, don't use it.
This does not parse master playlists, only media playlists. If you want to parse a master playlist to get links to media playlists, you can try the m3u8 module.
Install
npm install m3u8stream
Tests
Tests are written with mocha
1npm test
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/fent/node-m3u8stream/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/fent/node-m3u8stream/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/fent/node-m3u8stream/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/fent/node-m3u8stream/nodejs.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/fent/node-m3u8stream/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/fent/node-m3u8stream/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/fent/node-m3u8stream/release.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/lint.yml:16
- Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:24
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 1 out of 3 npmCommand dependencies pinned
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/lint.yml:1
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 7 are checked with a SAST tool
Reason
20 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
2.7
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to m3u8stream
@mtripg6666tdr/m3u8stream
Reads segments from a m3u8 or dash playlist into a consumable stream.
ytdl-core-browser
This library is a tiny wrapper around the [ytdl-core](https://www.npmjs.com/package/ytdl-core) library to make it work in the browser.
ytdl-core-info-browser
This is based on a [fork](https://www.npmjs.com/package/ytdl-core-browser). By July 02, 2024, it is working.
@luminati-io/m3u8stream
Reads segments from a m3u8 or dash playlist into a consumable stream.