0

我正在尝试使用 PyQt5、python-vlc 和 pafy 模块在 GUI 应用程序中从 YouTube 流式传输视频,但 vlc 给了我一些连接错误:

[0000025466dc7340] main tls client error: connection error: Interrupted function call
[0000025466df9f00] access stream error: HTTP connection failure
[0000025466dc7430] gnutls tls client error: TLS handshake error: Error in the push function.
[0000025466dc7430] main tls client error: TLS session handshake error
[0000025466dc7430] main tls client error: connection error: Interrupted function call
[0000025466dfa080] access stream error: HTTP connection failure

当我用 tkinter 模块做同样的事情时,它可以正常工作。我该如何解决这些错误?

def OnYT(self):
    text = self.textbox.text()
    url = self.Search(text) #this function returns the first result url from a search on YouTube 
    self.textbox.setText("")
    video = pafy.new(url)
    best = video.getbest()
    self.mediaplayer.set_mrl(best.url)

    if sys.platform.startswith('linux'):
        self.mediaplayer.set_xwindow(self.videoframe.winId())
    elif sys.platform == "win32":
        self.mediaplayer.set_hwnd(self.videoframe.winId())
    elif sys.platform == "darwin":
        self.mediaplayer.set_nsobject(int(self.videoframe.winId()))

    self.mediaplayer.play()
4

1 回答 1

0

有一个解决方法,您可以使用参数将 VLC 配置为使用 http 连接到 URLvlc.Instance("prefer-insecure")

或者您可以尝试使用证书更新和提供 VLC:

 sudo update-ca-certificates --fresh --verbose
 mkdir -p ~/.local/share/vlc/certs/
 cat /usr/share/ca-certificates/mozilla/* | tee ~/.local/share/vlc/certs/ca-certifcates.crt

你可以在这里找到更多信息

GNUtls 选项:

 --gnutls-system-trust, --no-gnutls-system-trust 
                             Use system trust database
                             (default enabled)
      Trust the root certificates of Certificate Authorities stored in the
      operating system trust database to authenticate TLS sessions.
  --gnutls-dir-trust <string> 
                             Trust directory
      Trust directory
  --gnutls-priorities {PERFORMANCE,NORMAL,SECURE128,SECURE256,EXPORT} 
                             TLS cipher priorities
      Ciphers, key exchange methods, hash functions and compression methods
      can be selected. Refer to GNU TLS documentation for detailed syntax.

你可以--gnutls-dir-trus用来指向我认为的 Firefox 证书

于 2019-06-12T11:31:04.480 回答