Skip to content

NodeJS Wrapper for DouyuTV API, including chats, e.g. DanMu/弹幕

License

Notifications You must be signed in to change notification settings

gexiaowei/douyujs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DouyuTV API Wrapper

NodeJS Wrapper for DouyuTV APIs

Supported Platforms

This library has been tested with:

  • IO.js v2.5.0

Installation

npm install douyu

API Usage

// Import library
var douyu = require('douyu');

// Initialize Room entity
var roomID = "424559";
var room = new douyu.ChatRoom(roomID);

// System level events handler
room.on('connect', function(message){
	console.log('DouyuTV ChatRoom #' + roomID + ' connected.');
});
room.on('error', function(error){
	console.error('Error: ' + error.toString());
});
room.on('close', function(hasError){
	console.log('DouyuTV ChatRoom #' + roomID + ' disconnected' + hasError ? ' because of error.' : '.');
});

// Chat server events
room.on('chatmsg', function(message){
	console.log('[' + message.nn + ']: ' + message.txt);
});

// Knock, knock ...
room.open();

About

NodeJS Wrapper for DouyuTV API, including chats, e.g. DanMu/弹幕

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%