importcjj / Danmu.go
Licence: mit
基于golang的命令行形式的直播网站(斗鱼)的弹幕浏览
Stars: ✭ 14
Programming Languages
go
31211 projects - #10 most used programming language
Projects that are alternatives of or similar to Danmu.go
DouyuBarrage-Pro
(2020年最新)斗鱼弹幕抓取及可视化管理平台第二版,提供弹幕抓取、弹幕实时发送速度可视化、抓取记录查询、弹幕下载、自定义关键词统计、铁粉统计、高光时刻自动捕获、高频弹幕词云等功能,起飞~~~
Stars: ✭ 139 (+892.86%)
Mutual labels: danmu, douyu
Real Url
获取斗鱼&虎牙&哔哩哔哩&抖音&快手等 58 个直播平台的真实流媒体地址(直播源)和弹幕,直播源可在 PotPlayer、flv.js 等播放器中播放。
Stars: ✭ 3,748 (+26671.43%)
Mutual labels: douyu, danmu
Danmaku
A high-performance JavaScript danmaku engine. 高性能弹幕引擎库
Stars: ✭ 446 (+3085.71%)
Mutual labels: danmu
Juno
Juno 译名朱诺。这个名字来源于古罗马神话中的众神之母。它是斗鱼的微服务管理系统, 如同众神之母一样守护着所有微服务的系统。
Stars: ✭ 285 (+1935.71%)
Mutual labels: douyu
Ocbarrage
iOS 弹幕库 OCBarrage, 同时渲染5000条弹幕也不卡, 轻量, 可拓展, 高度自定义动画, 超高性能, 简单易上手; A barrage render-engine with high performance for iOS. At the same time, rendering 5000 barrages is also very smooth, lightweight, scalable, highly custom animation, ultra high performance, simple and easy to use!
Stars: ✭ 589 (+4107.14%)
Mutual labels: danmu
Danmu.go
Douyu弹幕简单示例
package main
import (
"fmt"
"github.com/importcjj/danmu.go/douyu"
)
// 默认弹幕服务器
const (
DefaultDouyuDanmuHost = "openbarrage.douyutv.com"
DefaultDouyuDanmuPort = 8601
)
// DanmuHandle 为自定义的弹幕处理
func DanmuHandle(message *douyu.Message) {
contentType, ok := message.Field("type")
if !ok {
return
}
switch contentType {
// 有多种消息类型.
case douyu.TypeChatMsg:
// 默认全部为string
nick, _ := message.Field("nn")
level, _ := message.Field("level")
text, _ := message.Field("txt")
fmt.Printf("<level %s> - %s >>> %s\n", level, nick, text)
case douyu.TypeUserEnter:
nick, _ := message.Field("nn")
level, _ := message.Field("level")
fmt.Printf("!!!!!欢迎<lv %s> %s 进入房间\n", level, nick)
}
}
func main() {
douyuClient := douyu.New()
douyuClient.Connect(DefaultDouyuDanmuHost, DefaultDouyuDanmuPort)
douyuClient.JoinRoom(288016)
douyuClient.HandleFunc(DanmuHandle)
douyuClient.Watch()
}
注意上述代码中,JoinRoom使用的参数为房间ID,特殊的房间名是不支持的。需要你用浏览器打开该直播间,并使用开发者工具查看主HTML中$ROOM这个对象中定义的room_id字段的值(可使用文本搜索)
示例效果
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].