当前位置: 首页>>代码示例>>Python>>正文


Python YoutubeIE._parse_sig_swf方法代码示例

本文整理汇总了Python中youtube_dl.extractor.YoutubeIE._parse_sig_swf方法的典型用法代码示例。如果您正苦于以下问题:Python YoutubeIE._parse_sig_swf方法的具体用法?Python YoutubeIE._parse_sig_swf怎么用?Python YoutubeIE._parse_sig_swf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在youtube_dl.extractor.YoutubeIE的用法示例。


在下文中一共展示了YoutubeIE._parse_sig_swf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_func

# 需要导入模块: from youtube_dl.extractor import YoutubeIE [as 别名]
# 或者: from youtube_dl.extractor.YoutubeIE import _parse_sig_swf [as 别名]
    def test_func(self):
        fn = os.path.join(self.TESTDATA_DIR, basename)

        if not os.path.exists(fn):
            compat_urlretrieve(url, fn)

        ie = YoutubeIE()
        if stype == 'js':
            with io.open(fn, encoding='utf-8') as testf:
                jscode = testf.read()
            func = ie._parse_sig_js(jscode)
        else:
            assert stype == 'swf'
            with open(fn, 'rb') as testf:
                swfcode = testf.read()
            func = ie._parse_sig_swf(swfcode)
        src_sig = compat_str(string.printable[:sig_length])
        got_sig = func(src_sig)
        self.assertEqual(got_sig, expected_sig)
开发者ID:Erreur32,项目名称:youtube-dl,代码行数:21,代码来源:test_youtube_signature.py

示例2: test_func

# 需要导入模块: from youtube_dl.extractor import YoutubeIE [as 别名]
# 或者: from youtube_dl.extractor.YoutubeIE import _parse_sig_swf [as 别名]
    def test_func(self):
        fn = os.path.join(self.TESTDATA_DIR, basename)

        if not os.path.exists(fn):
            compat_urlretrieve(url, fn)

        ie = YoutubeIE()
        if stype == "js":
            with io.open(fn, encoding="utf-8") as testf:
                jscode = testf.read()
            func = ie._parse_sig_js(jscode)
        else:
            assert stype == "swf"
            with open(fn, "rb") as testf:
                swfcode = testf.read()
            func = ie._parse_sig_swf(swfcode)
        src_sig = compat_str(string.printable[:sig_input]) if isinstance(sig_input, int) else sig_input
        got_sig = func(src_sig)
        self.assertEqual(got_sig, expected_sig)
开发者ID:0m15,项目名称:youtube-dl,代码行数:21,代码来源:test_youtube_signature.py

示例3: test_func

# 需要导入模块: from youtube_dl.extractor import YoutubeIE [as 别名]
# 或者: from youtube_dl.extractor.YoutubeIE import _parse_sig_swf [as 别名]
    def test_func(self):
        basename = 'player-%s.%s' % (test_id, stype)
        fn = os.path.join(self.TESTDATA_DIR, basename)

        if not os.path.exists(fn):
            compat_urlretrieve(url, fn)

        ie = YoutubeIE()
        if stype == 'js':
            with io.open(fn, encoding='utf-8') as testf:
                jscode = testf.read()
            func = ie._parse_sig_js(jscode)
        else:
            assert stype == 'swf'
            with open(fn, 'rb') as testf:
                swfcode = testf.read()
            func = ie._parse_sig_swf(swfcode)
        src_sig = (
            compat_str(string.printable[:sig_input])
            if isinstance(sig_input, int) else sig_input)
        got_sig = func(src_sig)
        self.assertEqual(got_sig, expected_sig)
开发者ID:creationst,项目名称:youtube-dl,代码行数:24,代码来源:test_youtube_signature.py


注:本文中的youtube_dl.extractor.YoutubeIE._parse_sig_swf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。