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


Python YouTubePlayer.extractVideoLinksFromYoutube方法代码示例

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


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

示例1: test_buildVideoLinks_should_try_scraping_first

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test_buildVideoLinks_should_try_scraping_first(self):
        sys.modules["__main__"].core._fetchPage.return_value = {"status":303, "content": ""}
        sys.modules["__main__"].common.parseDOM.return_value = []

        player = YouTubePlayer()
        player.extractVideoLinksFromYoutube({},{"videoid":"123"})

        sys.modules["__main__"].core._fetchPage.assert_any_call({"link":player.urls["video_stream"] % "123", "login":"true"})
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:10,代码来源:TestYouTubePlayer.py

示例2: test__getVideoLinks_should_return_empty_dictionary_on_missing_map

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test__getVideoLinks_should_return_empty_dictionary_on_missing_map(self):
        sys.modules["__main__"].core._fetchPage.return_value = {"status":303, "content": ""}
        sys.modules["__main__"].common.parseDOM.return_value = []

        player = YouTubePlayer()
        (result, status) = player.extractVideoLinksFromYoutube({},{"videoid":"123"})

        assert (result == {})
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:10,代码来源:TestYouTubePlayer.py

示例3: test_getVideoLinks_should_parse_live_video_structure_on_webpage_correctly

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test_getVideoLinks_should_parse_live_video_structure_on_webpage_correctly(self):
        sys.modules["__main__"].core._fetchPage.return_value = {"status": 200, "content": self.readTestInput("live-video-page-e93MaEwrsfc.html", False)}
        sys.modules["__main__"].common.parseDOM.return_value = []
        player = YouTubePlayer()
        sys.modules["__main__"].core._findErrors.return_value = "mock error"

        result = player.extractVideoLinksFromYoutube({}, {"videoid": "some_id"})

        print repr(result)

        assert(result[0].has_key(35))
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:13,代码来源:TestYouTubePlayer.py

示例4: test_buildVideoObject_should_get_video_information_from_getInfo

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test_buildVideoObject_should_get_video_information_from_getInfo(self):
        sys.modules["__main__"].settings.getSetting.return_value = ""
        player = YouTubePlayer()
        player.getInfo = Mock()
        player.getInfo.return_value = ({}, 303)
        player.extractVideoLinksFromYoutube = Mock()
        player.extractVideoLinksFromYoutube.return_value = ({}, {})

        player.buildVideoObject({})

        player.getInfo.assert_called_with({})
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:13,代码来源:TestYouTubePlayer.py

示例5: test_buildVideoObject_should_use_pre_defined_error_messages_on_missing_url

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test_buildVideoObject_should_use_pre_defined_error_messages_on_missing_url(self):
        sys.modules["__main__"].settings.getSetting.return_value = ""
        player = YouTubePlayer()
        player.getInfo = Mock()
        player.getInfo.return_value = ({}, 303)
        player.getLocalFileSource = Mock(return_value="")
        player.extractVideoLinksFromYoutube = Mock(return_value = ({}, {}))

        player.buildVideoObject({})

        player.getInfo.assert_called_with({})
        sys.modules["__main__"].language.assert_called_with(30618)
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:14,代码来源:TestYouTubePlayer.py

示例6: test_buildVideoObject_should_not_scrape_webpage_if_local_file_is_found

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test_buildVideoObject_should_not_scrape_webpage_if_local_file_is_found(self):
        sys.modules["__main__"].subtitles.getLocalFileSource.return_value = "somePath/someTitle.mp4"
        params = {"videoid": "some_id"}
        player = YouTubePlayer()
        player.getInfo = Mock()
        player.extractVideoLinksFromYoutube = Mock()
        video = {"videoid": "some_id", "Title": "someTitle"}
        player.getInfo.return_value = (video, 200)

        player.buildVideoObject(params)

        assert(player.extractVideoLinksFromYoutube.call_count == 0)
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:14,代码来源:TestYouTubePlayer.py

示例7: test_buildVideoObject_should_call_getVideoLinks_if_local_file_not_found

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test_buildVideoObject_should_call_getVideoLinks_if_local_file_not_found(self):
        sys.modules["__main__"].subtitles.getLocalFileSource.return_value = ""
        sys.modules["__main__"].settings.getSetting.return_value = "1"
        params = {"videoid": "some_id"}
        player = YouTubePlayer()
        player.getInfo = Mock()
        player.extractVideoLinksFromYoutube = Mock()
        player.extractVideoLinksFromYoutube.return_value = ({}, {})
        video = {"videoid": "some_id", "Title": "someTitle"}
        player.getInfo.return_value = (video, 200)

        player.buildVideoObject(params)

        player.extractVideoLinksFromYoutube.assert_any_call(video, params)
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:16,代码来源:TestYouTubePlayer.py

示例8: test_buildVideoObject_should_call_selectVideoQuality_if_local_file_not_found_and_remote_links_found

# 需要导入模块: from YouTubePlayer import YouTubePlayer [as 别名]
# 或者: from YouTubePlayer.YouTubePlayer import extractVideoLinksFromYoutube [as 别名]
    def test_buildVideoObject_should_call_selectVideoQuality_if_local_file_not_found_and_remote_links_found(self):
        sys.modules["__main__"].subtitles.getLocalFileSource.return_value = ""
        params = {"videoid": "some_id"}
        video = {"videoid": "some_id", "Title": "someTitle"}

        player = YouTubePlayer()
        player.getInfo = Mock()
        player.getInfo.return_value = (video, 200)

        player.extractVideoLinksFromYoutube = Mock()
        player.extractVideoLinksFromYoutube.return_value = ({22: "720p"}, {})
        player.selectVideoQuality = Mock()

        player.buildVideoObject(params)

        player.selectVideoQuality.assert_called_with(params,{22: "720p"})
开发者ID:BlackSmith,项目名称:youtube-xbmc-plugin,代码行数:18,代码来源:TestYouTubePlayer.py


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