1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-07-28 20:35:55 +08:00

主文件

This commit is contained in:
wbt5 2020-06-18 10:22:14 +08:00
parent 6166abce86
commit 48c89a6bde

29
danmu/main.py Normal file
View File

@ -0,0 +1,29 @@
# 部分弹幕功能代码来自项目https://github.com/IsoaSFlus/danmaku感谢大佬
# 快手弹幕代码来源及思路https://github.com/py-wuhao/ks_barrage感谢大佬
# 仅抓取用户弹幕,不包括入场提醒、礼物赠送等。
import asyncio
import danmaku
async def printer(q):
while True:
m = await q.get()
if m['msg_type'] == 'danmaku':
print(f'{m["name"]}{m["content"]}')
async def main(url):
q = asyncio.Queue()
dmc = danmaku.DanmakuClient(url, q)
asyncio.create_task(printer(q))
await dmc.start()
a = input('请输入直播间地址:\n')
asyncio.run(main(a))
# 虎牙https://www.huya.com/11352915
# 斗鱼https://www.douyu.com/85894
# B站https://live.bilibili.com/70155
# 快手https://live.kuaishou.com/u/jjworld126