npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

niconama-client

v0.1.0

Published

Client library for the Nico live broadcast.

Downloads

10

Readme

Niconico live broadcast For Node.js

Build Status

NPM

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

import NiconamaClient from 'niconama-client';

const client = new NiconamaClient();
client.login(email, password)
  .then( session => {
    console.log(session);
  });
// user_session=user_session_00000_123abc

Comments of all rooms (co00000, 立ち見A, 立ち見B, etc)

import NiconamaClient from 'niconama-client';

const client = new NiconamaClient();
client.setLiveInfo(liveId, session);
const commentStream = client.createLiveCommentStream();
commentStream.on('readable', () => {
  const comment = commentStream.read();
  console.log(
    `コメ番: ${comment.no}\tユーザーID: ${comment.user_id}\t時間: ${timestampToDateformat(comment.date)}\t
  コメント: ${comment.comment}\tプレミア: ${comment.premium}\t NGスコア: ${comment.score}\t 部屋: ${comment.roomLabel}`
  );
});

client.liveComments();

// コメ番: 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

import NiconamaClient from 'niconama-client';

const client = new NiconamaClient();
client.setLiveInfo(liveId, session);

client.liveComments()
  .then( () => {
    client.doLiveComment(comment, option);
  });

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 アリーナ席.

License

MIT © pro_shunsuke