本文整理汇总了Python中streamlink.plugin.Plugin类的典型用法代码示例。如果您正苦于以下问题:Python Plugin类的具体用法?Python Plugin怎么用?Python Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Plugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, url):
Plugin.__init__(self, url)
self._headers = {
'Referer': self.url,
'User-Agent': useragents.FIREFOX
}
self._room_id = None
self._stream_urls = None
开发者ID:sheldon0531,项目名称:streamlink,代码行数:8,代码来源:showroom.py
示例2: __init__
def __init__(self, url):
Plugin.__init__(self, url)
live_match = _live_url_re.match(url)
if live_match:
self.live = True
self.channel_path = live_match.group("channel_path")
else:
self.live = False
开发者ID:coder-alpha,项目名称:CcloudTv.bundle,代码行数:9,代码来源:ruv.py
示例3: stream_weight
def stream_weight(cls, stream):
match = re.match("(\w+)_3d", stream)
if match:
weight, group = Plugin.stream_weight(match.group(1))
weight -= 1
group = "youtube_3d"
else:
weight, group = Plugin.stream_weight(stream)
return weight, group
开发者ID:coder-alpha,项目名称:CcloudTv.bundle,代码行数:10,代码来源:youtube.py
示例4: stream_weight
def stream_weight(cls, stream):
match = re.match("mobile_(\w+)", stream)
if match:
weight, group = Plugin.stream_weight(match.group(1))
weight -= 1
group = "mobile_ustream"
elif stream == "recorded":
weight, group = 720, "ustream"
else:
weight, group = Plugin.stream_weight(stream)
return weight, group
开发者ID:coder-alpha,项目名称:CcloudTv.bundle,代码行数:12,代码来源:ustreamtv.py
示例5: __init__
def __init__(self, url):
Plugin.__init__(self, url)
match = _url_re.match(url).groupdict()
self.channel = match.get("channel").lower()
self.subdomain = match.get("subdomain")
self.video_type = match.get("video_type")
self.video_id = match.get("video_id")
parsed = urlparse(url)
self.params = parse_query(parsed.query)
self.api = TwitchAPI(beta=self.subdomain == "beta")
self.usher = UsherService()
开发者ID:coder-alpha,项目名称:CcloudTv.bundle,代码行数:13,代码来源:twitch.py
示例6: stream_weight
def stream_weight(cls, stream):
match_3d = re.match(r"(\w+)_3d", stream)
match_hfr = re.match(r"(\d+p)(\d+)", stream)
if match_3d:
weight, group = Plugin.stream_weight(match_3d.group(1))
weight -= 1
group = "youtube_3d"
elif match_hfr:
weight, group = Plugin.stream_weight(match_hfr.group(1))
weight += 1
group = "high_frame_rate"
else:
weight, group = Plugin.stream_weight(stream)
return weight, group
开发者ID:sheldon0531,项目名称:streamlink,代码行数:15,代码来源:youtube.py
示例7: test_cookie_store_load
def test_cookie_store_load(self):
session = Mock()
session.http.cookies = requests.cookies.RequestsCookieJar()
Plugin.bind(session, 'tests.test_plugin')
Plugin.cache = Mock()
Plugin.cache.get_all.return_value = {
"__cookie:test-name:test.se:80:/": self._create_cookie_dict("test-name", "test-value", None)
}
plugin = Plugin("http://test.se")
self.assertSequenceEqual(
list(map(self._cookie_to_dict, session.http.cookies)),
[self._cookie_to_dict(requests.cookies.create_cookie("test-name", "test-value", domain="test.se"))]
)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:15,代码来源:test_plugin.py
示例8: test_cookie_store_save
def test_cookie_store_save(self):
session = Mock()
session.http.cookies = [
requests.cookies.create_cookie("test-name", "test-value", domain="test.se")
]
Plugin.bind(session, 'tests.test_plugin')
Plugin.cache = Mock()
Plugin.cache.get_all.return_value = {}
plugin = Plugin("http://test.se")
plugin.save_cookies(default_expires=3600)
Plugin.cache.set.assert_called_with("__cookie:test-name:test.se:80:/",
self._create_cookie_dict("test-name", "test-value", None),
3600)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:16,代码来源:test_plugin.py
示例9: stream_weight
def stream_weight(cls, stream):
if stream == "source":
weight = 1080
else:
weight, group = Plugin.stream_weight(stream)
return weight, "azubutv"
开发者ID:coder-alpha,项目名称:CcloudTv.bundle,代码行数:7,代码来源:azubutv.py
示例10: stream_weight
def stream_weight(cls, key):
match_ultra = QUALITY_WEIGHTS_ULTRA.match(key)
if match_ultra:
ultra_level = int(match_ultra.group('level'))
return 1080 * (ultra_level + 1), "bliptv"
weight = QUALITY_WEIGHTS.get(key)
if weight:
return weight, "bliptv"
return Plugin.stream_weight(key)
开发者ID:coder-alpha,项目名称:CcloudTv.bundle,代码行数:9,代码来源:bliptv.py
示例11: test_cookie_store_save_expires
def test_cookie_store_save_expires(self):
with freezegun.freeze_time(datetime.datetime(2018, 1, 1)):
session = Mock()
session.http.cookies = [
requests.cookies.create_cookie("test-name", "test-value", domain="test.se", expires=time.time() + 3600,
rest={'HttpOnly': None})
]
Plugin.bind(session, 'tests.test_plugin')
Plugin.cache = Mock()
Plugin.cache.get_all.return_value = {}
plugin = Plugin("http://test.se")
plugin.save_cookies(default_expires=60)
Plugin.cache.set.assert_called_with("__cookie:test-name:test.se:80:/",
self._create_cookie_dict("test-name", "test-value", 1514768400),
3600)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:18,代码来源:test_plugin.py
示例12: test_cookie_store_clear
def test_cookie_store_clear(self):
session = Mock()
session.http.cookies = requests.cookies.RequestsCookieJar()
Plugin.bind(session, 'tests.test_plugin')
Plugin.cache = Mock()
Plugin.cache.get_all.return_value = {
"__cookie:test-name:test.se:80:/": self._create_cookie_dict("test-name", "test-value", None),
"__cookie:test-name2:test.se:80:/": self._create_cookie_dict("test-name2", "test-value2", None)
}
plugin = Plugin("http://test.se")
# non-empty cookiejar
self.assertTrue(len(session.http.cookies.get_dict()) > 0)
plugin.clear_cookies()
self.assertSequenceEqual(
Plugin.cache.set.mock_calls,
[call("__cookie:test-name:test.se:80:/", None, 0),
call("__cookie:test-name2:test.se:80:/", None, 0)])
self.assertSequenceEqual(session.http.cookies, [])
开发者ID:sheldon0531,项目名称:streamlink,代码行数:22,代码来源:test_plugin.py
示例13: test_cookie_store_clear_filter
def test_cookie_store_clear_filter(self):
session = Mock()
session.http.cookies = requests.cookies.RequestsCookieJar()
Plugin.bind(session, 'tests.test_plugin')
Plugin.cache = Mock()
Plugin.cache.get_all.return_value = {
"__cookie:test-name:test.se:80:/": self._create_cookie_dict("test-name", "test-value", None),
"__cookie:test-name2:test.se:80:/": self._create_cookie_dict("test-name2", "test-value2", None)
}
plugin = Plugin("http://test.se")
# non-empty cookiejar
self.assertTrue(len(session.http.cookies.get_dict()) > 0)
plugin.clear_cookies(lambda c: c.name.endswith("2"))
self.assertSequenceEqual(
Plugin.cache.set.mock_calls,
[call("__cookie:test-name2:test.se:80:/", None, 0)])
self.assertSequenceEqual(
list(map(self._cookie_to_dict, session.http.cookies)),
[self._cookie_to_dict(requests.cookies.create_cookie("test-name", "test-value", domain="test.se"))]
)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:24,代码来源:test_plugin.py
示例14: stream_weight
def stream_weight(cls, key):
weight = QUALITY_WEIGHTS.get(key)
if weight:
return weight, "zdf_mediathek"
return Plugin.stream_weight(key)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:6,代码来源:zdf_mediathek.py
示例15: __init__
def __init__(self, url):
Plugin.__init__(self, url)
self.session.http.headers = {"User-Agent": useragents.SAFARI_8}
self.zclient = ZTNRClient(self.secret_key, self.session)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:4,代码来源:rtve.py
示例16: stream_weight
def stream_weight(cls, stream):
if stream in STREAM_WEIGHTS:
return STREAM_WEIGHTS[stream], "douyutv"
return Plugin.stream_weight(stream)
开发者ID:coder-alpha,项目名称:CcloudTv.bundle,代码行数:5,代码来源:douyutv.py
示例17: stream_weight
def stream_weight(cls, stream):
if stream in cls.STREAM_WEIGHTS:
return cls.STREAM_WEIGHTS[stream], "ustreamtv"
return Plugin.stream_weight(stream)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:4,代码来源:ustreamtv.py
示例18: stream_weight
def stream_weight(cls, key):
weight = QUALITY_MAP.get(key)
if weight:
return weight, "beat"
return Plugin.stream_weight(key)
开发者ID:amadu80,项目名称:repository.xvbmc,代码行数:6,代码来源:beattv.py
示例19: stream_weight
def stream_weight(cls, key):
weight = cls.quality_weights.get(key)
if weight:
return weight, "filmon"
return Plugin.stream_weight(key)
开发者ID:sheldon0531,项目名称:streamlink,代码行数:6,代码来源:filmon.py
示例20: stream_weight
def stream_weight(cls, key):
weight = STREAM_WEIGHTS.get(key)
if weight:
return weight, "crunchyroll"
return Plugin.stream_weight(key)
开发者ID:amadu80,项目名称:repository.xvbmc,代码行数:6,代码来源:crunchyroll.py
注:本文中的streamlink.plugin.Plugin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论