本文整理汇总了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)
示例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)
示例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)