fast-dirpy 0.1.9 → 0.2.1

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 CHANGED
@@ -16,8 +16,24 @@ A simple library/CLI to download youtube(etc.) videos.
16
16
  - [YouTube](https://www.youtube.com/)
17
17
  - [Bilibili](https://www.bilibili.com/)
18
18
 
19
+ <details>
20
+ <summary>NSFW</summary>
21
+
22
+ * [Animehentai](https://animeidhentai.com/)
23
+ * [Koreanpornmovies](https://koreanpornmovie.com/)
24
+ * [XVideos](https://www.xvideos.com/)
25
+ * [Missav](https://missav.ws/) (m3u8)
26
+ </details>
27
+
28
+
19
29
  And `.m3u8` videos(using `ffmpeg`).
20
30
 
31
+ > [!IMPORTANT]
32
+ > From v0.2.1, .m3u8 downloader is no longer using ffmpeg.
33
+ > And it doesn't provide proxy settings, so, you need to use `export https_proxy=http://ip:port` to set proxy manually in terminal.
34
+
35
+ You can use this [userscript](https://greasyfork.org/zh-CN/scripts/449581-m3u8%E8%A7%86%E9%A2%91%E4%BE%A6%E6%B5%8B%E4%B8%8B%E8%BD%BD%E5%99%A8-%E8%87%AA%E5%8A%A8%E5%97%85%E6%8E%A2) to extract `.m3u8` sources from websites.
36
+
21
37
  ## Installation
22
38
 
23
39
  ### As a library
@@ -33,6 +49,10 @@ deno add jsr:@vince-g/fast-dirpy
33
49
  npm i fast-dirpy -g
34
50
  ```
35
51
 
52
+ ### Additional: download `ffmpeg`
53
+
54
+ https://www.ffmpeg.org/download.html
55
+
36
56
  ## Usage
37
57
 
38
58
  ### Config file
@@ -68,8 +88,7 @@ export default defineConfig({
68
88
  ### Use in command line
69
89
 
70
90
  > [!IMPORTANT]
71
- > 1. Some website listed in [Supported Websites](#supported-websites) requires Google Chrome installed for Puppeteer use. You have to use a config file or give parameter of puppeteer executable path.
72
- > 2. `.m3u8` source is handled by `ffmpeg`, please download it if you want to download `.m3u8` videos.
91
+ > Some website listed in [Supported Websites](#supported-websites) requires Google Chrome installed for Puppeteer use. You have to use a config file or give parameter of puppeteer executable path.
73
92
 
74
93
  #### Get Direct Link
75
94
 
@@ -97,7 +116,7 @@ fast-dirpy get https\://www.youtube.com/watch\?v\=6c28qWDMPBA
97
116
 
98
117
  > [!IMPORTANT]
99
118
  > 1. Some website listed in [Supported Websites](#supported-websites) requires Google Chrome installed for Puppeteer use. You have to use a config file or give parameter of puppeteer executable path.
100
- > 2. `.m3u8` source is handled by `ffmpeg`, please download it if you want to download `.m3u8` videos.
119
+ > 2. `.m3u8` source is handled by `ffmpeg`.
101
120
 
102
121
  ```shell
103
122
  # get video direct link
@@ -112,12 +131,10 @@ fast-dirpy get https\://www.youtube.com/watch\?v\=6c28qWDMPBA
112
131
  fast-dirpy download https\://www.youtube.com/watch\?v\=6c28qWDMPBA -p ./test.mp4 -H 127.0.0.1 -P 7890
113
132
 
114
133
  # Bilibili source doesn't need any proxy, so it's disabled by default.
115
- fast-dirpy download https://www.bilibili.com/video/BV1TSPeeGE35 -p ./test.mp4
116
- ```
134
+ fast-dirpy download https\://www.bilibili.com/video/BV1TSPeeGE35 -p ./test.mp4
117
135
 
118
136
  # m3u8 sources
119
- ```
120
- fast-dirpy download https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8 -p ./test.mp4
137
+ fast-dirpy download https\://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8 -p ./test.mp4
121
138
  ```
122
139
 
123
140
  if you have set your proxy config in `fast-dirpy.config.ts`, you can omit proxy parameters:
@@ -132,15 +149,13 @@ For further CLI help:
132
149
  fast-dirpy --help
133
150
  ```
134
151
 
135
- ### Download and parse `.m3u8` files
136
-
137
152
  ### Use as a library
138
153
 
139
154
  > [!IMPORTANT]
140
155
  > If a website is listed in [Supported Websites](#supported-websites), then `getXXXLink` is to get direct link and `downloadXXX` is to download video.
141
156
 
142
157
  ```ts
143
- import { downloadDirpy, remoteM3U8ToMP4, getBilibiliLink, getDirpyLink } from 'fast-dirpy'
158
+ import { downloadDirpy, getBilibiliLink, getDirpyLink, remoteM3U8ToMP4 } from 'fast-dirpy'
144
159
 
145
160
  // get direct link
146
161
  const link = await getDirpyLink(
@@ -181,7 +196,6 @@ await remoteM3U8ToMP4({
181
196
  input: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
182
197
  output: './test.mp4',
183
198
  })
184
-
185
199
  ```
186
200
 
187
201
  ## Test
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "fast-dirpy",
3
3
  "type": "module",
4
- "version": "0.1.9",
5
- "description": "A simple library/CLI to download video using dirpy.com",
4
+ "version": "0.2.1",
5
+ "description": "A simple library/CLI to download video from several websites.",
6
6
  "author": "Vincent-the-gamer",
7
7
  "license": "MIT",
8
8
  "homepage": "https://github.com/Vincent-the-gamer/fast-dirpy#readme",
@@ -36,31 +36,32 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "ansis": "^4.0.0",
40
- "axios": "^1.9.0",
39
+ "ansis": "^4.2.0",
40
+ "axios": "^1.12.2",
41
41
  "cac": "^6.7.14",
42
- "cheerio": "^1.0.0",
42
+ "cheerio": "^1.1.2",
43
43
  "consola": "^3.4.2",
44
- "puppeteer-core": "^24.9.0",
44
+ "m3u8stream": "^0.8.6",
45
+ "puppeteer-core": "^24.23.0",
45
46
  "restore-cursor": "^5.1.0",
46
- "unconfig": "^7.3.2"
47
+ "unconfig": "^7.3.3"
47
48
  },
48
49
  "devDependencies": {
49
- "@antfu/eslint-config": "^4.13.2",
50
- "@types/node": "^22.15.21",
50
+ "@antfu/eslint-config": "^5.4.1",
51
+ "@types/node": "^24.7.0",
51
52
  "deepmerge": "^4.3.1",
52
- "eslint": "^9.27.0",
53
- "taze": "^19.1.0",
54
- "tsdown": "^0.12.3",
55
- "tsx": "^4.19.4",
56
- "typescript": "^5.8.3",
57
- "vitest": "^3.1.4"
53
+ "eslint": "^9.37.0",
54
+ "taze": "^19.7.0",
55
+ "tsdown": "^0.15.6",
56
+ "tsx": "^4.20.6",
57
+ "typescript": "^5.9.3",
58
+ "vitest": "^3.2.4"
58
59
  },
59
60
  "scripts": {
60
61
  "tsx": "tsx",
61
62
  "build": "tsdown",
62
63
  "test": "vitest",
63
- "dep": "taze major",
64
+ "dep": "taze major -I",
64
65
  "lint:fix": "eslint . --fix",
65
66
  "login": "pnpm login --registry https://registry.npmjs.com"
66
67
  }
package/dist/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- export { };
package/dist/cli.js DELETED
@@ -1 +0,0 @@
1
- import{UrlType as e,downloadAnimeIdHentai as t,downloadBilibili as n,downloadDirpy as r,getAnimeIdHentaiLink as i,getBilibiliLink as a,getDirpyLink as o,logger as s,remoteM3U8ToMP4 as c,setSilent as l}from"./types-DKWCe0OV.js";import{bold as u,dim as d}from"ansis";import{cac as f}from"cac";import p from"restore-cursor";var m=`fast-dirpy`,h=`module`,g=`0.1.9`,_=`A simple library/CLI to download video using dirpy.com`,v=`Vincent-the-gamer`,y=`MIT`,b=`https://github.com/Vincent-the-gamer/fast-dirpy#readme`,x={type:`git`,url:`git+https://github.com/Vincent-the-gamer/fast-dirpy.git`},S={url:`https://github.com/Vincent-the-gamer/fast-dirpy/issues`},C=!1,w=`dist/index.js`,T=`dist/index.js`,E=`dist/index.d.ts`,D={"*":{".":[`./dist/index.d.ts`,`./dist/cli.d.ts`]}},O={"fast-dirpy":`bin/fast-dirpy.js`},k=[`dist`],A={tsx:`tsx`,build:`tsdown`,test:`vitest`,dep:`taze major`,"lint:fix":`eslint . --fix`,login:`pnpm login --registry https://registry.npmjs.com`},j={registry:`https://registry.npmjs.com`,access:`public`},M={ansis:`^4.0.0`,axios:`^1.9.0`,cac:`^6.7.14`,cheerio:`^1.0.0`,consola:`^3.4.2`,"puppeteer-core":`^24.9.0`,"restore-cursor":`^5.1.0`,unconfig:`^7.3.2`},N={"@antfu/eslint-config":`^4.13.2`,"@types/node":`^22.15.21`,deepmerge:`^4.3.1`,eslint:`^9.27.0`,taze:`^19.1.0`,tsdown:`^0.12.3`,tsx:`^4.19.4`,typescript:`^5.8.3`,vitest:`^3.1.4`},P={name:m,type:h,version:g,description:_,author:v,license:y,homepage:b,repository:x,bugs:S,sideEffects:C,main:w,module:T,types:E,typesVersions:D,bin:O,files:k,scripts:A,publishConfig:j,dependencies:M,devDependencies:N};function F(t){let n=/BV[a-zA-Z0-9]+/;return t.includes(`bilibili`)||n.test(t)?e.Bilibili:t.includes(`animeidhentai`)?e.AnimeIdHentai:t.endsWith(`.m3u8`)?e.M3U8:e.Dirpy}const I=f(`fast-dirpy`),{version:L}=P;I.command(`get <url>`,`get video direct link.`).option(`--proxyHost, -H <proxyHost>`,`Proxy host.`).option(`--proxyPort, -P <proxyPort>`,`Proxy port.`).option(`--config, -c <path>`,`Specify an external config file.`).option(`--silent`,`Suppress non-error logs`).option(`--chromePath`,`Path to your Google Chrome browser`).action(async(t,n)=>{let r=F(t),{proxyHost:c,proxyPort:f,config:p,silent:m,chromePath:h}=n,g=c?{proxy:{host:c,port:f}}:void 0,_=h?{puppeteer:{executablePath:h}}:void 0;if(l(!!m),s.info(`fast-dirpy ${d(`v${L}`)} : ${u(`Direct Link Getter`)}.`),r===e.Bilibili){if(s.info(`Matched link source: Bilibili.`),!t.includes(`bilibili.com`)){s.error(`Please provide a valid Bilibili URL.`);return}let e=await a(t);console.log(e)}else if(r===e.Dirpy){s.info(`Matched link source: Dirpy.`);let e=await o({url:t,cwd:p},g);console.log(e)}else if(r===e.AnimeIdHentai){s.info(`Matched link source: Animeidhentai.`);let e=await i({url:t,cwd:p},{...g,..._});console.log(e)}else s.error(`Your link is not supported!`)}),I.command(`download <url>`,`download a video.`).option(`--path, -p <path>`,`Download destination path + filename. e.g. /xxx/example.mp4.`).option(`--proxyHost, -H <proxyHost>`,`Proxy host.`).option(`--proxyPort, -P <proxyPort>`,`Proxy port.`).option(`--config, -c <path>`,`Specify an external config file.`).option(`--silent`,`Suppress non-error logs`).option(`--chromePath`,`Path to your Google Chrome browser`).action(async(i,a)=>{let o=F(i),{proxyHost:f,proxyPort:p,path:m,config:h,silent:g,chromePath:_}=a,v=f?{proxy:{host:f,port:p}}:void 0,y=_?{puppeteer:{executablePath:_}}:void 0;l(!!g),s.info(`fast-dirpy ${d(`v${L}`)} : ${u(`Video Downloader`)}.`),o===e.Bilibili?(s.info(`Matched link source: Bilibili.`),await n({url:i,path:m})):o===e.Dirpy?(s.info(`Matched link source: Dirpy.`),r({url:i,path:m||`./dirpy.mp4`,cwd:h},v)):o===e.AnimeIdHentai?(s.info(`Matched link source: AnimeIdHentai.`),await t({url:i,path:m||`./animeidhentai.mp4`,cwd:h},{...v,...y})):o===e.M3U8?(s.info(`Matched link source: m3u8.`),await c({input:i,output:m||`./m3u8-download.mp4`,cwd:h})):s.error(`Your link is not supported!`)}),I.help(),I.version(P.version),I.parse(),p();
@@ -1,34 +0,0 @@
1
- //#region src/types/index.d.ts
2
- interface Options {
3
- proxy?: {
4
- protocol?: string;
5
- host: string;
6
- port: number;
7
- };
8
- timeout?: number;
9
- puppeteer?: {
10
- executablePath: string;
11
- headless?: boolean;
12
- };
13
- ffmpeg?: string;
14
- }
15
- interface DirectLinkParams {
16
- url: string;
17
- cwd?: string;
18
- }
19
- interface DownloadParams {
20
- url: string;
21
- path: string;
22
- cwd?: string;
23
- }
24
- declare enum UrlType {
25
- Bilibili = 0,
26
- AnimeIdHentai = 1,
27
- Dirpy = 2,
28
- M3U8 = 3,
29
- } //#endregion
30
- //#region src/config.d.ts
31
- declare function defineConfig(options: Options): Options;
32
-
33
- //#endregion
34
- export { DirectLinkParams, DownloadParams, Options, UrlType as UrlType$1, defineConfig as defineConfig$1 };
@@ -1 +0,0 @@
1
- function e(e){return e}export{e as defineConfig};
package/dist/config.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { defineConfig$1 as defineConfig } from "./config-BQe32DQp.js";
2
- export { defineConfig };
package/dist/config.js DELETED
@@ -1 +0,0 @@
1
- import{defineConfig as e}from"./config-ld9QlYHr.js";export{e as defineConfig};
package/dist/index.d.ts DELETED
@@ -1,34 +0,0 @@
1
- import { DirectLinkParams, DownloadParams, Options, UrlType$1 as UrlType, defineConfig$1 as defineConfig } from "./config-BQe32DQp.js";
2
-
3
- //#region src/core/animeidhentai.d.ts
4
- declare function getAnimeIdHentaiLink(params: DirectLinkParams, options?: Partial<Options>): Promise<string>;
5
- declare function downloadAnimeIdHentai(params: DownloadParams, options?: Partial<Options>): Promise<void>;
6
-
7
- //#endregion
8
- //#region src/core/bilibili.d.ts
9
- declare function getBilibiliLink(link: string): string;
10
- declare function downloadBilibili(params: DownloadParams): Promise<void>;
11
-
12
- //#endregion
13
- //#region src/core/dirpy.d.ts
14
- declare function getDirpyLink(params: DirectLinkParams, options?: Partial<Options>): Promise<string>;
15
- declare function downloadDirpy(params: DownloadParams, options?: Partial<Options>): Promise<void>;
16
-
17
- //#endregion
18
- //#region src/core/m3u8.d.ts
19
- interface M3U8ParserParams {
20
- input: string;
21
- output: string;
22
- cwd?: string;
23
- }
24
- /**
25
- * Get remote m3u8 stream, then use ffmpeg to parse it to mp4.
26
- */
27
- declare function remoteM3U8ToMP4(params: M3U8ParserParams, options?: Partial<Options>): Promise<void>;
28
-
29
- //#endregion
30
- //#region src/core/index.d.ts
31
- declare function downloadVideo(params: DownloadParams, options?: Partial<Options>): Promise<void>;
32
-
33
- //#endregion
34
- export { DirectLinkParams, DownloadParams, Options, UrlType, defineConfig, downloadAnimeIdHentai, downloadBilibili, downloadDirpy, downloadVideo, getAnimeIdHentaiLink, getBilibiliLink, getDirpyLink, remoteM3U8ToMP4 };
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- import{UrlType as e,downloadAnimeIdHentai as t,downloadBilibili as n,downloadDirpy as r,downloadVideo as i,getAnimeIdHentaiLink as a,getBilibiliLink as o,getDirpyLink as s,remoteM3U8ToMP4 as c}from"./types-DKWCe0OV.js";import{defineConfig as l}from"./config-ld9QlYHr.js";export{e as UrlType,l as defineConfig,t as downloadAnimeIdHentai,n as downloadBilibili,r as downloadDirpy,i as downloadVideo,a as getAnimeIdHentaiLink,o as getBilibiliLink,s as getDirpyLink,c as remoteM3U8ToMP4};
@@ -1 +0,0 @@
1
- import e from"node:fs";import t from"axios";import{createConfigLoader as n}from"unconfig";import r from"node:process";import{consola as i}from"consola";import{load as a}from"cheerio";import o from"puppeteer-core";import{spawn as s}from"node:child_process";var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:c(f(e)),h(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e));const _={timeout:2e4};var v=m((exports,t)=>{var n=function(e){return r(e)&&!i(e)};function r(e){return!!e&&typeof e==`object`}function i(e){var t=Object.prototype.toString.call(e);return t===`[object RegExp]`||t===`[object Date]`||s(e)}var a=typeof Symbol==`function`&&Symbol.for,o=a?Symbol.for(`react.element`):60103;function s(e){return e.$$typeof===o}function c(e){return Array.isArray(e)?[]:{}}function l(e,t){return t.clone!==!1&&t.isMergeableObject(e)?_(c(e),e,t):e}function u(e,t,n){return e.concat(t).map(function(e){return l(e,n)})}function d(e,t){if(!t.customMerge)return _;var n=t.customMerge(e);return typeof n==`function`?n:_}function f(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function p(e){return Object.keys(e).concat(f(e))}function m(e,t){try{return t in e}catch{return!1}}function h(e,t){return m(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function g(e,t,n){var r={};return n.isMergeableObject(e)&&p(e).forEach(function(t){r[t]=l(e[t],n)}),p(t).forEach(function(i){h(e,i)||(m(e,i)&&n.isMergeableObject(t[i])?r[i]=d(i,n)(e[i],t[i],n):r[i]=l(t[i],n))}),r}function _(e,t,r){r||={},r.arrayMerge=r.arrayMerge||u,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=l;var i=Array.isArray(t),a=Array.isArray(e),o=i===a;return o?i?r.arrayMerge(e,t,r):g(e,t,r):l(t,r)}_.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return _(e,n,t)},{})};var v=_;t.exports=v});const y=i.withTag(`fast-dirpy`);function b(e){`CONSOLA_LEVEL`in r.env||(y.level=e?0:3)}var x=g(v(),1);async function S(e,t){let r=_,i=n({sources:[{files:[`fast-dirpy.config`],extensions:[`ts`,`mts`,`cts`,`js`,`mjs`,`cjs`,`json`]}],cwd:t||process.cwd(),merge:!1}),{config:a,sources:o}=await i.load();return o.length?(y.info(`Config file found: ${o[0]}`),(0,x.default)((0,x.default)(r,a),e)):(0,x.default)(r,e)}function C(e){let t=Math.floor(Math.random()*e.length);return e[t]}const w=[`Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10`,`Mozilla/5.0 (Windows NT 6.1; rv,2.0.1) Gecko/20100101 Firefox/4.0.1`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36`,`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/27.0.1453.93 Chrome/27.0.1453.93 Safari/537.36`];function T(){return C(w)}async function E(e){let t=await o.launch(e);return t}async function D(e,n=_){let{url:r,cwd:i}=e,{proxy:o,timeout:s}=await S(n,i),c=o?.host===``?void 0:o,{data:l}=await t.get(r,{headers:{"User-Agent":T()},proxy:c,timeout:s}),u=a(l),d=``,f=u(`div.embed.rad2 > iframe`).attr();return f&&(d=f.src),d}async function O(e,t=_){let{url:n,cwd:r}=e,{proxy:i,puppeteer:a}=await S(t,r),o=i?.host===``?void 0:i,s=await D({url:n},{proxy:o}),{executablePath:c,headless:l}=a,u=await E({executablePath:c,headless:l,args:[`--proxy-server=http://${o?.host}:${i?.port}`]}),d=T(),f=await u.newPage();await f.setUserAgent(d),await f.goto(s),await f.waitForSelector(`div.play.p-pulse`),await f.click(`div.play.p-pulse`),await f.waitForSelector(`div.frame > iframe`);let p=await f.$eval(`div.frame > iframe`,e=>e.src),m=await u.newPage();await m.goto(`${p}`),await m.waitForSelector(`video.jw-video.jw-reset`);let h=await m.$eval(`video.jw-video.jw-reset`,e=>e.src);return await u.close(),h}async function k(e,t=_){let{path:n,url:r,cwd:i}=e,a=await O({url:r},t);await F({url:a,path:n,cwd:i},t)}function A(e){let t=e.match(/BV[a-zA-Z0-9]+/);if(t){let e=`https://bilibili-real-url.deno.dev/${t[0]}.mp4`;return e}return``}async function j(e){let{path:t,url:n}=e,r=A(n);r===``?console.error(`Extract direct link failed!`):await F({url:r,path:t||`./download.mp4`})}async function M(e,n=_){let{url:r,cwd:i}=e,{proxy:o,timeout:s}=await S(n,i),c=o?.host===``?void 0:o,{data:l}=await t.get(`https://dirpy.com/studio`,{params:{url:r},headers:{"User-Agent":T(),Referer:`https://dirpy.com/studio?url=${r}`},proxy:c,timeout:s}),u=a(l),d=``,f=u(`#media-source`).attr();return f&&(d=f.src),d}async function N(e,t=_){let{path:n,url:r,cwd:i}=e,a=await M({url:r},t);await F({url:a,path:n,cwd:i},t)}async function P(e,t=_){let{cwd:n,input:r,output:i}=e,{ffmpeg:a,proxy:o}=await S(t,n),c=o?.host===``?void 0:o,l=s(a||`ffmpeg`,[`-http_proxy`,`${c?.protocol}://${c?.host}:${c?.port}`,`-i`,r,`-bsf:a`,`aac_adtstoasc`,`-vcodec`,`copy`,`-acodec`,`copy`,`-crf`,`50`,i],{stdio:`inherit`,shell:process.platform===`win32`});l.stdout?.on(`data`,e=>{y.info(e)}),l.stderr?.on(`data`,e=>{y.error(`FFmpeg stderr: ${e.toString()}`),process.exit(1)}),l.stdin?.on(`error`,e=>{y.error(e),process.exit(1)}),process.exit(0)}async function F(n,r=_){let{path:i,url:a}=n,{proxy:o,timeout:s}=await S(r),c=o?.host===``?void 0:o;if(a===``)return Promise.reject(`Extract direct link failed!`);let l=e.createWriteStream(i),u=await t({url:a,headers:{"User-Agent":T()},method:`GET`,responseType:`stream`,proxy:c,timeout:s,onDownloadProgress:e=>{let{loaded:t,total:n,progress:r}=e,i=`loaded:${t} total: ${n} progress: ${(r*100).toFixed(2)}%`;y.info(i)}});return u.data.pipe(l),new Promise((e,t)=>{l.on(`finish`,e),l.on(`error`,t)})}let I=function(e){return e[e.Bilibili=0]=`Bilibili`,e[e.AnimeIdHentai=1]=`AnimeIdHentai`,e[e.Dirpy=2]=`Dirpy`,e[e.M3U8=3]=`M3U8`,e}({});export{I as UrlType,k as downloadAnimeIdHentai,j as downloadBilibili,N as downloadDirpy,F as downloadVideo,O as getAnimeIdHentaiLink,A as getBilibiliLink,M as getDirpyLink,y as logger,P as remoteM3U8ToMP4,b as setSilent};