本文整理匯總了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({})