#!/usr/bin/python
# coding:utf-8

# @FileName:    main.py
# @Time:        2024/1/2 22:27
# @Author:      bubu
# @Project:     douyinLiveWebFetcher

from liveMan import DouyinLiveWebFetcher
from threading import Thread
from ws_server import start_ws_server
import time

# ✅ 后台启动 WebSocket 服务
def start_ws():
    try:
        start_ws_server()
    except Exception as e:
        print("WebSocket 服务启动失败:", e)

Thread(target=start_ws, daemon=True).start()

# ✅ 稍微等待 WebSocket 服务初始化
time.sleep(1)

# ✅ 主程序启动直播监听
if __name__ == '__main__':
    live_id = '9638535297'
    # live_id = '262648053209'

    room = DouyinLiveWebFetcher(live_id)
    room.get_room_status()
    room.start()
