Projects
View on GitHub
scx567888/live-room-watcher
About
📺 Can capture livestream chat messages, gifts, likes, raw stream URLs, and more
Productivity & AutomationMeasured star growth
- in 24h
- 0
- in 7 days
- +2
- in 15 days
- +2
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalLive Room Watcher
📺 可抓取直播间 弹幕, 礼物, 点赞, 原始流地址等 (仅供学习使用,不得用于商业用途)
| 平台 | 弹幕(消息) | 点赞 | 礼物 | 进入直播间 | 关注 | 原始流地址 |
|---|---|---|---|---|---|---|
| 抖音(Hack) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| TikTok (Hack) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Maven
<dependency>
<groupId>cool.scx</groupId>
<artifactId>live-room-watcher</artifactId>
<version>{version}</version>
</dependency>
基本用法
import cool.scx.live_room_watcher.impl.douyin_hack.DouYinHackLiveRoomWatcher;
import static cool.scx.live_room_watcher.impl.douyin_hack.DouYinHackLiveRoomInfoResolver.resolveLiveRoomInfo;
import static cool.scx.live_room_watcher.impl.douyin_hack.DouYinHackWebSocketOptionsProvider.ofPlaywright;
public class Main {
public static void main(String[] args) {
var liveRoomURL = "https://live.douyin.com/510200350291";
var cookiesStr = "xxxxxx";
System.out.println("解析 直播间 中...");
var liveRoomInfo = resolveLiveRoomInfo(liveRoomURL);
System.out.println("解析 直播间 完成 -> " + liveRoomInfo.title() + " (ID : " + liveRoomInfo.roomID() + ")");
System.out.println("[直播流地址] " + liveRoomInfo.webStreamURLs());
var liveRoomWatcher = new DouYinHackLiveRoomWatcher(ofPlaywright(liveRoomURL, cookiesStr));
liveRoomWatcher.onChat(chat -> {
System.out.println("[消息] " + chat.user().nickname() + " : " + chat.content());
}).onUser(user -> {
System.out.println("[来了] " + user.nickname());
}).onLike(like -> {
System.out.println("[点赞] " + like.user().nickname() + " x " + like.count());
}).onFollow(follow -> {
System.out.println("[关注] " + follow.user().nickname());
}).onGift(gift -> {
System.out.println("[礼物] " + gift.user().nickname() + " : " + gift.name() + " x " + gift.count());
});
liveRoomWatcher.startWatch();
}
}
关于 Cookies 和 WebSocket 地址的获取
这里提供一个小 Chrome 插件 "chrome-extension"
chrome-extension 使用方法
1, 安装到 Chrome 浏览器中 (相同内核都可以)
2, 打开一个抖音 直播间
3, 打开插件 复制 Cookie 字符串 和 WebSocket (最长的那个)
4, 使用 DouYinHackLiveRoomWatcher 监听 这里有两种方式
4.1, 如果使用 ofPlaywright(), 只需要 直播间页面地址 + cookie 就可以
4.2, 如果使用 ofWebSocketURL(), 需要 刚刚复制的 WebSocket 地址 + cookie
如果连接失败, 建议重试几次
由于第三方的系统总是在不断的更新升级 如果功能失效请提 issues 并详细说明情况 .
Explore related projects
Loading…