├── vitest.config.ts ├── .editorconfig ├── .github └── workflows │ └── main.yml ├── .gitignore ├── tsconfig.json ├── src ├── index.ts ├── client.spec.ts └── client.ts ├── README.md ├── package.json ├── LICENSE └── pnpm-lock.yaml /vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | testTimeout: 100000 6 | } 7 | }) 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | insert_final_newline = true 8 | 9 | [*.md] 10 | max_line_length = off 11 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | - uses: actions/setup-node@v3 14 | with: 15 | node-version: 18 16 | registry-url: https://registry.npmjs.org/ 17 | - uses: pnpm/action-setup@v2 18 | with: 19 | version: 7 20 | - run: pnpm install 21 | - run: pnpm run build 22 | - run: pnpm publish --no-git-checks 23 | env: 24 | NODE_AUTH_TOKEN: ${{secrets. NPM_TOKEN}} 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /tmp 5 | /output 6 | /bin 7 | /dist 8 | 9 | # dependencies 10 | /node_modules 11 | 12 | # IDEs and editors 13 | .idea 14 | .project 15 | .classpath 16 | .c9/ 17 | *.launch 18 | .settings/ 19 | *.sublime-workspace 20 | 21 | # IDE - VSCode 22 | .vscode/* 23 | !.vscode/settings.json 24 | !.vscode/tasks.json 25 | !.vscode/launch.json 26 | !.vscode/extensions.json 27 | 28 | # misc 29 | /.sass-cache 30 | /connect.lock 31 | /coverage 32 | /libpeerconnection.log 33 | npm-debug.log 34 | yarn-error.log 35 | testem.log 36 | /typings 37 | 38 | # System Files 39 | .DS_Store 40 | Thumbs.db 41 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "experimentalDecorators": true, 6 | "target": "ESNext", 7 | "sourceMap": true, 8 | "baseUrl": "./", 9 | "rootDir": "./", 10 | "strict": true, 11 | "moduleResolution": "node", 12 | "allowSyntheticDefaultImports": true, 13 | "esModuleInterop": true, 14 | "emitDecoratorMetadata": true, 15 | "declaration": true, 16 | "forceConsistentCasingInFileNames": true, 17 | "skipLibCheck": true, 18 | "noUnusedLocals": true, 19 | "noUnusedParameters": true 20 | }, 21 | "include": [ 22 | "src/**/*.ts" 23 | ], 24 | "exclude": [ 25 | "node_modules", 26 | "src/**/*.spec.ts" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import { Client, Option } from './client' 3 | import { Command } from 'commander' 4 | import process from 'node:process' 5 | 6 | const cmd = new Command() 7 | cmd.requiredOption('-b, --bvid ', 'Video BVID') 8 | cmd.option('-t, --token ', 'Value from cookie [SESSDATA]', '') 9 | cmd.option('-d, --dir ', 'Output dir', './') 10 | cmd.option('-u, --user-agent ', 'User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36') 11 | cmd.option('-ss, --select-stream', 'Select stream', false) 12 | cmd.version('0.0.4') 13 | cmd.parseAsync(process.argv) 14 | 15 | const option = cmd.opts