niconico API library for Node.JS, armed with Promises.
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')
The APIs return Promises. You can chain them with then
and catch
.
Returns a session cookie.
Type: string
Type: string
Returns a nicovideo agent. If a session is given, the agent will be authenticated and act as a signed user.
a session cookie given by niconico.login
.
Download a video to local dir.
Type: string
Type: string
Fetch a /watch/ page and returns its metadata.
Type: string
Returns thumbinfo. This doesn't requires session
.
Type: string
Download the video from url
to outputPath
.
Type: string
Type: string
Return stream.Readable
to download the video.
Type: string
See Contribution Guide for more information.
Thanks goes to these wonderful people (emoji key):
uetchy 💻 |
Yuta Hiroto 💻 |
m77so 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!