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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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()]

View File

@ -1,6 +1,6 @@
import concurrent.futures
import queue
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
@ -23,6 +23,7 @@ class Watcher:
try:
while True:
with concurrent.futures.ThreadPoolExecutor() as executor:
time.sleep(0.2)
executor.submit(unpackMsgBin, q.get())
except:
self.observer.stop()

View File

@ -17,6 +17,11 @@ def go(url):
chrome_options.add_argument('--proxy-server=%s' % config()['webdriver']['proxy'])
chrome_options.add_argument('--headless')
# 2022-04-09 添加一个忽略证书
chrome_options.add_argument('-ignore-certificate-errors')
chrome_options.add_argument('-ignore -ssl-errors')
chrome_options.add_argument('--incognito')
proxy = Proxy()
proxy.proxy_type = ProxyType.MANUAL
proxy.http_proxy = config()['webdriver']['proxy']