fast-dirpy 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-PRESENT Vincent-the-gamer <https://github.com/Vincent-the-gamer>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # fast-dirpy
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+ [![bundle][bundle-src]][bundle-href]
6
+ [![JSDocs][jsdocs-src]][jsdocs-href]
7
+ [![License][license-src]][license-href]
8
+
9
+ A simple library/CLI to download video using `dirpy.com`
10
+
11
+ ## Installation
12
+
13
+ ## As a library
14
+ ```shell
15
+ npm i fast-dirpy
16
+ ```
17
+
18
+ ## As a **command line tool**
19
+ ```shell
20
+ npm i fast-dirpy -g
21
+ ```
22
+
23
+
24
+ ## Usage
25
+
26
+ ### Use in command line
27
+
28
+ #### Get Direct Link
29
+
30
+ ```shell
31
+ # get video direct link
32
+ # Proxy:
33
+ # -H, --proxyHost: proxy host
34
+ # -P, --proxyPort: proxy port
35
+ fast-dirpy get https\://www.youtube.com/watch\?v\=SAXpBgkXt60 -H 127.0.0.1 -P 7890
36
+ ```
37
+
38
+ #### Download Video
39
+ ```shell
40
+ # get video direct link
41
+ # Path: --path, -P: Downloaded video save path.
42
+ #
43
+ # Proxy:
44
+ # -H, --proxyHost: proxy host.
45
+ # -P, --proxyPort: proxy port.
46
+ fast-dirpy download https\://www.youtube.com/watch\?v\=SAXpBgkXt60 -p ./test.mp4 -H 127.0.0.1 -P 7890
47
+ ```
48
+
49
+ ### Use as a library
50
+ ```ts
51
+ import { getDirectLink, downloadVideoFromRawLink } from "fast-dirpy"
52
+
53
+ // get direct link
54
+ const link = await getDirectLink(
55
+ "<url>",
56
+ {
57
+ host: "127.0.0.1",
58
+ port: 7890
59
+ }
60
+ )
61
+
62
+ // download video
63
+ downloadVideoFromRawLink({
64
+ url,
65
+ path: "./download.mp4",
66
+ proxy: {
67
+ host: "127.0.0.1",
68
+ port: 7890
69
+ }
70
+ })
71
+ ```
72
+
73
+ ## License
74
+
75
+ [MIT](./LICENSE) License © 2025-PRESENT [Vincent-the-gamer](https://github.com/Vincent-the-gamer)
76
+
77
+ <!-- Badges -->
78
+
79
+ [npm-version-src]: https://img.shields.io/npm/v/fast-dirpy?style=flat&colorA=080f12&colorB=1fa669
80
+ [npm-version-href]: https://npmjs.com/package/fast-dirpy
81
+ [npm-downloads-src]: https://img.shields.io/npm/dm/fast-dirpy?style=flat&colorA=080f12&colorB=1fa669
82
+ [npm-downloads-href]: https://npmjs.com/package/fast-dirpy
83
+ [bundle-src]: https://img.shields.io/bundlephobia/minzip/fast-dirpy?style=flat&colorA=080f12&colorB=1fa669&label=minzip
84
+ [bundle-href]: https://bundlephobia.com/result?p=fast-dirpy
85
+ [license-src]: https://img.shields.io/github/license/Vincent-the-gamer/fast-dirpy.svg?style=flat&colorA=080f12&colorB=1fa669
86
+ [license-href]: https://github.com/Vincent-the-gamer/fast-dirpy/blob/main/LICENSE
87
+ [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
88
+ [jsdocs-href]: https://www.jsdocs.io/package/fast-dirpy
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ import '../dist/cli.js'
@@ -0,0 +1,2 @@
1
+ import p from"axios";import f from"jsdom";import y from"fs";function c(o){return o?.host&&o.port?{protocol:"http",host:o?.host,port:o?.port}:void 0}var{JSDOM:w}=f;async function h(o,r){let t=c(r||{}),{data:n}=await p.get("https://dirpy.com/studio",{params:{url:encodeURIComponent(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"},proxy:t,timeout:3e4}),{window:e}=new w(n),{src:s}=e.document.getElementById("media-source");return s}async function x(o){let{proxy:r,path:t,url:n}=o,e=c(r||{}),s=y.createWriteStream(t);return(await p({url:n,method:"GET",responseType:"stream",proxy:e,onDownloadProgress:i=>{let{loaded:a,total:d,progress:m}=i,l=`loaded:${a} total: ${d} progress: ${(m*100).toFixed(2)}%
2
+ `;console.log(l)}})).data.pipe(s),new Promise((i,a)=>{s.on("finish",i),s.on("error",a)})}async function S(o){let{proxy:r,path:t,url:n}=o,e=await h(n,r);await x({url:e,path:t,proxy:r})}export{h as a,S as b};
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/cli.js ADDED
@@ -0,0 +1 @@
1
+ import{a as i,b as r}from"./chunk-KX4T6SEL.js";import{cac as a}from"cac";var p={name:"fast-dirpy",version:"0.1.0",type:"module",description:"A simple library/CLI to download video using dirpy.com",author:"Vincent-the-gamer",main:"dist/index.js",module:"dist/index.js",types:"dist/index.d.ts",files:["dist"],bin:{"fast-dirpy":"bin/fast-dirpy.js"},typesVersions:{"*":{".":["./dist/index.d.ts","./dist/cli.d.ts"]}},scripts:{tsx:"tsx",build:"tsup",test:"vitest",dep:"taze major",login:"pnpm login --registry https://registry.npmjs.com"},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"},publishConfig:{registry:"https://registry.npmjs.com",access:"public"},sideEffects:!1,devDependencies:{"@types/node":"^22.13.14",taze:"^19.0.2",tsup:"^8.4.0",tsx:"^4.19.3",typescript:"^5.8.2",vitest:"^3.0.9"},dependencies:{axios:"^1.8.4",cac:"^6.7.14",jsdom:"^26.0.0","restore-cursor":"^5.1.0"}};import c from"restore-cursor";var o=a("fast-dirpy");o.command("get <url>","get video direct link.").option("--proxyHost, -H <proxyHost>","Proxy host.").option("--proxyPort, -P <proxyPort>","Proxy port.").action(async(s,t)=>{let e=await i(s,{host:t.proxyHost||null,port:t.proxyPort||null});console.log(e)});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(s,t)=>{let e=t.proxyHost||null,n=t.proxyPort||null;r({url:s,path:t.path||"./download.mp4",proxy:{host:e,port:n}})});o.help();o.version(p.version);o.parse();c();
@@ -0,0 +1,10 @@
1
+ declare function getDirectLink(url: string, proxy?: Record<string, any>): Promise<string>;
2
+ interface DownloadParams {
3
+ url: string;
4
+ path: string;
5
+ puppeteer?: boolean;
6
+ proxy?: Record<string, any>;
7
+ }
8
+ declare function downloadVideoFromRawLink(params: DownloadParams): Promise<void>;
9
+
10
+ export { downloadVideoFromRawLink, getDirectLink };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{a as o,b as r}from"./chunk-KX4T6SEL.js";export{r as downloadVideoFromRawLink,o as getDirectLink};
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "fast-dirpy",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "A simple library/CLI to download video using dirpy.com",
6
+ "author": "Vincent-the-gamer",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "bin": {
14
+ "fast-dirpy": "bin/fast-dirpy.js"
15
+ },
16
+ "typesVersions": {
17
+ "*": {
18
+ ".": [
19
+ "./dist/index.d.ts",
20
+ "./dist/cli.d.ts"
21
+ ]
22
+ }
23
+ },
24
+ "license": "MIT",
25
+ "homepage": "https://github.com/Vincent-the-gamer/fast-dirpy#readme",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/Vincent-the-gamer/fast-dirpy.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/Vincent-the-gamer/fast-dirpy/issues"
32
+ },
33
+ "publishConfig": {
34
+ "registry": "https://registry.npmjs.com",
35
+ "access": "public"
36
+ },
37
+ "sideEffects": false,
38
+ "devDependencies": {
39
+ "@types/node": "^22.13.14",
40
+ "taze": "^19.0.2",
41
+ "tsup": "^8.4.0",
42
+ "tsx": "^4.19.3",
43
+ "typescript": "^5.8.2",
44
+ "vitest": "^3.0.9"
45
+ },
46
+ "dependencies": {
47
+ "axios": "^1.8.4",
48
+ "cac": "^6.7.14",
49
+ "jsdom": "^26.0.0",
50
+ "restore-cursor": "^5.1.0"
51
+ },
52
+ "scripts": {
53
+ "tsx": "tsx",
54
+ "build": "tsup",
55
+ "test": "vitest",
56
+ "dep": "taze major",
57
+ "login": "pnpm login --registry https://registry.npmjs.com"
58
+ }
59
+ }