2022-05-19 修复改用wss协议后无法使用的问题

This commit is contained in:
FedoraLinux
2022-05-19 19:12:03 +08:00
parent b120257d64
commit 99549c52fc
27 changed files with 75 additions and 8 deletions

View File

@ -3,11 +3,14 @@
import uuid
from mitmproxy import http
import re
class Writer:
def response(self, flow: http.HTTPFlow) -> None:
if flow.request.host == 'live.douyin.com':
def websocket_message(self, flow: http.HTTPFlow) :
re_c = re.search('webcast3-ws-web-.*\.douyin\.com', flow.request.host)
if re_c :
with open('/Users/geng/douyin_live/' + uuid.uuid4().hex, 'wb') as f:
f.write(bytes(flow.response.content))
mess = flow.websocket.messages[-1].content
f.write(bytes(mess))
addons = [Writer()]