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 given, the agent authenticate 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
Before create a pull-request, you need to test using npm test
.
NICONICO_EMAIL=<email> NICONICO_PASSWORD=<password> npm test
Generated using TypeDoc