fast-dirpy 0.3.2 → 0.3.3

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
@@ -130,6 +130,9 @@ fast-dirpy download https\://www.bilibili.com/video/BV1TSPeeGE35 -p ./test.mp4
130
130
 
131
131
  # m3u8 sources
132
132
  fast-dirpy download https\://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8 -p ./test.mp4
133
+
134
+ # mp4 sources
135
+ fast-dirpy download http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 -p ./big_buck_bunny.mp4
133
136
  ```
134
137
 
135
138
  if you have set your proxy config in `fast-dirpy.config.ts`, you can omit proxy parameters:
@@ -145,10 +148,6 @@ fast-dirpy --help
145
148
  ```
146
149
 
147
150
  ### Use as a library
148
-
149
- > [!IMPORTANT]
150
- > If a website is listed in [Supported Websites](#supported-websites), then `getXXXLink` is to get direct link and `downloadXXX` is to download video.
151
-
152
151
  ```ts
153
152
  import { fastLink, fastDownload } from 'fast-dirpy'
154
153
 
@@ -158,7 +157,7 @@ const link = await fastLink(
158
157
  url: '<url>',
159
158
  cwd: '/path/to/external-config' // Optional: You can specify an external config file.
160
159
  },
161
- // options (Optional, can be omitted if you have a config file, this can overwrite your config file options.)
160
+ // options (Optional, can be omitted if you have a config file, this will overwrites your config file options.)
162
161
  {
163
162
  proxy: { ... }
164
163
  }
@@ -170,16 +169,22 @@ await fastDownload({
170
169
  path: './download.mp4',
171
170
  cwd: '/path/to/external-config', // Optional: You can specify an external config file.
172
171
  },
173
- // options (Optional, can be omitted if you have a config file, this can overwrite your config file options.)
172
+ // options (Optional, can be omitted if you have a config file, this will overwrites your config file options.)
174
173
  {
175
174
  proxy: { ... }
176
175
  })
177
176
 
178
- // download `.m3u8` video
177
+ // Download `.m3u8` video
179
178
  await remoteM3U8ToMP4({
180
179
  url: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
181
180
  path: './test.mp4',
182
181
  })
182
+
183
+ // Download `.mp4` video
184
+ await downloadVideo({
185
+ url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
186
+ path: "./big_buck_bunny.mp4"
187
+ })
183
188
  ```
184
189
 
185
190
  ## Test
package/dist/cli.js CHANGED
@@ -1 +1 @@
1
- import{UrlType as e,downloadAnimeIdHentai as t,downloadBilibili as n,downloadDirpy as r,downloadKoreanPm as i,downloadMissav as a,getAnimeIdHentaiLink as o,getBilibiliLink as s,getDirpyLink as c,getKoreanPmLink as l,judgeUrl as u,logger as d,package_default as f,remoteM3U8ToMP4 as p,setSilent as m}from"./judgeUrl--jwX-SYw.js";import{bold as h,dim as g}from"ansis";import{cac as _}from"cac";import v from"restore-cursor";const y=_(`fast-dirpy`),{version:b}=f;y.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=u(t),{proxyHost:i,proxyPort:a,config:f,silent:p,chromePath:_}=n,v=i?{proxy:{host:i,port:a}}:void 0,y=_?{puppeteer:{executablePath:_}}:void 0;if(m(!!p),d.info(`fast-dirpy ${g(`v${b}`)} : ${h(`Direct Link Getter`)}.`),r===e.Bilibili){if(d.info(`Matched link source: Bilibili.`),!t.includes(`bilibili.com`)){d.error(`Please provide a valid Bilibili URL.`);return}let e=await s(t);console.log(e)}else if(r===e.Dirpy){d.info(`Matched link source: Dirpy.`);let e=await c({url:t,cwd:f},v);console.log(e)}else if(r===e.AnimeIdHentai){d.info(`Matched link source: Animeidhentai.`);let e=await o({url:t,cwd:f},{...v,...y});console.log(e)}else if(r===e.KoreanPM){d.info(`Matched link source: KoreanPM.`);let e=await l({url:t,cwd:f},v);console.log(e)}else d.error(`Your link is not supported!`)}),y.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(o,s)=>{let c=u(o),{proxyHost:l,proxyPort:f,path:_,config:v,silent:y,chromePath:x}=s,S=l?{proxy:{host:l,port:f}}:void 0,C=x?{puppeteer:{executablePath:x}}:void 0;m(!!y),d.info(`fast-dirpy ${g(`v${b}`)} : ${h(`Video Downloader`)}.`),c===e.Bilibili?(d.info(`Matched link source: Bilibili.`),await n({url:o,path:_})):c===e.Dirpy?(d.info(`Matched link source: Dirpy.`),r({url:o,path:_||`./dirpy.mp4`,cwd:v},S)):c===e.AnimeIdHentai?(d.info(`Matched link source: AnimeIdHentai.`),await t({url:o,path:_||`./animeidhentai.mp4`,cwd:v},{...S,...C})):c===e.KoreanPM?(d.info(`Matched link source: KoreanPM.`),await i({url:o,path:_||`./korean-pm.mp4`,cwd:v},S)):c===e.MissAV?(d.info(`Matched link source: MissAV.`),await a({url:o,path:_,cwd:v})):c===e.M3U8?(d.info(`Matched link source: m3u8.`),await p({url:o,path:_||`./m3u8-download.mp4`,cwd:v})):d.error(`Your link is not supported!`)}),y.help(),y.version(f.version),y.parse(),v();export{};
1
+ import{a as e,b as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,y as g}from"./judgeUrl-CQGcgriO.js";import{bold as _,dim as v}from"ansis";import{cac as y}from"cac";import b from"restore-cursor";const x=y(`fast-dirpy`),{version:S}=g;x.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(e,t)=>{let n=m(e),{proxyHost:i,proxyPort:c,config:u,silent:f,chromePath:h}=t,g=i?{proxy:{host:i,port:c}}:void 0,y=h?{puppeteer:{executablePath:h}}:void 0;if(a(!!f),o.info(`fast-dirpy ${v(`v${S}`)} : ${_(`Direct Link Getter`)}.`),n===l.Bilibili){if(o.info(`Matched link source: Bilibili.`),!e.includes(`bilibili.com`)){o.error(`Please provide a valid Bilibili URL.`);return}let t=await r(e);console.log(t)}else if(n===l.Dirpy){o.info(`Matched link source: Dirpy.`);let t=await s({url:e,cwd:u},g);console.log(t)}else if(n===l.AnimeIdHentai){o.info(`Matched link source: Animeidhentai.`);let t=await d({url:e,cwd:u},{...g,...y});console.log(t)}else if(n===l.KoreanPM){o.info(`Matched link source: KoreanPM.`);let t=await p({url:e,cwd:u},g);console.log(t)}else o.error(`Your link is not supported!`)}),x.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(t,r)=>{let s=m(t),{proxyHost:d,proxyPort:p,path:g,config:y,silent:b,chromePath:x}=r,C=d?{proxy:{host:d,port:p}}:void 0,w=x?{puppeteer:{executablePath:x}}:void 0;a(!!b),o.info(`fast-dirpy ${v(`v${S}`)} : ${_(`Video Downloader`)}.`),s===l.Bilibili?(o.info(`Matched link source: Bilibili.`),await h({url:t,path:g})):s===l.Dirpy?(o.info(`Matched link source: Dirpy.`),n({url:t,path:g||`./dirpy.mp4`,cwd:y},C)):s===l.AnimeIdHentai?(o.info(`Matched link source: AnimeIdHentai.`),await i({url:t,path:g||`./animeidhentai.mp4`,cwd:y},{...C,...w})):s===l.KoreanPM?(o.info(`Matched link source: KoreanPM.`),await u({url:t,path:g||`./korean-pm.mp4`,cwd:y},C)):s===l.MissAV?(o.info(`Matched link source: MissAV.`),await f({url:t,path:g,cwd:y})):s===l.M3U8?(o.info(`Matched link source: m3u8.`),await e({url:t,path:g||`./m3u8-download.mp4`,cwd:y})):s===l.MP4?(o.info(`Matched link source: mp4.`),await c({url:t,path:g,cwd:y})):o.error(`Your link is not supported!`)}),x.help(),x.version(t),x.parse(),b();export{};
@@ -0,0 +1 @@
1
+ function e(e){return e}export{e as t};
@@ -30,9 +30,10 @@ declare enum UrlType {
30
30
  M3U8 = 3,
31
31
  KoreanPM = 4,
32
32
  MissAV = 5,
33
+ MP4 = 6,
33
34
  }
34
35
  //#endregion
35
36
  //#region src/config.d.ts
36
37
  declare function defineConfig(options: Options): Options;
37
38
  //#endregion
38
- export { DirectLinkParams, DownloadParams, M3U8Params, Options, UrlType, defineConfig };
39
+ export { Options as a, M3U8Params as i, DirectLinkParams as n, UrlType as o, DownloadParams as r, defineConfig as t };
package/dist/config.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { defineConfig } from "./config-nmMeP6kT.js";
1
+ import { t as defineConfig } from "./config-DvqfH1ip.js";
2
2
  export { defineConfig };
package/dist/config.js CHANGED
@@ -1 +1 @@
1
- import{defineConfig as e}from"./config-ld9QlYHr.js";export{e as defineConfig};
1
+ import{t as e}from"./config-C--eeFbZ.js";export{e as defineConfig};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DirectLinkParams, DownloadParams, M3U8Params, Options, UrlType, defineConfig } from "./config-nmMeP6kT.js";
1
+ import { a as Options, i as M3U8Params, n as DirectLinkParams, o as UrlType, r as DownloadParams, t as defineConfig } from "./config-DvqfH1ip.js";
2
2
 
3
3
  //#region src/constants.d.ts
4
4
  declare const DEFAULT_OPTIONS: Options;
@@ -30,8 +30,11 @@ declare function remoteM3U8ToMP4(params: Partial<M3U8Params>): void;
30
30
  declare function getMissavLink(params: DirectLinkParams): Promise<string>;
31
31
  declare function downloadMissav(params: Partial<DownloadParams>): Promise<void>;
32
32
  //#endregion
33
+ //#region src/utils/downloader.d.ts
34
+ declare function downloadVideo(params: DownloadParams, options?: Partial<Options>): Promise<void>;
35
+ //#endregion
33
36
  //#region src/index.d.ts
34
37
  declare function fastLink(params: DirectLinkParams, options?: Partial<Options>): Promise<string>;
35
38
  declare function fastDownload(params: DownloadParams, options?: Partial<Options>): Promise<void>;
36
39
  //#endregion
37
- export { DEFAULT_OPTIONS, DirectLinkParams, DownloadParams, M3U8Params, Options, UrlType, __dirname, defineConfig, downloadAnimeIdHentai, downloadBilibili, downloadDirpy, downloadKoreanPm, downloadMissav, fastDownload, fastLink, getAnimeIdHentaiLink, getBilibiliLink, getDirpyLink, getKoreanPmLink, getMissavLink, remoteM3U8ToMP4 };
40
+ export { DEFAULT_OPTIONS, DirectLinkParams, DownloadParams, M3U8Params, Options, UrlType, __dirname, defineConfig, downloadAnimeIdHentai, downloadBilibili, downloadDirpy, downloadKoreanPm, downloadMissav, downloadVideo, fastDownload, fastLink, getAnimeIdHentaiLink, getBilibiliLink, getDirpyLink, getKoreanPmLink, getMissavLink, remoteM3U8ToMP4 };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{DEFAULT_OPTIONS as e,UrlType as t,__dirname as n,downloadAnimeIdHentai as r,downloadBilibili as i,downloadDirpy as a,downloadKoreanPm as o,downloadMissav as s,getAnimeIdHentaiLink as c,getBilibiliLink as l,getDirpyLink as u,getKoreanPmLink as d,getMissavLink as f,judgeUrl as p,logger as m,package_default as h,remoteM3U8ToMP4 as g}from"./judgeUrl--jwX-SYw.js";import{defineConfig as _}from"./config-ld9QlYHr.js";import{bold as v,dim as y}from"ansis";const{version:b}=h;async function x(n,r=e){let{url:i,cwd:a}=n,{proxy:o,puppeteer:s}=r,h=o||{},g=s||{},_=p(i);return m.info(`fast-dirpy ${y(`v${b}`)} : ${v(`Direct Link Getter`)}.`),_===t.Bilibili?(m.info(`Matched link source: Bilibili.`),i.includes(`bilibili.com`)?await l(i):(m.error(`Please provide a valid Bilibili URL.`),``)):_===t.AnimeIdHentai?(m.info(`Matched link source: Animeidhentai.`),await c({url:i,cwd:a},{...h,...g})):_===t.KoreanPM?(m.info(`Matched link source: KoreanPM.`),await d({url:i,cwd:a},h)):_===t.MissAV?(m.info(`Matched link source: MissAV.`),await f({url:i,cwd:a})):_===t.Dirpy?(m.info(`Matched link source: Dirpy.`),await u({url:i,cwd:a},h)):(m.error(`Your link is not supported!`),``)}async function S(n,c=e){let{url:l,path:u,cwd:d}=n,{proxy:f,puppeteer:h}=c,_=f||{},x=h||{},S=p(l);m.info(`fast-dirpy ${y(`v${b}`)} : ${v(`Video Downloader`)}.`),S===t.Bilibili?(m.info(`Matched link source: Bilibili.`),await i({url:l,path:u})):S===t.Dirpy?(m.info(`Matched link source: Dirpy.`),a({url:l,path:u||`./dirpy.mp4`,cwd:d},_)):S===t.AnimeIdHentai?(m.info(`Matched link source: AnimeIdHentai.`),await r({url:l,path:u||`./animeidhentai.mp4`,cwd:d},{..._,...x})):S===t.KoreanPM?(m.info(`Matched link source: KoreanPM.`),await o({url:l,path:u||`./korean-pm.mp4`,cwd:d},_)):S===t.MissAV?(m.info(`Matched link source: MissAV.`),await s({url:l,path:u,cwd:d})):S===t.M3U8?(m.info(`Matched link source: m3u8.`),await g({url:l,path:u||`./m3u8-download.mp4`,cwd:d})):m.error(`Your link is not supported!`)}export{e as DEFAULT_OPTIONS,t as UrlType,n as __dirname,_ as defineConfig,r as downloadAnimeIdHentai,i as downloadBilibili,a as downloadDirpy,o as downloadKoreanPm,s as downloadMissav,S as fastDownload,x as fastLink,c as getAnimeIdHentaiLink,l as getBilibiliLink,u as getDirpyLink,d as getKoreanPmLink,f as getMissavLink,g as remoteM3U8ToMP4};
1
+ import{_ as e,a as t,c as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,v as g,y as _}from"./judgeUrl-CQGcgriO.js";import{t as v}from"./config-C--eeFbZ.js";import{bold as y,dim as b}from"ansis";const{version:x}=_;async function S(t,n=e){let{url:i,cwd:c}=t,{proxy:u,puppeteer:f}=n,h=u||{},g=f||{},_=m(i);return a.info(`fast-dirpy ${b(`v${x}`)} : ${y(`Direct Link Getter`)}.`),_===l.Bilibili?(a.info(`Matched link source: Bilibili.`),i.includes(`bilibili.com`)?await r(i):(a.error(`Please provide a valid Bilibili URL.`),``)):_===l.AnimeIdHentai?(a.info(`Matched link source: Animeidhentai.`),await d({url:i,cwd:c},{...h,...g})):_===l.KoreanPM?(a.info(`Matched link source: KoreanPM.`),await p({url:i,cwd:c},h)):_===l.MissAV?(a.info(`Matched link source: MissAV.`),await o({url:i,cwd:c})):_===l.Dirpy?(a.info(`Matched link source: Dirpy.`),await s({url:i,cwd:c},h)):(a.error(`Your link is not supported!`),``)}async function C(r,o=e){let{url:s,path:c,cwd:d}=r,{proxy:p,puppeteer:g}=o,_=p||{},v=g||{},S=m(s);a.info(`fast-dirpy ${b(`v${x}`)} : ${y(`Video Downloader`)}.`),S===l.Bilibili?(a.info(`Matched link source: Bilibili.`),await h({url:s,path:c})):S===l.Dirpy?(a.info(`Matched link source: Dirpy.`),n({url:s,path:c||`./dirpy.mp4`,cwd:d},_)):S===l.AnimeIdHentai?(a.info(`Matched link source: AnimeIdHentai.`),await i({url:s,path:c||`./animeidhentai.mp4`,cwd:d},{..._,...v})):S===l.KoreanPM?(a.info(`Matched link source: KoreanPM.`),await u({url:s,path:c||`./korean-pm.mp4`,cwd:d},_)):S===l.MissAV?(a.info(`Matched link source: MissAV.`),await f({url:s,path:c,cwd:d})):S===l.M3U8?(a.info(`Matched link source: m3u8.`),await t({url:s,path:c||`./m3u8-download.mp4`,cwd:d})):a.error(`Your link is not supported!`)}export{e as DEFAULT_OPTIONS,l as UrlType,g as __dirname,v as defineConfig,i as downloadAnimeIdHentai,h as downloadBilibili,n as downloadDirpy,u as downloadKoreanPm,f as downloadMissav,c as downloadVideo,C as fastDownload,S as fastLink,d as getAnimeIdHentaiLink,r as getBilibiliLink,s as getDirpyLink,p as getKoreanPmLink,o as getMissavLink,t as remoteM3U8ToMP4};
@@ -0,0 +1,3 @@
1
+ import e from"axios";import{load as t}from"cheerio";import n from"node:path";import{fileURLToPath as r}from"node:url";import{createConfigLoader as i}from"unconfig";import a from"node:process";import{consola as o}from"consola";import s from"puppeteer-core";import c,{createWriteStream as l}from"node:fs";import u from"m3u8stream";var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},y=(e,t,n)=>(n=e==null?{}:d(h(e)),v(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e)),b=`0.3.3`,x={name:`fast-dirpy`,type:`module`,version:b,description:`A simple library/CLI to download video from several websites.`,author:`Vincent-the-gamer`,license:`MIT`,homepage:`https://github.com/Vincent-the-gamer/fast-dirpy#readme`,repository:{type:`git`,url:`git+https://github.com/Vincent-the-gamer/fast-dirpy.git`},bugs:{url:`https://github.com/Vincent-the-gamer/fast-dirpy/issues`},sideEffects:!1,main:`dist/index.js`,module:`dist/index.js`,types:`dist/index.d.ts`,typesVersions:{"*":{".":[`./dist/index.d.ts`,`./dist/cli.d.ts`]}},bin:{"fast-dirpy":`bin/fast-dirpy.js`},files:[`dist`],scripts:{tsx:`tsx`,build:`tsdown`,test:`vitest`,dep:`taze major -I`,"lint:fix":`eslint . --fix`,login:`pnpm login --registry https://registry.npmjs.com`},publishConfig:{registry:`https://registry.npmjs.com`,access:`public`},dependencies:{ansis:`^4.2.0`,axios:`^1.13.1`,cac:`^6.7.14`,cheerio:`^1.1.2`,consola:`^3.4.2`,m3u8stream:`^0.8.6`,"puppeteer-core":`^24.27.0`,"restore-cursor":`^5.1.0`,unconfig:`^7.3.3`},devDependencies:{"@antfu/eslint-config":`^6.2.0`,"@types/node":`^24.9.2`,deepmerge:`^4.3.1`,eslint:`^9.39.0`,taze:`^19.9.0`,tsdown:`^0.15.12`,tsx:`^4.20.6`,typescript:`^5.9.3`,vitest:`^4.0.6`}};const S={timeout:2e4},C=r(import.meta.url),w=n.dirname(C);var T=_(((e,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]`||o(e)}var a=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function o(e){return e.$$typeof===a}function s(e){return Array.isArray(e)?[]:{}}function c(e,t){return t.clone!==!1&&t.isMergeableObject(e)?g(s(e),e,t):e}function l(e,t,n){return e.concat(t).map(function(e){return c(e,n)})}function u(e,t){if(!t.customMerge)return g;var n=t.customMerge(e);return typeof n==`function`?n:g}function d(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function f(e){return Object.keys(e).concat(d(e))}function p(e,t){try{return t in e}catch{return!1}}function m(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function h(e,t,n){var r={};return n.isMergeableObject(e)&&f(e).forEach(function(t){r[t]=c(e[t],n)}),f(t).forEach(function(i){m(e,i)||(p(e,i)&&n.isMergeableObject(t[i])?r[i]=u(i,n)(e[i],t[i],n):r[i]=c(t[i],n))}),r}function g(e,t,r){r||={},r.arrayMerge=r.arrayMerge||l,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=c;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):h(e,t,r):c(t,r)}g.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return g(e,n,t)},{})},t.exports=g}));const E=o.withTag(`fast-dirpy`);function D(e){`CONSOLA_LEVEL`in a.env||(E.level=e?0:3)}var O=y(T(),1);async function k(e,t){let n=S,{config:r,sources:a}=await i({sources:[{files:[`fast-dirpy.config`],extensions:[`ts`,`mts`,`cts`,`js`,`mjs`,`cjs`,`json`]}],cwd:t||process.cwd(),merge:!1}).load();return a.length?(E.info(`Config file found: ${a[0]}`),(0,O.default)((0,O.default)(n,r),e)):(0,O.default)(n,e)}async function A(e){return await s.launch(e)}function j(e){return e[Math.floor(Math.random()*e.length)]}const M=[`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 N(){return j(M)}async function P(t,n=S){let{path:r,url:i}=t,{proxy:a,timeout:o}=await k(n),s=a?.host===``?void 0:a;if(i===``)return Promise.reject(`Extract direct link failed!`);let l=c.createWriteStream(r);return(await e({url:i,headers:{"User-Agent":N()},method:`GET`,responseType:`stream`,proxy:s,timeout:o,onDownloadProgress:e=>{let{loaded:t,total:n,progress:r}=e,i=`loaded:${t} total: ${n} progress: ${(r*100).toFixed(2)}%`;E.info(i)}})).data.pipe(l),new Promise((e,t)=>{l.on(`finish`,e),l.on(`error`,t)})}async function F(n,r=S){let{url:i,cwd:a}=n,{proxy:o,timeout:s}=await k(r,a),c=o?.host===``?void 0:o,{data:l}=await e.get(i,{headers:{"User-Agent":N()},proxy:c,timeout:s}),u=t(l),d=``,f=u(`div.embed.rad2 > iframe`).attr();return f&&(d=f.src),d}async function I(e,t=S){let{url:n,cwd:r}=e,{proxy:i,puppeteer:a}=await k(t,r),o=i?.host===``?void 0:i,s=await F({url:n},{proxy:o}),{executablePath:c,headless:l}=a,u=await A({executablePath:c,headless:l,args:[`--proxy-server=http://${o?.host}:${i?.port}`]}),d=N(),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 L(e,t=S){let{path:n,url:r,cwd:i}=e;await P({url:await I({url:r},t),path:n,cwd:i},t)}function R(e){let t=e.match(/BV[a-zA-Z0-9]+/);return t?`https://bilibili-real-url.deno.dev/${t[0]}.mp4`:``}async function z(e){let{path:t,url:n}=e,r=R(n);r===``?console.error(`Extract direct link failed!`):await P({url:r,path:t||`./download.mp4`})}async function B(n,r=S){let{url:i,cwd:a}=n,{proxy:o,timeout:s}=await k(r,a),c=o?.host===``?void 0:o,{data:l}=await e.get(`https://dirpy.com/studio`,{params:{url:i},headers:{"User-Agent":N(),Referer:`https://dirpy.com/studio?url=${i}`},proxy:c,timeout:s}),u=t(l),d=``,f=u(`#media-source`).attr();return f&&(d=f.src),d}async function V(e,t=S){let{path:n,url:r,cwd:i}=e;await P({url:await B({url:r},t),path:n,cwd:i},t)}async function H(n,r=S){let{url:i,cwd:a}=n,{proxy:o,timeout:s}=await k(r,a),c=o?.host===``?void 0:o,{data:l}=await e.get(i,{headers:{"User-Agent":N()},proxy:c,timeout:s}),u=t(l),d=``,f=u(`meta[itemprop="contentURL"]`).attr();return f&&(d=f.content),d}async function U(e,t=S){let{path:n,url:r,cwd:i}=e;await P({url:await H({url:r},t),path:n,cwd:i},t)}function W(e){let{url:t,path:r}=e,i=r??n.resolve(w,`../m3u8-download.mp4`),a=u(t);a.pipe(l(i)),a.on(`progress`,(e,t,n)=>{E.info(`Segment: ${JSON.stringify(e)},
2
+ Total Segments: ${t},
3
+ downloaded: ${(n/1024/1024).toFixed(2)}MB Downloaded`),e.num>=t&&a.end()})}function G(e){return new Promise(t=>setTimeout(t,e*1e3))}async function K(e,t=S){let{url:n,cwd:r}=e,{proxy:i,puppeteer:a}=await k(t,r),o=i?.host===``?void 0:i,{executablePath:s,headless:c}=a,l=await A({executablePath:s,headless:c,args:[`--proxy-server=http://${o?.host}:${i?.port}`,`--disable-features=IsolateOrigins,site-per-process`,`--disable-site-isolation-trials`,`--disable-web-security`,`--disable-setuid-sandbox`,`--no-sandbox`,`--disable-gpu`,`--disable-dev-shm-usage`,`--disable-accelerated-2d-canvas`,`--no-first-run`,`--no-zygote`,`--single-process`,`--window-size=1920,1080`],slowMo:50,timezoneId:`America/New_York`,locale:`en-US`}),u=await l.newPage(),d=N();await u.setUserAgent(d);try{let e=await u.goto(n,{waitUntil:`domcontentloaded`});e&&E.info(`http status: ${e.status()}`);let t=await u.title(),r=await u.content();if(E.info(`Page title: ${t}`),t.includes(`Just a moment`)||r.includes(`Checking your browser`)){E.info(`Cloudflare challenge detected, waiting for it to complete...`);try{E.info(`Waiting for page title to change...`),await u.waitForFunction(`document.title != 'Just a moment...'`,{timeout:3e4}),E.info(`Page title has changed`)}catch(e){E.error(`Timeout waiting for title change: ${e}`);try{for(let e of[`input[type='checkbox']`,`.ray-button`,`#challenge-stage button`,`button:has-text('Verify')`,`button:has-text('Continue')`])if(await u.$(e)){E.info(`Found possible verification button: ${e}`),await u.click(e),G(5);break}}catch(e){E.error(`Failed to click verification button: ${e}`)}}}let i=await u.title();E.info(`current page title: ${i}`),E.info(`Simulating page scroll...`);for(let e=0;e<3;e++)await u.evaluate(`window.scrollBy(0, window.innerHeight / 2)`),await u.evaluate(`window.scrollBy(0, window.innerHeight / 4)`);E.info(`Getting page content...`);let a=await u.content();return E.info(`Page content retrieved successfully.`),a}catch(e){E.error(`Error during scraping: ${e}`)}finally{E.info(`Closing browser`),await l.close()}}async function q(e){let t=e.match(/m3u8\|([a-f0-9|]+)\|com\|surrit\|https\|video/);return t?t[1].split(`|`).reverse().join(`-`):(E.error(`Failed to extract UUID from HTML.`),null)}function J(e){return e.split(`/`).pop()||(E.error(`Failed to extract movie ID from URL.`),null)}async function Y(t){let{url:n,cwd:r}=t,i=await q(await K({url:n,cwd:r})),a=`https://surrit.com/${i}/playlist.m3u8`,{data:o}=await e.get(a),s=o.match(/(?:\d+p|\d+x\d+)\/video\.m3u8/g);return`https://surrit.com/${i}/${s[s.length-1]}`}async function X(e){let{url:t,cwd:n,path:r}=e,i=J(t);await W({url:await Y({url:t,cwd:n}),cwd:n,path:r||`${i}.mp4`})}let Z=function(e){return e[e.Bilibili=0]=`Bilibili`,e[e.AnimeIdHentai=1]=`AnimeIdHentai`,e[e.Dirpy=2]=`Dirpy`,e[e.M3U8=3]=`M3U8`,e[e.KoreanPM=4]=`KoreanPM`,e[e.MissAV=5]=`MissAV`,e[e.MP4=6]=`MP4`,e}({});function Q(e){return e.includes(`bilibili`)||/BV[a-zA-Z0-9]+/.test(e)?Z.Bilibili:e.includes(`animeidhentai`)?Z.AnimeIdHentai:e.includes(`koreanpornmovie`)?Z.KoreanPM:e.includes(`missav`)?Z.MissAV:e.includes(`.m3u8`)?Z.M3U8:e.endsWith(`.mp4`)?Z.MP4:Z.Dirpy}export{S as _,W as a,b,V as c,R as d,L as f,D as g,E as h,Y as i,B as l,P as m,Z as n,U as o,I as p,X as r,H as s,Q as t,z as u,w as v,x as y};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fast-dirpy",
3
3
  "type": "module",
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "description": "A simple library/CLI to download video from several websites.",
6
6
  "author": "Vincent-the-gamer",
7
7
  "license": "MIT",
@@ -37,25 +37,25 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "ansis": "^4.2.0",
40
- "axios": "^1.12.2",
40
+ "axios": "^1.13.1",
41
41
  "cac": "^6.7.14",
42
42
  "cheerio": "^1.1.2",
43
43
  "consola": "^3.4.2",
44
44
  "m3u8stream": "^0.8.6",
45
- "puppeteer-core": "^24.25.0",
45
+ "puppeteer-core": "^24.27.0",
46
46
  "restore-cursor": "^5.1.0",
47
47
  "unconfig": "^7.3.3"
48
48
  },
49
49
  "devDependencies": {
50
- "@antfu/eslint-config": "^6.0.0",
51
- "@types/node": "^24.8.1",
50
+ "@antfu/eslint-config": "^6.2.0",
51
+ "@types/node": "^24.9.2",
52
52
  "deepmerge": "^4.3.1",
53
- "eslint": "^9.38.0",
54
- "taze": "^19.8.0",
55
- "tsdown": "^0.15.8",
53
+ "eslint": "^9.39.0",
54
+ "taze": "^19.9.0",
55
+ "tsdown": "^0.15.12",
56
56
  "tsx": "^4.20.6",
57
57
  "typescript": "^5.9.3",
58
- "vitest": "^3.2.4"
58
+ "vitest": "^4.0.6"
59
59
  },
60
60
  "scripts": {
61
61
  "tsx": "tsx",
@@ -1 +0,0 @@
1
- function e(e){return e}export{e as defineConfig};
@@ -1,3 +0,0 @@
1
- import e from"axios";import{load as t}from"cheerio";import n from"node:path";import{fileURLToPath as r}from"node:url";import{createConfigLoader as i}from"unconfig";import a from"node:process";import{consola as o}from"consola";import s from"puppeteer-core";import c,{createWriteStream as l}from"node:fs";import u from"m3u8stream";var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},y=(e,t,n)=>(n=e==null?{}:d(h(e)),v(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e)),b={name:`fast-dirpy`,type:`module`,version:`0.3.2`,description:`A simple library/CLI to download video from several websites.`,author:`Vincent-the-gamer`,license:`MIT`,homepage:`https://github.com/Vincent-the-gamer/fast-dirpy#readme`,repository:{type:`git`,url:`git+https://github.com/Vincent-the-gamer/fast-dirpy.git`},bugs:{url:`https://github.com/Vincent-the-gamer/fast-dirpy/issues`},sideEffects:!1,main:`dist/index.js`,module:`dist/index.js`,types:`dist/index.d.ts`,typesVersions:{"*":{".":[`./dist/index.d.ts`,`./dist/cli.d.ts`]}},bin:{"fast-dirpy":`bin/fast-dirpy.js`},files:[`dist`],scripts:{tsx:`tsx`,build:`tsdown`,test:`vitest`,dep:`taze major -I`,"lint:fix":`eslint . --fix`,login:`pnpm login --registry https://registry.npmjs.com`},publishConfig:{registry:`https://registry.npmjs.com`,access:`public`},dependencies:{ansis:`^4.2.0`,axios:`^1.12.2`,cac:`^6.7.14`,cheerio:`^1.1.2`,consola:`^3.4.2`,m3u8stream:`^0.8.6`,"puppeteer-core":`^24.25.0`,"restore-cursor":`^5.1.0`,unconfig:`^7.3.3`},devDependencies:{"@antfu/eslint-config":`^6.0.0`,"@types/node":`^24.8.1`,deepmerge:`^4.3.1`,eslint:`^9.38.0`,taze:`^19.8.0`,tsdown:`^0.15.8`,tsx:`^4.20.6`,typescript:`^5.9.3`,vitest:`^3.2.4`}};const x={timeout:2e4},S=r(import.meta.url),C=n.dirname(S);var w=_(((e,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]`||o(e)}var a=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function o(e){return e.$$typeof===a}function s(e){return Array.isArray(e)?[]:{}}function c(e,t){return t.clone!==!1&&t.isMergeableObject(e)?g(s(e),e,t):e}function l(e,t,n){return e.concat(t).map(function(e){return c(e,n)})}function u(e,t){if(!t.customMerge)return g;var n=t.customMerge(e);return typeof n==`function`?n:g}function d(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function f(e){return Object.keys(e).concat(d(e))}function p(e,t){try{return t in e}catch{return!1}}function m(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function h(e,t,n){var r={};return n.isMergeableObject(e)&&f(e).forEach(function(t){r[t]=c(e[t],n)}),f(t).forEach(function(i){m(e,i)||(p(e,i)&&n.isMergeableObject(t[i])?r[i]=u(i,n)(e[i],t[i],n):r[i]=c(t[i],n))}),r}function g(e,t,r){r||={},r.arrayMerge=r.arrayMerge||l,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=c;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):h(e,t,r):c(t,r)}g.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return g(e,n,t)},{})},t.exports=g}));const T=o.withTag(`fast-dirpy`);function E(e){`CONSOLA_LEVEL`in a.env||(T.level=e?0:3)}var D=y(w(),1);async function O(e,t){let n=x,{config:r,sources:a}=await i({sources:[{files:[`fast-dirpy.config`],extensions:[`ts`,`mts`,`cts`,`js`,`mjs`,`cjs`,`json`]}],cwd:t||process.cwd(),merge:!1}).load();return a.length?(T.info(`Config file found: ${a[0]}`),(0,D.default)((0,D.default)(n,r),e)):(0,D.default)(n,e)}async function k(e){return await s.launch(e)}function A(e){return e[Math.floor(Math.random()*e.length)]}const j=[`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 M(){return A(j)}async function N(t,n=x){let{path:r,url:i}=t,{proxy:a,timeout:o}=await O(n),s=a?.host===``?void 0:a;if(i===``)return Promise.reject(`Extract direct link failed!`);let l=c.createWriteStream(r);return(await e({url:i,headers:{"User-Agent":M()},method:`GET`,responseType:`stream`,proxy:s,timeout:o,onDownloadProgress:e=>{let{loaded:t,total:n,progress:r}=e,i=`loaded:${t} total: ${n} progress: ${(r*100).toFixed(2)}%`;T.info(i)}})).data.pipe(l),new Promise((e,t)=>{l.on(`finish`,e),l.on(`error`,t)})}async function P(n,r=x){let{url:i,cwd:a}=n,{proxy:o,timeout:s}=await O(r,a),c=o?.host===``?void 0:o,{data:l}=await e.get(i,{headers:{"User-Agent":M()},proxy:c,timeout:s}),u=t(l),d=``,f=u(`div.embed.rad2 > iframe`).attr();return f&&(d=f.src),d}async function F(e,t=x){let{url:n,cwd:r}=e,{proxy:i,puppeteer:a}=await O(t,r),o=i?.host===``?void 0:i,s=await P({url:n},{proxy:o}),{executablePath:c,headless:l}=a,u=await k({executablePath:c,headless:l,args:[`--proxy-server=http://${o?.host}:${i?.port}`]}),d=M(),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 I(e,t=x){let{path:n,url:r,cwd:i}=e;await N({url:await F({url:r},t),path:n,cwd:i},t)}function L(e){let t=e.match(/BV[a-zA-Z0-9]+/);return t?`https://bilibili-real-url.deno.dev/${t[0]}.mp4`:``}async function R(e){let{path:t,url:n}=e,r=L(n);r===``?console.error(`Extract direct link failed!`):await N({url:r,path:t||`./download.mp4`})}async function z(n,r=x){let{url:i,cwd:a}=n,{proxy:o,timeout:s}=await O(r,a),c=o?.host===``?void 0:o,{data:l}=await e.get(`https://dirpy.com/studio`,{params:{url:i},headers:{"User-Agent":M(),Referer:`https://dirpy.com/studio?url=${i}`},proxy:c,timeout:s}),u=t(l),d=``,f=u(`#media-source`).attr();return f&&(d=f.src),d}async function B(e,t=x){let{path:n,url:r,cwd:i}=e;await N({url:await z({url:r},t),path:n,cwd:i},t)}async function V(n,r=x){let{url:i,cwd:a}=n,{proxy:o,timeout:s}=await O(r,a),c=o?.host===``?void 0:o,{data:l}=await e.get(i,{headers:{"User-Agent":M()},proxy:c,timeout:s}),u=t(l),d=``,f=u(`meta[itemprop="contentURL"]`).attr();return f&&(d=f.content),d}async function H(e,t=x){let{path:n,url:r,cwd:i}=e;await N({url:await V({url:r},t),path:n,cwd:i},t)}function U(e){let{url:t,path:r}=e,i=r??n.resolve(C,`../m3u8-download.mp4`),a=u(t);a.pipe(l(i)),a.on(`progress`,(e,t,n)=>{T.info(`Segment: ${JSON.stringify(e)},
2
- Total Segments: ${t},
3
- downloaded: ${(n/1024/1024).toFixed(2)}MB Downloaded`),e.num>=t&&a.end()})}function W(e){return new Promise(t=>setTimeout(t,e*1e3))}async function G(e,t=x){let{url:n,cwd:r}=e,{proxy:i,puppeteer:a}=await O(t,r),o=i?.host===``?void 0:i,{executablePath:s,headless:c}=a,l=await k({executablePath:s,headless:c,args:[`--proxy-server=http://${o?.host}:${i?.port}`,`--disable-features=IsolateOrigins,site-per-process`,`--disable-site-isolation-trials`,`--disable-web-security`,`--disable-setuid-sandbox`,`--no-sandbox`,`--disable-gpu`,`--disable-dev-shm-usage`,`--disable-accelerated-2d-canvas`,`--no-first-run`,`--no-zygote`,`--single-process`,`--window-size=1920,1080`],slowMo:50,timezoneId:`America/New_York`,locale:`en-US`}),u=await l.newPage(),d=M();await u.setUserAgent(d);try{let e=await u.goto(n,{waitUntil:`domcontentloaded`});e&&T.info(`http status: ${e.status()}`);let t=await u.title(),r=await u.content();if(T.info(`Page title: ${t}`),t.includes(`Just a moment`)||r.includes(`Checking your browser`)){T.info(`Cloudflare challenge detected, waiting for it to complete...`);try{T.info(`Waiting for page title to change...`),await u.waitForFunction(`document.title != 'Just a moment...'`,{timeout:3e4}),T.info(`Page title has changed`)}catch(e){T.error(`Timeout waiting for title change: ${e}`);try{for(let e of[`input[type='checkbox']`,`.ray-button`,`#challenge-stage button`,`button:has-text('Verify')`,`button:has-text('Continue')`])if(await u.$(e)){T.info(`Found possible verification button: ${e}`),await u.click(e),W(5);break}}catch(e){T.error(`Failed to click verification button: ${e}`)}}}let i=await u.title();T.info(`current page title: ${i}`),T.info(`Simulating page scroll...`);for(let e=0;e<3;e++)await u.evaluate(`window.scrollBy(0, window.innerHeight / 2)`),await u.evaluate(`window.scrollBy(0, window.innerHeight / 4)`);T.info(`Getting page content...`);let a=await u.content();return T.info(`Page content retrieved successfully.`),a}catch(e){T.error(`Error during scraping: ${e}`)}finally{T.info(`Closing browser`),await l.close()}}async function K(e){let t=e.match(/m3u8\|([a-f0-9|]+)\|com\|surrit\|https\|video/);return t?t[1].split(`|`).reverse().join(`-`):(T.error(`Failed to extract UUID from HTML.`),null)}function q(e){return e.split(`/`).pop()||(T.error(`Failed to extract movie ID from URL.`),null)}async function J(t){let{url:n,cwd:r}=t,i=await K(await G({url:n,cwd:r})),a=`https://surrit.com/${i}/playlist.m3u8`,{data:o}=await e.get(a),s=o.match(/(?:\d+p|\d+x\d+)\/video\.m3u8/g);return`https://surrit.com/${i}/${s[s.length-1]}`}async function Y(e){let{url:t,cwd:n,path:r}=e,i=q(t);await U({url:await J({url:t,cwd:n}),cwd:n,path:r||`${i}.mp4`})}let X=function(e){return e[e.Bilibili=0]=`Bilibili`,e[e.AnimeIdHentai=1]=`AnimeIdHentai`,e[e.Dirpy=2]=`Dirpy`,e[e.M3U8=3]=`M3U8`,e[e.KoreanPM=4]=`KoreanPM`,e[e.MissAV=5]=`MissAV`,e}({});function Z(e){return e.includes(`bilibili`)||/BV[a-zA-Z0-9]+/.test(e)?X.Bilibili:e.includes(`animeidhentai`)?X.AnimeIdHentai:e.includes(`koreanpornmovie`)?X.KoreanPM:e.includes(`missav`)?X.MissAV:e.endsWith(`.m3u8`)?X.M3U8:X.Dirpy}export{x as DEFAULT_OPTIONS,X as UrlType,C as __dirname,I as downloadAnimeIdHentai,R as downloadBilibili,B as downloadDirpy,H as downloadKoreanPm,Y as downloadMissav,F as getAnimeIdHentaiLink,L as getBilibiliLink,z as getDirpyLink,V as getKoreanPmLink,J as getMissavLink,Z as judgeUrl,T as logger,b as package_default,U as remoteM3U8ToMP4,E as setSilent};