Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uetchy/niconico
📺 niconico API wrapper for NodeJS.
https://github.com/uetchy/niconico
niconico nicovideo
Last synced: about 1 month ago
JSON representation
📺 niconico API wrapper for NodeJS.
- Host: GitHub
- URL: https://github.com/uetchy/niconico
- Owner: uetchy
- License: mit
- Created: 2014-02-09T08:40:53.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2020-08-25T14:28:48.000Z (about 4 years ago)
- Last Synced: 2024-10-07T16:42:11.899Z (about 1 month ago)
- Topics: niconico, nicovideo
- Language: TypeScript
- Homepage: https://uetchy.github.io/niconico/
- Size: 958 KB
- Stars: 30
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# niconico
[![npm version]][npmjs]
[![npm: total downloads](https://badgen.net/npm/dt/niconico)][npmjs]
[![Build Status]][travis]
[![Coverage Status]][coveralls]
[![docs]][docs-url][npm version]: https://badgen.net/npm/v/niconico
[npmjs]: https://www.npmjs.com/package/niconico
[build status]: https://travis-ci.com/uetchy/niconico.svg?branch=master
[travis]: https://travis-ci.com/uetchy/niconico
[coverage status]: https://coveralls.io/repos/github/uetchy/niconico/badge.svg?branch=master
[coveralls]: https://coveralls.io/github/uetchy/niconico?branch=master
[docs]: https://badgen.net/badge/documentation/available/purple
[docs-url]: https://uetchy.github.io/niconico/niconico API library for Node.JS, armed with Promises.
## Usage
```bash
npm install niconico
``````js
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](https://uetchy.github.io/niconico/)
The APIs return Promises. You can chain them with `then` and `catch`.
### niconico.login(email, password)
Returns a session cookie.
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](./CONTRIBUTING.md) for more information.
### Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
uetchy
💻
Yuta Hiroto
💻
m77so
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!