# bilidown

> 基于Node.js的B站视频下载器

Latest version **1.3.1** (published 2015-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install bilidown
pnpm add bilidown
yarn add bilidown
bun add bilidown
```

Provides the command `bilidown`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2015-09-01 |
| First published | 2015-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | luMinO |
| Maintainers | luminocean |

## Links

- npm: https://www.npmjs.com/package/bilidown
- Repository: https://github.com/luminocean/bilidown
- Homepage: https://github.com/luminocean/bilidown#readme
- Issues: https://github.com/luminocean/bilidown/issues
- npm.io page: https://npm.io/package/bilidown

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.61.0
- [commander](https://npm.io/package/commander.md) ^2.8.1

## Recent versions

- 1.3.1 (latest) — 2015-09-01
- 1.3.0 — 2015-09-01
- 1.2.3 — 2015-08-30
- 1.2.2 — 2015-08-30

## README

# Bilidown
基于Node.js的B站视频下载器

### 基本用法 - 作为独立的可执行文件使用

在bin目录下可以找到可执行文件bilidown，该文件即可独立执行的脚本程序

Usage: bilidown [options]

  Options:

    -h, --help               output usage information
    -V, --version            output the version number
    -u, --url [url]          The url of the video page
    -d, --dir [directory]    The directory to which videos will be saved (absolute or relative). Default to the current execution directory.
    -n, --nth [page_number]  The number of the subpage you want to download the video from.(In the case where one video page has multiple subpages) Default to 1

示例（进入bilidown目录后）：
bin/bilidown -d videos -n 2 -u http://www.bilibili.com/video/av2474781/

这行命令将下载该页面的第二个视频到当前目录下的videos文件夹下

当bilidown被全局安装后（参见安装部分），可以在任意位置直接使用bilidown命令

> 在Windows环境下，需要显式使用node指令来执行该脚本，如 node bin/bilidown

### 基本用法 - 作为node模块使用

除了作为独立的可执行文件运行以外，bilidown还可以作为一个标准的node模块内嵌到其他程序中使用
具体用法可参见bin/bilidown文件

在执行bilidown.downloadPageVideo()后会返回一个EventEmitter，可以在其上调用on函数监听事件：
> progress: 下载过程中触发，会传入一个progress对象，其中progress.current表示已下载的字节数，progress.total表示总共需要下载的字节数
> end: 下载完成后触发
> error: 下载发生错误后触发

基于这些事件可以基于下载过程添加一定程度的功能，bin/bilidown就是在其上添加了基于命令行简单地下载动画效果

### 安装

首先确认安装了Node.js与npm工具，参考 https://nodejs.org 与 https://www.npmjs.com

git clone以后，在项目目录下执行`npm install`安装依赖后即可使用

在项目目录下执行 sudo npm install -g . 可以把bilidown安装到全局，从而可以在命令行中直接使用bilidown运行

---
_Source: https://npm.io/package/bilidown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
