yt-transcript-strapi-plugin 0.0.20 → 0.0.21

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.
@@ -683,13 +683,16 @@ async function initializeModel({
683
683
  maxTokens: 1e3
684
684
  });
685
685
  }
686
+ function isRequestLike(input) {
687
+ return typeof input === "object" && input !== null && "url" in input && typeof input.url === "string" && "method" in input;
688
+ }
686
689
  function createProxyFetch(proxyUrl) {
687
690
  if (!proxyUrl) {
688
691
  return void 0;
689
692
  }
690
693
  const proxyAgent = new undici.ProxyAgent(proxyUrl);
691
694
  return async (input, init) => {
692
- if (input instanceof Request) {
695
+ if (isRequestLike(input)) {
693
696
  const url = input.url;
694
697
  return undici.fetch(url, {
695
698
  method: input.method,
@@ -699,7 +702,8 @@ function createProxyFetch(proxyUrl) {
699
702
  dispatcher: proxyAgent
700
703
  });
701
704
  }
702
- return undici.fetch(input, { ...init, dispatcher: proxyAgent });
705
+ const urlString = input instanceof URL ? input.toString() : input;
706
+ return undici.fetch(urlString, { ...init, dispatcher: proxyAgent });
703
707
  };
704
708
  }
705
709
  function decodeHtmlEntities(text) {
@@ -682,13 +682,16 @@ async function initializeModel({
682
682
  maxTokens: 1e3
683
683
  });
684
684
  }
685
+ function isRequestLike(input) {
686
+ return typeof input === "object" && input !== null && "url" in input && typeof input.url === "string" && "method" in input;
687
+ }
685
688
  function createProxyFetch(proxyUrl) {
686
689
  if (!proxyUrl) {
687
690
  return void 0;
688
691
  }
689
692
  const proxyAgent = new ProxyAgent(proxyUrl);
690
693
  return async (input, init) => {
691
- if (input instanceof Request) {
694
+ if (isRequestLike(input)) {
692
695
  const url = input.url;
693
696
  return fetch$1(url, {
694
697
  method: input.method,
@@ -698,7 +701,8 @@ function createProxyFetch(proxyUrl) {
698
701
  dispatcher: proxyAgent
699
702
  });
700
703
  }
701
- return fetch$1(input, { ...init, dispatcher: proxyAgent });
704
+ const urlString = input instanceof URL ? input.toString() : input;
705
+ return fetch$1(urlString, { ...init, dispatcher: proxyAgent });
702
706
  };
703
707
  }
704
708
  function decodeHtmlEntities(text) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.20",
2
+ "version": "0.0.21",
3
3
  "keywords": [
4
4
  "yt-transcript-strapi-plugin",
5
5
  "youtube",