googlevideo 1.0.0 → 1.1.0

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.
Files changed (30) hide show
  1. package/LICENSE +9 -9
  2. package/README.md +66 -66
  3. package/bundle/index.cjs +1 -1
  4. package/bundle/index.cjs.map +2 -2
  5. package/dist/protos/generated/misc/common.js +1 -1
  6. package/dist/protos/generated/video_streaming/buffered_range.js +1 -1
  7. package/dist/protos/generated/video_streaming/client_abr_state.js +1 -1
  8. package/dist/protos/generated/video_streaming/crypto_params.js +1 -1
  9. package/dist/protos/generated/video_streaming/encrypted_player_request.js +1 -1
  10. package/dist/protos/generated/video_streaming/format_initialization_metadata.js +1 -1
  11. package/dist/protos/generated/video_streaming/media_capabilities.js +1 -1
  12. package/dist/protos/generated/video_streaming/media_header.js +1 -1
  13. package/dist/protos/generated/video_streaming/next_request_policy.js +1 -1
  14. package/dist/protos/generated/video_streaming/onesie_header.js +1 -1
  15. package/dist/protos/generated/video_streaming/onesie_header_type.js +1 -1
  16. package/dist/protos/generated/video_streaming/onesie_player_request.js +1 -1
  17. package/dist/protos/generated/video_streaming/onesie_player_response.js +1 -1
  18. package/dist/protos/generated/video_streaming/onesie_request.js +1 -1
  19. package/dist/protos/generated/video_streaming/playback_cookie.js +1 -1
  20. package/dist/protos/generated/video_streaming/playback_start_policy.js +1 -1
  21. package/dist/protos/generated/video_streaming/proxy_status.js +1 -1
  22. package/dist/protos/generated/video_streaming/request_cancellation_policy.js +1 -1
  23. package/dist/protos/generated/video_streaming/sabr_error.js +1 -1
  24. package/dist/protos/generated/video_streaming/sabr_redirect.js +1 -1
  25. package/dist/protos/generated/video_streaming/stream_protection_status.js +1 -1
  26. package/dist/protos/generated/video_streaming/streamer_context.js +1 -1
  27. package/dist/protos/generated/video_streaming/time_range.js +1 -1
  28. package/dist/protos/generated/video_streaming/video_playback_abr_request.js +1 -1
  29. package/dist/src/core/ServerAbrStream.js +1 -1
  30. package/package.json +59 -61
package/LICENSE CHANGED
@@ -1,9 +1,9 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 LuanRT
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 LuanRT
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,66 +1,66 @@
1
- # What Is This?
2
- This is a collection of utilities for working with Google Video APIs, with a primary focus on UMP.
3
-
4
- * [Video Streaming Protos](./protos/video_streaming/)
5
- * [UMP (Parser)](./src/core/UMP.ts)
6
- * [ServerAbrStream (SABR Client)](./src/core/ServerAbrStream.ts)
7
- * [ChunkedDataBuffer (Buffer Manager)](./src/core/ChunkedDataBuffer.ts)
8
-
9
- The protobuf definitions were extracted from YouTube's Android and iOS clients, and the UMP parser and buffer manager are based on the implementation currently found on youtube.com.
10
-
11
- Usage examples can be found [here](./examples/).
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install github:LuanRT/googlevideo
17
- ```
18
-
19
- ## Basic Usage
20
-
21
- ```typescript
22
- import GoogleVideo, { PART, Protos } from 'googlevideo';
23
-
24
- const streamingUrl = 'https://abcd--a.googlevideo.com/videoplayback?...';
25
-
26
- const response = await fetch(streamingUrl, { method: 'POST' });
27
-
28
- const arrayBuffer = await response.arrayBuffer();
29
-
30
- const dataBuffer = new GoogleVideo.ChunkedDataBuffer();
31
- dataBuffer.append(new Uint8Array(arrayBuffer));
32
-
33
- const googUmp = new GoogleVideo.UMP(dataBuffer);
34
-
35
- googUmp.parse((part) => {
36
- switch (part.type) {
37
- case PART.MEDIA_HEADER: {
38
- console.log('[MediaHeader]:', Protos.MediaHeader.decode(part.data.chunks[0]));
39
- break;
40
- }
41
- case PART.MEDIA: {
42
- const headerId = part.data.getUint8(0);
43
- const streamData = part.data.split(1).remainingBuffer;
44
- console.log('[Media]:', `Header ID: ${headerId}`, `length: ${streamData.getLength()}`);
45
- break;
46
- }
47
- case PART.MEDIA_END: {
48
- const headerId = part.data.getUint8(0);
49
- console.log('[MediaEnd]:', `Header ID: ${headerId}`);
50
- break;
51
- }
52
- default:
53
- console.log('Unhandled part:', part.type);
54
- break;
55
- }
56
- });
57
- ```
58
-
59
- For more advanced examples, including scenarios beyond just parsing responses, check out the [examples](./examples/).
60
-
61
- ## License
62
- Distributed under the [MIT](./LICENSE) License.
63
-
64
- <p align="right">
65
- (<a href="#top">back to top</a>)
66
- </p>
1
+ # What Is This?
2
+ This is a collection of utilities for working with Google Video APIs, with a primary focus on UMP.
3
+
4
+ * [Video Streaming Protos](./protos/video_streaming/)
5
+ * [UMP (Parser)](./src/core/UMP.ts)
6
+ * [ServerAbrStream (SABR Client)](./src/core/ServerAbrStream.ts)
7
+ * [ChunkedDataBuffer (Buffer Manager)](./src/core/ChunkedDataBuffer.ts)
8
+
9
+ The protobuf definitions were extracted from YouTube's Android and iOS clients, and the UMP parser and buffer manager are based on the implementation currently found on youtube.com.
10
+
11
+ Usage examples can be found [here](./examples/).
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install googlevideo
17
+ ```
18
+
19
+ ## Basic Usage
20
+
21
+ ```typescript
22
+ import GoogleVideo, { PART, Protos } from 'googlevideo';
23
+
24
+ const streamingUrl = 'https://abcd--a.googlevideo.com/videoplayback?...';
25
+
26
+ const response = await fetch(streamingUrl, { method: 'POST' });
27
+
28
+ const arrayBuffer = await response.arrayBuffer();
29
+
30
+ const dataBuffer = new GoogleVideo.ChunkedDataBuffer();
31
+ dataBuffer.append(new Uint8Array(arrayBuffer));
32
+
33
+ const googUmp = new GoogleVideo.UMP(dataBuffer);
34
+
35
+ googUmp.parse((part) => {
36
+ switch (part.type) {
37
+ case PART.MEDIA_HEADER: {
38
+ console.log('[MediaHeader]:', Protos.MediaHeader.decode(part.data.chunks[0]));
39
+ break;
40
+ }
41
+ case PART.MEDIA: {
42
+ const headerId = part.data.getUint8(0);
43
+ const streamData = part.data.split(1).remainingBuffer;
44
+ console.log('[Media]:', `Header ID: ${headerId}`, `length: ${streamData.getLength()}`);
45
+ break;
46
+ }
47
+ case PART.MEDIA_END: {
48
+ const headerId = part.data.getUint8(0);
49
+ console.log('[MediaEnd]:', `Header ID: ${headerId}`);
50
+ break;
51
+ }
52
+ default:
53
+ console.log('Unhandled part:', part.type);
54
+ break;
55
+ }
56
+ });
57
+ ```
58
+
59
+ For more advanced examples, including scenarios beyond just parsing responses, check out the [examples](./examples/).
60
+
61
+ ## License
62
+ Distributed under the [MIT](./LICENSE) License.
63
+
64
+ <p align="right">
65
+ (<a href="#top">back to top</a>)
66
+ </p>
package/bundle/index.cjs CHANGED
@@ -6918,7 +6918,7 @@ var ServerAbrStream = class extends EventEmitterLike {
6918
6918
  return (_a2 = fmt.mimeType) == null ? void 0 : _a2.includes("video");
6919
6919
  }) : data.initializedFormats[0];
6920
6920
  for (const fmt of data.initializedFormats) {
6921
- this.previousSequences.set(`${fmt.formatId.itag};${fmt.formatId.lastModified};`, fmt.sequenceList.map((seq) => seq.sequenceNumber || 0));
6921
+ this.previousSequences.set(fmt.formatKey, fmt.sequenceList.map((seq) => seq.sequenceNumber || 0));
6922
6922
  }
6923
6923
  if (!mainFormat || mainFormat.sequenceCount === ((_a = mainFormat.sequenceList[mainFormat.sequenceList.length - 1]) == null ? void 0 : _a.sequenceNumber)) {
6924
6924
  this.emit("end", data);