Giter Club home page Giter Club logo

niconico's Introduction

niconico

npm version npm: total downloads Build Status Coverage Status docs

niconico API library for Node.JS, armed with Promises.

Usage

npm install niconico
const { niconico, Nicovideo } = require('niconico')

const baseDir = './videos'

async function downloadVideo(videoID) {
  try {
    const session = await niconico.login(
      process.env.EMAIL,
      process.env.PASSWORD
    )
    const client = new Nicovideo(session)
    const filePath = await client.download(videoID, baseDir)

    console.log('Downloaded:', filePath)
  } catch (err) {
    console.log('Error:', err)
  }
}

downloadVideo('sm28222588')

API

API Documents

The APIs return Promises. You can chain them with then and catch.

niconico.login(email, password)

Returns a session cookie.

email

Type: string

password

Type: string

new Nicovideo([session])

Returns a nicovideo agent. If a session is given, the agent will be authenticated and act as a signed user.

session

a session cookie given by niconico.login.

nicovideo.download(videoID, outputDir)

Download a video to local dir.

videoID

Type: string

outputDir

Type: string

nicovideo.watch(videoID)

Fetch a /watch/ page and returns its metadata.

videoID

Type: string

nicovideo.thumbinfo(videoID)

Returns thumbinfo. This doesn't requires session.

videoID

Type: string

nicovideo.httpExport(url, outputPath)

Download the video from url to outputPath.

url

Type: string

outputPath

Type: string

nicovideo.stream(videoID)

Return stream.Readable to download the video.

videoID

Type: string

Contributing

See Contribution Guide for more information.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


uetchy

๐Ÿ’ป

Yuta Hiroto

๐Ÿ’ป

m77so

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

niconico's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar hiroppy avatar m77so avatar uetchy avatar

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  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.