本文整理汇总了Python中YouTubeSubtitleControl.YouTubeSubtitleControl.getTranscriptionUrl方法的典型用法代码示例。如果您正苦于以下问题:Python YouTubeSubtitleControl.getTranscriptionUrl方法的具体用法?Python YouTubeSubtitleControl.getTranscriptionUrl怎么用?Python YouTubeSubtitleControl.getTranscriptionUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YouTubeSubtitleControl.YouTubeSubtitleControl
的用法示例。
在下文中一共展示了YouTubeSubtitleControl.getTranscriptionUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getTranscriptionUrl_should_call_return_correct_url
# 需要导入模块: from YouTubeSubtitleControl import YouTubeSubtitleControl [as 别名]
# 或者: from YouTubeSubtitleControl.YouTubeSubtitleControl import getTranscriptionUrl [as 别名]
def test_getTranscriptionUrl_should_call_return_correct_url(self):
player = YouTubeSubtitleControl()
sys.modules["__main__"].core._fetchPage = Mock()
sys.modules["__main__"].core._fetchPage.return_value = {"status": 303, "content": ""}
sys.modules["__main__"].settings.getSetting = Mock()
sys.modules["__main__"].settings.getSetting.return_value = "1"
ret = player.getTranscriptionUrl({"videoid": "some_id", "ttsurl": "http://some.url/transcript"})
print ret
assert(ret == "http://some.url/transcript&type=trackformat=1&lang=en&kind=asr&name=&v=some_id&tlang=en")
示例2: test_downloadSubtitle_should_call_getTranscriptionUrl
# 需要导入模块: from YouTubeSubtitleControl import YouTubeSubtitleControl [as 别名]
# 或者: from YouTubeSubtitleControl.YouTubeSubtitleControl import getTranscriptionUrl [as 别名]
def test_downloadSubtitle_should_call_getTranscriptionUrl(self):
player = YouTubeSubtitleControl()
sys.modules["__main__"].core._fetchPage = Mock()
sys.modules["__main__"].core._fetchPage.return_value = {"status": 200, "content": "nothingness"}
subtitlesettings = ["true", "2", "true"]
sys.modules["__main__"].settings.getSetting = Mock()
sys.modules["__main__"].settings.getSetting.side_effect = lambda x: subtitlesettings.pop()
player.transformAnnotationToSSA = Mock()
player.transformAnnotationToSSA.return_value = ("", "style")
player.getSubtitleUrl = Mock()
player.getSubtitleUrl.return_value = ""
player.getTranscriptionUrl = Mock()
player.getTranscriptionUrl.return_value = ""
player.downloadSubtitle()
player.getTranscriptionUrl.assert_called_with({})