You've already forked Douyin_Web_Live
intro pyyml
This commit is contained in:
BIN
scripts/__pycache__/mitmproxy.cpython-39.pyc
Normal file
BIN
scripts/__pycache__/mitmproxy.cpython-39.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -4,10 +4,12 @@
|
||||
import uuid
|
||||
from mitmproxy import http
|
||||
|
||||
from config.helper import config
|
||||
|
||||
class Writer:
|
||||
def response(self, flow: http.HTTPFlow) -> None:
|
||||
if flow.request.host == 'live.douyin.com':
|
||||
with open('/Users/geng/douyin_live/' + uuid.uuid4().hex, 'wb') as f:
|
||||
with open(config().mitmproxy.log_dir + uuid.uuid4().hex, 'wb') as f:
|
||||
f.write(bytes(flow.response.content))
|
||||
|
||||
addons = [Writer()]
|
||||
|
@ -1,13 +1,24 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
from selenium.webdriver.common.proxy import Proxy, ProxyType
|
||||
|
||||
def lunch(url):
|
||||
from config.helper import config
|
||||
|
||||
def go(url):
|
||||
chrome_options = Options()
|
||||
chrome_options.add_argument('--proxy-server=127.0.0.1:8080')
|
||||
chrome_options.add_argument('--headless')
|
||||
chrome_options.add_argument('--proxy-server=%s' % config()['webdriver']['proxy'])
|
||||
# chrome_options.add_argument('--headless')
|
||||
chrome_options.add_experimental_option('detach', True)
|
||||
|
||||
driver = webdriver.Chrome(options=chrome_options)
|
||||
proxy = Proxy()
|
||||
proxy.proxy_type = ProxyType.MANUAL
|
||||
proxy.http_proxy = config()['webdriver']['proxy']
|
||||
proxy.ssl_proxy = config()['webdriver']['proxy']
|
||||
|
||||
capabilities = DesiredCapabilities.CHROME
|
||||
proxy.add_to_capabilities(capabilities)
|
||||
|
||||
driver = webdriver.Chrome(options=chrome_options, desired_capabilities=capabilities, executable_path=config()['webdriver']['bin'])
|
||||
|
||||
driver.get(url)
|
||||
|
||||
|
Reference in New Issue
Block a user