dasha 3.1.5 → 4.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -11
- package/dist/dasha.cjs +1188 -0
- package/dist/dasha.d.cts +179 -0
- package/dist/dasha.d.ts +179 -0
- package/dist/dasha.js +1155 -0
- package/package.json +37 -21
- package/dasha.js +0 -29
- package/lib/audio.js +0 -148
- package/lib/dash.js +0 -516
- package/lib/hls.js +0 -234
- package/lib/subtitle.js +0 -137
- package/lib/track.js +0 -127
- package/lib/util.js +0 -98
- package/lib/video.js +0 -200
- package/lib/xml.js +0 -310
- package/types/dasha.d.ts +0 -161
package/README.md
CHANGED
|
@@ -6,27 +6,41 @@
|
|
|
6
6
|
|
|
7
7
|
Library for parsing MPEG-DASH (.mpd) and HLS (.m3u8) manifests. Made with the purpose of obtaining a simplified representation convenient for further downloading of segments.
|
|
8
8
|
|
|
9
|
+
> [!WARNING]
|
|
10
|
+
> This README is for the alpha version. Info about latest stable version is available on [NPM](https://www.npmjs.com/package/dasha/v/3.1.5) or [another GitHub branch](https://github.com/streamyx-labs/dasha/tree/v3).
|
|
11
|
+
|
|
12
|
+
|
|
9
13
|
## Install
|
|
10
14
|
|
|
11
15
|
```shell
|
|
12
|
-
npm i dasha
|
|
16
|
+
npm i dasha@4.0.0-alpha.1
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Usage
|
|
16
20
|
|
|
17
21
|
```js
|
|
18
22
|
import fs from 'node:fs/promises';
|
|
19
23
|
import { parse } from 'dasha';
|
|
20
24
|
|
|
21
|
-
const url =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
for (const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const url = 'https://dash.akamaized.net/dash264/TestCases/1a/sony/SNE_DASH_SD_CASE1A_REVISED.mpd';
|
|
26
|
+
const streamExtractor = new StreamExtractor();
|
|
27
|
+
await streamExtractor.loadSourceFromUrl(url);
|
|
28
|
+
const streams = await streamExtractor.extractStreams();
|
|
29
|
+
|
|
30
|
+
for (const stream of streams) {
|
|
31
|
+
const segments = stream.playlist?.mediaParts[0].mediaSegments || [];
|
|
32
|
+
const filename = `${stream.name}_${stream.groupId}`;
|
|
33
|
+
for (const segment of segments) {
|
|
34
|
+
const content = await fetch(segment.url).then((res) => res.arrayBuffer());
|
|
35
|
+
await fs.appendFile(`${filename}.${stream.extension}`, content);
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
```
|
|
39
|
+
|
|
40
|
+
## Credits
|
|
41
|
+
|
|
42
|
+
This project is heavily influenced by the robust implementation found in [N_m3u8DL-RE](https://github.com/nilaoda/N_m3u8DL-RE). Special thanks to the open-source community and contributors who make projects like this possible.
|
|
43
|
+
|
|
44
|
+
## Licenses
|
|
45
|
+
|
|
46
|
+
This project is licensed under the [MIT License](LICENSE).
|