mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-20 10:25:01 +08:00
抖音直播间弹幕
This commit is contained in:
parent
eb12d074bf
commit
3fca5659fb
@ -66,7 +66,7 @@ print(info)
|
|||||||
|
|
||||||
打印的效果,二进制文件
|
打印的效果,二进制文件
|
||||||
|
|
||||||
b'\x08\xe8\x07\x10\xd0\x0f'
|
序列化后的二进制数据:b'\x08\xe8\x07\x10\xd0\x0f'
|
||||||
|
|
||||||
2.将数据反序列化
|
2.将数据反序列化
|
||||||
|
|
||||||
@ -80,15 +80,15 @@ print(p.logId)
|
|||||||
|
|
||||||
打印的效果
|
打印的效果
|
||||||
|
|
||||||
1000
|
反序列化后的真实数据:1000 , 2000
|
||||||
2000
|
|
||||||
|
|
||||||
## 二、websocket 连接
|
## 二、反序列化抖音数据
|
||||||
|
|
||||||
直播间弹幕是实时响应的,这样数据显示方式大概率就是websocket协议
|
|
||||||
|
|
||||||
## 三、数据流过程
|
## 三、websocket 连接
|
||||||
|
|
||||||
|
直播间弹幕是实时响应的,这样数据显示方式用websocket协议最方便,但也是最容易破解的。
|
||||||
|
|
||||||
|
## 四、数据流过程
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
0
抖音js逆向学习/抖音直播间弹幕/extractors/__init__.py
Normal file
0
抖音js逆向学习/抖音直播间弹幕/extractors/__init__.py
Normal file
38
抖音js逆向学习/抖音直播间弹幕/extractors/解析直播间广播数据.py
Normal file
38
抖音js逆向学习/抖音直播间弹幕/extractors/解析直播间广播数据.py
Normal file
File diff suppressed because one or more lines are too long
@ -1,14 +0,0 @@
|
|||||||
from douyin_pb2 import PushFrame, Response, ChatMessage
|
|
||||||
|
|
||||||
# p = PushFrame()
|
|
||||||
# p.seqId = 1000
|
|
||||||
# p.logId = 2000
|
|
||||||
|
|
||||||
# info = p.SerializeToString()
|
|
||||||
# print(info)
|
|
||||||
|
|
||||||
info = b'\x08\xe8\x07\x10\xd0\x0f'
|
|
||||||
p = PushFrame()
|
|
||||||
p.ParseFromString(info)
|
|
||||||
print(p.seqId)
|
|
||||||
print(p.logId)
|
|
13
抖音js逆向学习/抖音直播间弹幕/test_序列化.py
Normal file
13
抖音js逆向学习/抖音直播间弹幕/test_序列化.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from 抖音直播间弹幕.extractors.douyin_pb2 import PushFrame
|
||||||
|
|
||||||
|
p = PushFrame()
|
||||||
|
p.seqId = 1000
|
||||||
|
p.logId = 2000
|
||||||
|
|
||||||
|
info = p.SerializeToString()
|
||||||
|
print(f"序列化后的二进制数据:{info}")
|
||||||
|
|
||||||
|
info = b'\x08\xe8\x07\x10\xd0\x0f'
|
||||||
|
p = PushFrame()
|
||||||
|
p.ParseFromString(info)
|
||||||
|
print(f"反序列化后的真实数据:{p.seqId}, {p.logId}")
|
@ -1,4 +1,4 @@
|
|||||||
from douyin_pb2 import PushFrame, Response, ChatMessage
|
from 抖音直播间弹幕.extractors.douyin_pb2 import PushFrame, Response, ChatMessage
|
||||||
from urllib.parse import unquote_plus
|
from urllib.parse import unquote_plus
|
||||||
from websocket import WebSocketApp
|
from websocket import WebSocketApp
|
||||||
import requests
|
import requests
|
||||||
@ -67,8 +67,7 @@ def on_message(ws, content):
|
|||||||
|
|
||||||
ws.send(s.SerializeToString())
|
ws.send(s.SerializeToString())
|
||||||
|
|
||||||
# 获取数据内容(需根据不同method,使用不同的结构对象对 数据 进行解析)
|
# 获取数据内容(需根据不同method,使用不同的结构对象对 数据 进行解析)注意:此处只处理 WebcastChatMessage ,其他处理方式都是类似的。
|
||||||
# 注意:此处只处理 WebcastChatMessage ,其他处理方式都是类似的。
|
|
||||||
for item in response.messagesList:
|
for item in response.messagesList:
|
||||||
if item.method != "WebcastChatMessage":
|
if item.method != "WebcastChatMessage":
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user