Niconico live broadcast For Node.js
A client library for niconico live broadcast.
User live broadcast, channel broadcast, official broadcast comments can be obtained.
Installation
npm i niconama-client
or
yarn add niconama-client
Examples
Login
; const client = ;client ;// user_session=user_session_00000_123abc
Comments of all rooms (co00000, 立ち見A, 立ち見B, etc)
; const client = ;client;const commentStream = client;commentStream; client; // コメ番: 10 ユーザーID: aaa 時間: 22:20:4 コメント: comment1 プレミア: 2 部屋: 立ち見C列// コメ番: 106 ユーザーID: bbb 時間: 22:20:4 コメント: comment2 プレミア: 2 部屋: 立ち見B列// コメ番: 10 ユーザーID: ccc 時間: 22:20:4 コメント: comment3 プレミア: 2 部屋: 立ち見D列// ...
Do comment
; const client = ;client; client ;
Detailed examples are here
Methods
login(email: string, password: string)
- Returns:
Promise.<session>
Login to niconico, and receive session.
setLiveInfo(liveId: string, session: string)
Create Live instance with liveId and session. liveId is the string starting with lv
in niconico live URL
ex. http://live.nicovideo.jp/watch/lv0000000
In this case, lv0000000
is the liveId
liveComments()
- Returns:
Promise.<>
Get comments from niconico comment servers
createLiveCommentStream()
- Returns:
LiveCommentStream
Create LiveCommentStream instance. Call this method after calling liveComments()
doLiveComment(comment: string[, option: string])
Do comment to niconico live broadcast. Call this method after calling liveComments()
Options argument is a string with space separator. ex: 184 red big
. Options are below
items | details |
---|---|
size | small, big |
vertical position | ue/top, shita/bottom |
horizontal position | migi/right, hidari/left |
color(not premium) | white, red, green, blue, cyan, yellow, purple, pink, orange |
color(premium or broadcaster) | niconicowhite/white2, marineblue/blue2, madyellow/yellow2, passionorange/orange2, nobleviolet/purple2, elementalgreen/green2, truered/red2, black |
color(psyllium) | passionorange/orange2, nobleviolet/purple2, elementalgreen/green2, truered/red2, black |
other | 184, hidden |
TODO
- In channel broadcast, cannot get comments, for examples, from アリーナ席 to 立ち見席 and from 立ち見席 to アリーナ席.