Commit 8abdc0fc authored by nanahira's avatar nanahira

bin

parent 348d76dd
export * from './src/ott';
export * from './src/types/get-share';
This diff is collapsed.
...@@ -8,12 +8,15 @@ ...@@ -8,12 +8,15 @@
"lint": "eslint --fix .", "lint": "eslint --fix .",
"build": "rimraf dist && tsc", "build": "rimraf dist && tsc",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests",
"start": "node dist/index.js" "start": "node dist/src/bin.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://code.mycard.moe/3rdeye/123yun-share.git" "url": "https://code.mycard.moe/3rdeye/123yun-share.git"
}, },
"bin": {
"ottshare": "./dist/src/bin.js"
},
"author": "Nanahira <nanahira@momobako.com>", "author": "Nanahira <nanahira@momobako.com>",
"license": "MIT", "license": "MIT",
"keywords": [], "keywords": [],
...@@ -54,6 +57,7 @@ ...@@ -54,6 +57,7 @@
}, },
"dependencies": { "dependencies": {
"aragami": "^1.1.2", "aragami": "^1.1.2",
"axios": "^1.1.3" "axios": "^1.1.3",
"commander": "^9.4.1"
} }
} }
import { Command } from 'commander';
import { version, description } from '../package.json';
import { OneTwoThreeShare } from './ott';
const program = new Command();
program.version(version).description(description);
program
.command('parse')
.description('Parse a link from 123yun')
.argument('<link>', 'Link to parse')
.option('-p, --password <password>', 'Password of the share')
.option('--client-ip <clientIp>', 'Client IP')
.action(async (link: string, options) => {
const ott = new OneTwoThreeShare();
try {
const result = (await ott.parse(link, options))[0].DownloadUrl;
console.log(result);
} catch (e) {
console.error(e.message);
process.exit(1);
}
});
program.parse();
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"declaration": true, "declaration": true,
"sourceMap": true "sourceMap": true,
"resolveJsonModule": true,
}, },
"compileOnSave": true, "compileOnSave": true,
"allowJs": true, "allowJs": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment