1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-08-01 14:48:01 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
wbt5
a183f53730 修复变量名错误 2020-07-19 23:15:51 +08:00
wbt5
7e4acb527e 新增来疯直播弹幕 2020-07-19 22:19:14 +08:00
wbt5
60393a00ef 新增来疯直播弹幕 2020-07-19 22:17:36 +08:00
8 changed files with 70 additions and 12 deletions

View File

@ -8,7 +8,7 @@
**26** 个直播平台的直播源获取:斗鱼直播、虎牙直播、哔哩哔哩直播、战旗直播、网易 CC 直播、火猫直播、企鹅电竞、YY 直播、一直播、快手直播、花椒直播、映客直播、西瓜直播、触手直播、NOW 直播、抖音直播爱奇艺直播、酷狗直播、龙珠直播、PPS 奇秀直播、六间房、17 直播、来疯直播、优酷轮播台、网易 look 直播、千帆直播。
**14** 个直播平台的弹幕获取斗鱼直播、虎牙直播、哔哩哔哩直播、快手直播、火猫直播、企鹅电竞、花椒直播、映客直播、网易CC直播、酷狗直播、龙珠直播、PPS奇秀、搜狐千帆、战旗直播。
**15** 个直播平台的弹幕获取斗鱼直播、虎牙直播、哔哩哔哩直播、快手直播、火猫直播、企鹅电竞、花椒直播、映客直播、网易CC直播、酷狗直播、龙珠直播、PPS奇秀、搜狐千帆、战旗直播、来疯直播。
## 运行
@ -23,7 +23,9 @@
## 更新
### 2020.07.18新增酷狗、龙珠、PPS奇秀、搜狐千帆、战旗直播等5个平台的弹幕获取
### 2020.07.19:新增来疯直播弹幕获取
2020.07.18新增酷狗、龙珠、PPS奇秀、搜狐千帆、战旗直播等5个平台的弹幕获取
2020.07.11新增网易CC直播弹幕获取

View File

@ -16,6 +16,7 @@ from .zhanqi import ZhanQi
from .longzhu import LongZhu
from .pps import QiXiu
from .qf import QF
from .laifeng import LaiFeng
__all__ = ['DanmakuClient']
@ -46,7 +47,8 @@ class DanmakuClient:
'zhanqi.tv': ZhanQi,
'longzhu.com': LongZhu,
'pps.tv': QiXiu,
'qf.56.com': QF}.items():
'qf.56.com': QF,
'laifeng.com': LaiFeng}.items():
if re.match(r'^(?:http[s]?://)?.*?%s/(.+?)$' % u, url):
self.__site = s
self.__u = u
@ -61,7 +63,7 @@ class DanmakuClient:
self.__ws = await self.__hs.ws_connect(ws_url)
if reg_datas:
for reg_data in reg_datas:
if self.__u == 'qf.56.com':
if self.__u == 'qf.56.com' or self.__u == 'laifeng.com':
await self.__ws.send_str(reg_data)
else:
await self.__ws.send_bytes(reg_data)
@ -70,7 +72,7 @@ class DanmakuClient:
while not self.__stop and self.__site.heartbeat:
await asyncio.sleep(self.__site.heartbeatInterval)
try:
if self.__u == 'qf.56.com':
if self.__u == 'qf.56.com' or self.__u == 'laifeng.com':
await self.__ws.send_str(self.__site.heartbeat)
else:
await self.__ws.send_bytes(self.__site.heartbeat)

View File

@ -249,7 +249,7 @@ class CC:
s = CC_Init()
heartbeatInterval = 30
heartbeats = s.get_beat()
heartbeat = s.get_beat()
@staticmethod
async def get_ws_info(url):

View File

@ -5,7 +5,7 @@ import re
class eGame:
heartbeats = b'\x00\x00\x00\x12\x00\x12\x00\x01\x00\x07\x00\x00\x00\x01\x00\x00\x00\x00'
heartbeat = b'\x00\x00\x00\x12\x00\x12\x00\x01\x00\x07\x00\x00\x00\x01\x00\x00\x00\x00'
heartbeatInterval = 60
@staticmethod
@ -35,7 +35,7 @@ class eGame:
headerbuf = struct.pack('!ihhhihh', 18 + len(bodybuf), 18, 1, 1, 0, 0, 0)
data = headerbuf + bodybuf
reg_datas.append(data)
reg_datas.append(eGame.heartbeats)
reg_datas.append(eGame.heartbeat)
return 'wss://barragepush.egame.qq.com/sub', reg_datas

View File

@ -9,7 +9,7 @@ import time
class HuaJiao:
heartbeats = b'\x00\x00\x00\x00'
heartbeat = b'\x00\x00\x00\x00'
ws_url = 'wss://bridge.huajiao.com'
def __init__(self, rid=None):

View File

@ -8,7 +8,7 @@ import re
class KuaiShou:
heartbeats = b'\x08\x01\x1A\x07\x08' # 发送心跳可固定
heartbeat = b'\x08\x01\x1A\x07\x08' # 发送心跳可固定
heartbeatInterval = 20
@staticmethod

53
danmu/danmaku/laifeng.py Normal file
View File

@ -0,0 +1,53 @@
import aiohttp
import json
import time
class LaiFeng:
heartbeat = '2::'
heartbeatInterval = 30
@staticmethod
async def get_ws_info(url):
rid = url.split('/')[-1]
async with aiohttp.ClientSession() as session:
async with session.get('http://v.laifeng.com/') as resp:
imk = dict(resp.cookies)['imk'].value
args = {
'name': 'enter',
'args': [{
'token': imk.replace('%3D', '='),
'yktk': '',
'uid': '2082628924',
'isPushHis': '1',
'roomid': rid,
'endpointtype': 'ct_,dt_1_1003|0|_{}|CTaXF+oKpB4CAatxtZHBQchJ'.format(time.time() * 1e3)
}]
}
reg_data = '5:::' + json.dumps(args)
return 'ws://normal01.chatroom.laifeng.com/socket.io/1/websocket/', [reg_data]
@staticmethod
def decode_msg(message):
type_ = message[0]
msgs = []
msg = {'name': '', 'content': '', 'msg_type': 'other'}
if type_ == '5':
data = json.loads(message[4:])
name = data.get('name', 0)
args = data['args']
for arg in args:
if name == 'enterMessage': # 入场信息
msg['name'] = 'SYS'
msg['content'] = arg['body']['n'] + ' 进入频道'
msg['msg_type'] = 'danmaku'
elif name == 'globalHornMessage': # 系统消息
msg['name'] = 'SYS'
msg['content'] = arg['body']['m']
msg['msg_type'] = 'danmaku'
elif name == 'chatMessage': # 弹幕
msg['name'] = arg['body']['n']
msg['content'] = arg['body']['m']
msg['msg_type'] = 'danmaku'
msgs.append(msg.copy())
return msgs

View File

@ -21,7 +21,7 @@ async def main(url):
a = input('请输入直播间地址:\n')
asyncio.run(main())
asyncio.run(main(a))
# 虎牙https://www.huya.com/11352915
# 斗鱼https://www.douyu.com/85894
@ -31,9 +31,10 @@ asyncio.run(main())
# 企鹅电竞https://egame.qq.com/383204988
# 花椒直播https://www.huajiao.com/l/303344861?qd=hu
# 映客直播https://www.inke.cn/liveroom/index.html?uid=87493223&id=1593906372018299
# CC直播https://cc.163.com/363936598/
# CC直播https://cc.163.com/363936598/a
# 酷狗直播https://fanxing.kugou.com/1676290
# 战旗直播
# 龙珠直播http://star.longzhu.com/wsde135864219
# PPS奇秀直播https://x.pps.tv/room/208337
# 搜狐千帆直播https://qf.56.com/520208a
# 来疯直播https://v.laifeng.com/656428