fast-dirpy 0.1.1 → 0.1.2

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
@@ -23,6 +23,10 @@ npm i fast-dirpy -g
23
23
  ## Usage
24
24
 
25
25
  ### Config file
26
+
27
+ > [!IMPORTANT]
28
+ > `fast-dirpy.config` can be `fast-dirpy.config.['ts', 'mts', 'cts', 'js', 'mjs', 'cjs']`
29
+
26
30
  You can create a `fast-dirpy.config.ts` file in your library root or same location in command line.
27
31
 
28
32
  ```ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fast-dirpy",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "description": "A simple library/CLI to download video using dirpy.com",
6
6
  "author": "Vincent-the-gamer",
7
7
  "license": "MIT",
@@ -1 +0,0 @@
1
- var n=Object.create;var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var l=(t,e)=>()=>(t&&(e=t(t=0)),e);var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var s=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of p(e))!f.call(t,m)&&m!==o&&i(t,m,{get:()=>e[m],enumerable:!(r=a(e,m))||r.enumerable});return t};var g=(t,e,o)=>(o=t!=null?n(c(t)):{},s(e||!t||!t.__esModule?i(o,"default",{value:t,enumerable:!0}):o,t));var _=l(()=>{"use strict"});export{d as a,g as b,_ as c};
@@ -1 +0,0 @@
1
- import{c as i}from"./chunk-LP3GSA6N.js";i();function o(p){return p}export{o as a};
@@ -1,2 +0,0 @@
1
- import{a as E,b as x,c as s}from"./chunk-LP3GSA6N.js";var j=E((J,h)=>{"use strict";s();var T=function(r){return _(r)&&!I(r)};function _(e){return!!e&&typeof e=="object"}function I(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||U(e)}var L=typeof Symbol=="function"&&Symbol.for,v=L?Symbol.for("react.element"):60103;function U(e){return e.$$typeof===v}function R(e){return Array.isArray(e)?[]:{}}function l(e,r){return r.clone!==!1&&r.isMergeableObject(e)?a(R(e),e,r):e}function C(e,r,t){return e.concat(r).map(function(o){return l(o,t)})}function $(e,r){if(!r.customMerge)return a;var t=r.customMerge(e);return typeof t=="function"?t:a}function F(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function b(e){return Object.keys(e).concat(F(e))}function M(e,r){try{return r in e}catch{return!1}}function K(e,r){return M(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function N(e,r,t){var o={};return t.isMergeableObject(e)&&b(e).forEach(function(n){o[n]=l(e[n],t)}),b(r).forEach(function(n){K(e,n)||(M(e,n)&&t.isMergeableObject(r[n])?o[n]=$(n,t)(e[n],r[n],t):o[n]=l(r[n],t))}),o}function a(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||C,t.isMergeableObject=t.isMergeableObject||T,t.cloneUnlessOtherwiseSpecified=l;var o=Array.isArray(r),n=Array.isArray(e),c=o===n;return c?o?t.arrayMerge(e,r,t):N(e,r,t):l(r,t)}a.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(o,n){return a(o,n,t)},{})};var G=a;h.exports=G});s();import V from"node:fs";import P from"axios";import W from"jsdom";s();var u=x(j(),1);import{createConfigLoader as H}from"unconfig";var f={timeout:2e4};async function g(e){let r=f,t=H({sources:[{files:["fast-dirpy.config"],extensions:["ts","mts","cts","js","mjs","cjs"]}],cwd:process.cwd(),merge:!1}),{config:o,sources:n}=await t.load();return n.length?(0,u.default)((0,u.default)(r,o),e):(0,u.default)(r,e)}var Y={"User-Agent":"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"},{JSDOM:z}=W;async function X(e,r=f){let{proxy:t,timeout:o}=await g(r),n=t?.host!==""?t:void 0,{data:c}=await P.get("https://dirpy.com/studio",{params:{url:e},headers:{...Y,Referer:`https://dirpy.com/studio?url=${e}`},proxy:n,timeout:o}),{window:p}=new z(c),i="",m=p.document.getElementById("media-source");return m&&(i=m.src),i}async function B(e,r=f){let{path:t,url:o}=e,{proxy:n,timeout:c}=await g(r),p=n?.host!==""?n:void 0;if(o==="")return Promise.reject("Extract direct link failed!");let i=V.createWriteStream(t);return(await P({url:o,headers:{"User-Agent":"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"},method:"GET",responseType:"stream",proxy:p,timeout:c,onDownloadProgress:d=>{let{loaded:y,total:D,progress:A}=d,S=`loaded:${y} total: ${D} progress: ${(A*100).toFixed(2)}%
2
- `;console.log(S)}})).data.pipe(i),new Promise((d,y)=>{i.on("finish",d),i.on("error",y)})}async function oe(e,r=f){let{path:t,url:o}=e,n=await X(o,r);await B({url:n,path:t},r)}export{X as a,oe as b};
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/cli.js DELETED
@@ -1 +0,0 @@
1
- import{a as p,b as d}from"./chunk-WYAG3YFC.js";import{c as n}from"./chunk-LP3GSA6N.js";n();import{cac as y}from"cac";import l from"restore-cursor";var a={name:"fast-dirpy",type:"module",version:"0.1.1",description:"A simple library/CLI to download video using dirpy.com",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:"tsup",test:"vitest",dep:"taze major","lint:fix":"eslint . --fix",login:"pnpm login --registry https://registry.npmjs.com"},publishConfig:{registry:"https://registry.npmjs.com",access:"public"},dependencies:{axios:"^1.8.4",cac:"^6.7.14",jsdom:"^26.0.0","restore-cursor":"^5.1.0",unconfig:"^7.3.1"},devDependencies:{"@antfu/eslint-config":"^4.11.0","@types/node":"^22.13.14",deepmerge:"^4.3.1",eslint:"^9.23.0",taze:"^19.0.4",tsup:"^8.4.0",tsx:"^4.19.3",typescript:"^5.8.2",vitest:"^3.0.9"}};var o=y("fast-dirpy");o.command("get <url>","get video direct link.").option("--proxyHost, -H <proxyHost>","Proxy host.").option("--proxyPort, -P <proxyPort>","Proxy port.").action(async(e,i)=>{let{host:t,port:s}=i,c=await p(e,t?{proxy:{host:t,port:s}}:void 0);console.log(c)});o.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.").action(async(e,i)=>{let{host:t,port:s}=i,r=t?{proxy:{host:t,port:s}}:void 0;d({url:e,path:i.path||"./download.mp4"},r)});o.help();o.version(a.version);o.parse();l();
@@ -1,12 +0,0 @@
1
- interface DirpyOptions {
2
- proxy?: {
3
- protocol?: string;
4
- host: string;
5
- port: number;
6
- };
7
- timeout?: number;
8
- }
9
-
10
- declare function defineConfig(options: DirpyOptions): DirpyOptions;
11
-
12
- export { type DirpyOptions as D, defineConfig as d };
package/dist/config.d.ts DELETED
@@ -1 +0,0 @@
1
- export { d as defineConfig } from './config-CsHryMou.js';
package/dist/config.js DELETED
@@ -1 +0,0 @@
1
- import{a}from"./chunk-OTOEWWYP.js";import"./chunk-LP3GSA6N.js";export{a as defineConfig};
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { D as DirpyOptions } from './config-CsHryMou.js';
2
- export { d as defineConfig } from './config-CsHryMou.js';
3
-
4
- declare function getDirectLink(url: string, options?: Partial<DirpyOptions>): Promise<string>;
5
- interface DownloadParams {
6
- url: string;
7
- path: string;
8
- }
9
- declare function downloadVideoFromRawLink(params: DownloadParams, options?: Partial<DirpyOptions>): Promise<void>;
10
-
11
- export { DirpyOptions, downloadVideoFromRawLink, getDirectLink };
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- import{a as r,b as e}from"./chunk-WYAG3YFC.js";import{a as f}from"./chunk-OTOEWWYP.js";import{c as o}from"./chunk-LP3GSA6N.js";o();export{f as defineConfig,e as downloadVideoFromRawLink,r as getDirectLink};