You've already forked Douyin_Web_Live
2022-05-19 修复改用wss协议后无法使用的问题
This commit is contained in:
BIN
scripts/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
scripts/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
scripts/__pycache__/mitmproxy.cpython-38.pyc
Normal file
BIN
scripts/__pycache__/mitmproxy.cpython-38.pyc
Normal file
Binary file not shown.
BIN
scripts/__pycache__/watcher.cpython-38.pyc
Normal file
BIN
scripts/__pycache__/watcher.cpython-38.pyc
Normal file
Binary file not shown.
BIN
scripts/__pycache__/webdriver.cpython-38.pyc
Normal file
BIN
scripts/__pycache__/webdriver.cpython-38.pyc
Normal file
Binary file not shown.
@ -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()]
|
||||
|
@ -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()
|
||||
|
@ -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']
|
||||
|
Reference in New Issue
Block a user