Code Monkey home page Code Monkey logo

bilibili-save-nodejs's Introduction

bilibili-save-nodejs

仓库地址

安装

npm i bilibili-save-nodejs

功能

  • 根据 URL 下载单个作品
  • 根据 UP 主的主页 URL 下载所有作品
  • 可选择下载视频或音频

使用方法

使用命令行工具

bili-download

根据命令行菜单选择要下载的内容和形式

夹带私货:一键追星,下载九三的所有视频:

bili-download -d

使用 Node.js API

函数名 作用
download 下载
downloadByVedioPath 根据视频 URL 下载单个作品
downloadByHomePath 根据 UP 主页下载所有作品

API 参数

注:三个函数的参数都为对象形式。

download

参数名 是否必须 取值范围 含义
downloadRange ['byAuthor','byVedio'] 根据作者主页 URL作品 URL
downloadType ['mp4','mp3'] 下载视频音频
downloadPath 合法的作品 URLUP 主页 URL
downloadFolder 存储目录的完整路径,缺省时使用默认值

目录默认值:

  • 视频:根目录下/video文件夹中
  • 音频:根目录下/audio文件夹中

demo:

const { download } = require("bilibili-download-nodejs");
download({
  downloadRange: "byAuthor",
  downloadType: "mp4",
  downloadPath: "https://space.bilibili.com/313580179",
})
  .then(() => console.log("下载成功"))
  .catch((e) => console.log("下载出错"));

downloadByVedioPath & downloadByHomePath

参数名 是否必须 取值范围 含义
type ['mp4','mp3'] 下载视频音频
url 合法的作品 URL
folder 存储目录的完整路径

demo:

const { downloadByVedioPath, downloadByHomePath } = require("./download.js");
const path = require("path");

// 下载单个作品的视频
downloadByVedioPath({
  url: "https://www.bilibili.com/video/BV1AL4y1L7cg",
  type: "mp4",
  folder: path.join(__dirname, "/foo"),
})
  .then(() => console.log("下载成功"))
  .catch((e) => console.log("下载出错"));

// 下载UP主所有作品的音频
downloadByHomePath({
  url: "https://space.bilibili.com/313580179",
  type: "mp3",
  folder: path.join(__dirname, "/bar"),
})
  .then(() => console.log("下载成功"))
  .catch((e) => console.log("下载出错"));

bilibili-save-nodejs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bilibili-save-nodejs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.