dasha 4.0.0-alpha.10 → 4.0.0-alpha.11

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/dist/dasha.cjs CHANGED
@@ -25,6 +25,8 @@ let node_crypto = require("node:crypto");
25
25
  node_crypto = __toESM(node_crypto);
26
26
  let node_fs = require("node:fs");
27
27
  let barsic = require("barsic");
28
+ let ky = require("ky");
29
+ ky = __toESM(ky);
28
30
  let node_fs_promises = require("node:fs/promises");
29
31
  let node_url = require("node:url");
30
32
  let node_path = require("node:path");
@@ -505,7 +507,7 @@ var DefaultHlsKeyProcessor = class {
505
507
  async fetchKeyWithRetry(url, parserConfig) {
506
508
  let retryCount = parserConfig.keyRetryCount ?? 3;
507
509
  while (retryCount >= 0) try {
508
- const response = await fetch(url, { headers: parserConfig.headers });
510
+ const response = await (0, ky.default)(url, { headers: parserConfig.headers });
509
511
  return new Uint8Array(await response.arrayBuffer());
510
512
  } catch (error) {
511
513
  if (error.message.includes("scheme is not supported")) throw error;
@@ -1201,7 +1203,7 @@ var DashExtractor = class DashExtractor {
1201
1203
  }
1202
1204
  async refreshPlayList(streamInfos) {
1203
1205
  if (!streamInfos.length) return;
1204
- const response = await fetch(this.#parserConfig.url, this.#parserConfig.headers).catch(() => fetch(this.#parserConfig.originalUrl, this.#parserConfig.headers));
1206
+ const response = await (0, ky.default)(this.#parserConfig.url, this.#parserConfig.headers).catch(() => (0, ky.default)(this.#parserConfig.originalUrl, this.#parserConfig.headers));
1205
1207
  const rawText = await response.text();
1206
1208
  const url = response.url;
1207
1209
  this.#parserConfig.url = url;
@@ -1491,12 +1493,12 @@ var HlsExtractor = class {
1491
1493
  const filePath = new URL(url).pathname;
1492
1494
  this.#m3u8Content = await (0, node_fs_promises.readFile)(filePath, "utf8");
1493
1495
  } else if (url.startsWith("http")) try {
1494
- const response = await fetch(url, { headers: this.parserConfig.headers });
1496
+ const response = await (0, ky.default)(url, { headers: this.parserConfig.headers });
1495
1497
  url = response.url;
1496
1498
  this.#m3u8Content = await response.text();
1497
1499
  } catch (e) {
1498
1500
  if (this.parserConfig.originalUrl.startsWith("http") && url !== this.parserConfig.originalUrl) {
1499
- const response = await fetch(this.parserConfig.originalUrl, { headers: this.parserConfig.headers });
1501
+ const response = await (0, ky.default)(this.parserConfig.originalUrl, { headers: this.parserConfig.headers });
1500
1502
  url = response.url;
1501
1503
  this.#m3u8Content = await response.text();
1502
1504
  }
@@ -1563,7 +1565,7 @@ var StreamExtractor = class {
1563
1565
  this.#setUrl(url);
1564
1566
  } else if (url.startsWith("http")) {
1565
1567
  this.#parserConfig.originalUrl = url;
1566
- const response = await fetch(url, { headers: this.#parserConfig.headers });
1568
+ const response = await (0, ky.default)(url, { headers: this.#parserConfig.headers });
1567
1569
  this.#rawText = await response.text();
1568
1570
  this.#parserConfig.url = response.url;
1569
1571
  } else if ((0, node_fs.existsSync)(url)) {
package/dist/dasha.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import crypto from "node:crypto";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { b } from "barsic";
4
+ import fetch from "ky";
4
5
  import { readFile } from "node:fs/promises";
5
6
  import { pathToFileURL } from "node:url";
6
7
  import path from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dasha",
3
- "version": "4.0.0-alpha.10",
3
+ "version": "4.0.0-alpha.11",
4
4
  "description": "Streaming manifest parser",
5
5
  "files": [
6
6
  "dist"
@@ -63,6 +63,7 @@
63
63
  "dependencies": {
64
64
  "@xmldom/xmldom": "^0.9.8",
65
65
  "barsic": "^0.2.0",
66
+ "ky": "^1.14.2",
66
67
  "temporal-polyfill": "^0.3.0"
67
68
  },
68
69
  "devDependencies": {