videoplayer.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:plugin.video.unofficial9anime 作者: Prometheusx-git 项目源码 文件源码
def play(self):
        if self.link == '':
            return

        import urlresolver

        ''' 
            Kodi v17 updated to Python 2.7.10 from 2.7.5 in v16, which introduced this error when 
            trying to resolve the url:
            http://stackoverflow.com/questions/27835619/ssl-certificate-verify-failed-error

            In Kodi v16, python would not verify the SSL certs or at least ignore, but they changed
            with the upgrade to v17.  Sometimes the cert from the initial decrypted URL is invalid,
            so to avoid errors, we temporarily disable SSL to get the resolved URL.  Although this
            workaround isn't secure, I figure it's not any worse than before...
        '''
        try:
            url = urlresolver.resolve(self.link)
        except:
            helper.log_debug('Attempt to resolve URL failed; trying again with SSL temporarily disabled (v16 behavior)')
            import ssl
            default_context = ssl._create_default_https_context # save default context
            ssl._create_default_https_context = ssl._create_unverified_context
            url = urlresolver.resolve(self.link)
            ssl._create_default_https_context = default_context # restore default context

        helper.log_debug("UrlResolver's resolved link: %s" % url)
        helper.resolve_url(url)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号