小编Pra*_*gar的帖子

未知错误:在 Docker 中运行时 DevToolsActivePort 文件不存在

我正在尝试在运行 alpine 的 Docker 容器中使用 Python 和 selenium 运行 chrome。它运行得很好,直到有一天,当我实例化 chrome 时,它​​开始抛出以下错误。

Message: unknown error: Chrome failed to start: crashed.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/lib/chromium/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Run Code Online (Sandbox Code Playgroud)

代码

这是创建此错误的代码:

from selenium import webdriver


def generate_plugin():
    pluginfile = 'proxy_auth_plugin.zip'

    # manifest_json, background_js same as https://stackoverflow.com/a/61764363/9809865

    with zipfile.ZipFile(pluginfile, 'w') as zp:
        zp.writestr("manifest.json", manifest_json)
        zp.writestr("background.js", background_js)
    return pluginfile


chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications": 2} …
Run Code Online (Sandbox Code Playgroud)

python selenium selenium-webdriver docker alpine-linux

13
推荐指数
1
解决办法
1万
查看次数

尝试流式传输电报媒体并在网页中播放

我正在尝试流式传输 Telegram 视频文件并在网页上播放它们。

我正在使用脚本将 Telegram 视频流式传输到 Web 服务器。它使用TelethonAIOhttp来流式传输文件。流媒体部分可以在这里看到。

我目前在服务器上提供它来提供媒体文件。可以使用脚本提供的链接下载视频,并可以在任何媒体播放器上流式传输。但是当我尝试在网页上流式传输它们时,它有问题。

对于 mp4 视频,Chrome 不会播放,而 Firefox 会播放。例子 在 Chrome 中播放视频时(扩展程序没有引起任何问题,在此页面上禁用)

这是我在Chrome中打开上述脚本时脚本的DEBUG日志

INFO:tl.web_routes:Serving file in 723 (chat 550559022) to ::1
DEBUG:tl.paralleltransfer:Starting parallel download: chunks 0-663 of 663 InputDocumentFileLocation(id=4981324115240550559, access_hash=7389576518823114674, file_reference=b'\x01\x00\x00\x02\xd3^*\xe3\xe5\xca;oLS\xe7k\xe1i\xae\xf0\xaf#Z_\xd5', thumb_size='')
INFO:tl.paralleltransfer.dc1.conn1:Connecting...
INFO:telethon.network.mtprotosender:Connecting to 149.154.175.51:443/TcpFull...
INFO:telethon.network.mtprotosender:Connection to 149.154.175.51:443/TcpFull complete!
INFO:tl.paralleltransfer.dc1:Exporting auth to DC 1 (main client is in 5)
INFO:aiohttp.access:::1 [24/Jan/2020:12:32:40 +0000] "GET /favicon.ico HTTP/1.1" 404 172 "http://localhost:8080/watch/12423247656120/Little.America.S01E03.WEB-DL.x264-ION10.mp4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like …
Run Code Online (Sandbox Code Playgroud)

python video video-streaming html5-video telethon

5
推荐指数
0
解决办法
4301
查看次数