本文整理汇总了Python中streamlink.plugin.api.validate.any函数的典型用法代码示例。如果您正苦于以下问题:Python any函数的具体用法?Python any怎么用?Python any使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了any函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Pandatv
_param_re = re.compile(r'"param"\s*:\s*"(.+?)"\s*,\s*"time"')
_time_re = re.compile(r'"time"\s*:\s*(\d+)')
_sign_re = re.compile(r'"sign"\s*:\s*"(.+?)"')
_sd_re = re.compile(r'"SD"\s*:\s*"(\d+)"')
_hd_re = re.compile(r'"HD"\s*:\s*"(\d+)"')
_od_re = re.compile(r'"OD"\s*:\s*"(\d+)"')
_room_schema = validate.Schema(
{
"data": validate.any(
validate.text,
dict,
{
"videoinfo": validate.any(
validate.text,
{
"plflag_list": validate.text,
"plflag": validate.text
}
)
}
)
},
validate.get("data"))
class Pandatv(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)
示例2: Periscope
STREAM_INFO_URL = "https://api.periscope.tv/api/v2/getAccessPublic"
STATUS_GONE = 410
STATUS_UNAVAILABLE = (STATUS_GONE,)
_url_re = re.compile(r"http(s)?://(www\.)?(periscope|pscp)\.tv/[^/]+/(?P<broadcast_id>[\w\-\=]+)")
_stream_schema = validate.Schema(
validate.any(
None,
validate.union({
"hls_url": validate.all(
{"hls_url": validate.url(scheme="http")},
validate.get("hls_url")
),
}),
validate.union({
"replay_url": validate.all(
{"replay_url": validate.url(scheme="http")},
validate.get("replay_url")
),
}),
),
)
class Periscope(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)
示例3:
from streamlink.plugin.api.support_plugin import viasat
STREAM_API_URL = "http://playapi.mtgx.tv/v3/videos/stream/{0}"
_embed_url_re = re.compile(
'<meta itemprop="embedURL" content="http://www.viagame.com/embed/video/([^"]+)"'
)
_store_data_re = re.compile("window.fluxData\s*=\s*JSON.parse\(\"(.+)\"\);")
_url_re = re.compile("http(s)?://(www\.)?viagame.com/channels/.+")
_store_schema = validate.Schema(
{
"initialStoresData": [{
"instanceName": validate.text,
"storeName": validate.text,
"initialData": validate.any(dict, list)
}]
},
validate.get("initialStoresData")
)
_match_store_schema = validate.Schema(
{
"match": {
"id": validate.text,
"type": validate.text,
"videos": [{
"id": validate.text,
"play_id": validate.text,
}]
}
},
示例4: Weeb
BLOCK_TYPE_VIEWING_LIMIT = 1
BLOCK_TYPE_NO_SLOTS = 11
_url_re = re.compile(r"http(s)?://(\w+\.)?weeb.tv/(channel|online)/(?P<channel>[^/&?]+)")
_schema = validate.Schema(
dict,
validate.map(lambda k, v: (PARAMS_KEY_MAP.get(k, k), v)),
validate.any(
{
"status": validate.transform(int),
"rtmp": validate.url(scheme="rtmp"),
"playpath": validate.text,
"multibitrate": validate.all(
validate.transform(int),
validate.transform(bool)
),
"block_type": validate.transform(int),
validate.optional("token"): validate.text,
validate.optional("block_time"): validate.text,
validate.optional("reconnect_time"): validate.text,
},
{
"status": validate.transform(int),
},
)
)
class Weeb(Plugin):
@classmethod
def can_handle_url(self, url):
return _url_re.match(url)
示例5:
from streamlink.compat import urljoin
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate
from streamlink.plugin.api.utils import parse_json
from streamlink.stream import AkamaiHDStream, HLSStream
_url_re = re.compile(r"http(s)?://(www\.)?livestream.com/")
_stream_config_schema = validate.Schema({
"event": {
"stream_info": validate.any({
"is_live": bool,
"qualities": [{
"bitrate": int,
"height": int
}],
validate.optional("play_url"): validate.url(scheme="http"),
validate.optional("m3u8_url"): validate.url(
scheme="http",
path=validate.endswith(".m3u8")
),
}, None)
},
validate.optional("playerUri"): validate.text,
validate.optional("viewerPlusSwfUrl"): validate.url(scheme="http"),
validate.optional("lsPlayerSwfUrl"): validate.text,
validate.optional("hdPlayerSwfUrl"): validate.text
})
_smil_schema = validate.Schema(validate.union({
"http_base": validate.all(
validate.xml_find("{http://www.w3.org/2001/SMIL20/Language}head/"
"{http://www.w3.org/2001/SMIL20/Language}meta"
示例6: NRK
"devicetype=desktop&"
"preferred-player-odm=hlslink&"
"preferred-player-live=hlslink"
)
_id_re = re.compile(r"/(?:program|direkte|serie/[^/]+)/([^/]+)")
_url_re = re.compile(r"https?://(tv|radio).nrk.no/")
_api_baseurl_re = re.compile(r'''apiBaseUrl:\s*["'](?P<baseurl>[^"']+)["']''')
_schema = validate.Schema(
validate.transform(_api_baseurl_re.search),
validate.any(
None,
validate.all(
validate.get("baseurl"),
validate.url(
scheme="http"
)
)
)
)
_mediaelement_schema = validate.Schema({
"mediaUrl": validate.url(
scheme="http",
path=validate.endswith(".m3u8")
)
})
class NRK(Plugin):
示例7:
"media_is_live": validate.all(
validate.text,
validate.transform(int),
validate.transform(bool)
),
"media_id": validate.text
}],
},
validate.get("livestream"),
validate.length(1),
validate.get(0)
)
_player_schema = validate.Schema(
{
"clip": {
"baseUrl": validate.any(None, validate.text),
"bitrates": validate.all(
validate.filter(lambda b: b.get("url") and b.get("label")),
[{
"label": validate.text,
"url": validate.text,
}],
)
},
validate.optional("playlist"): [{
validate.optional("connectionProvider"): validate.text,
validate.optional("netConnectionUrl"): validate.text,
validate.optional("bitrates"): [{
"label": validate.text,
"url": validate.text,
"provider": validate.text
示例8: Huya
from streamlink.stream import HLSStream
from streamlink.plugin.api import useragents
from streamlink.utils import update_scheme
HUYA_URL = "http://m.huya.com/%s"
_url_re = re.compile(r'http(s)?://(www\.)?huya.com/(?P<channel>[^/]+)', re.VERBOSE)
_hls_re = re.compile(r'^\s*<video\s+id="html5player-video"\s+src="(?P<url>[^"]+)"', re.MULTILINE)
_hls_schema = validate.Schema(
validate.all(
validate.transform(_hls_re.search),
validate.any(
None,
validate.all(
validate.get('url'),
validate.transform(str)
)
)
)
)
class Huya(Plugin):
@classmethod
def can_handle_url(self, url):
return _url_re.match(url)
def _get_streams(self):
match = _url_re.match(self.url)
channel = match.group("channel")
示例9:
"<embed width=\"486\" height=\"326\" flashvars=\"([^\"]+)\""
)
_live_schema = validate.Schema({
"streams": [{
"name": validate.text,
"quality": validate.text,
"url": validate.url(scheme="rtmp")
}]
})
_schema = validate.Schema(
validate.union({
"export_url": validate.all(
validate.transform(_live_export_re.search),
validate.any(
None,
validate.get(1),
)
),
"video_flashvars": validate.all(
validate.transform(_video_flashvars_re.search),
validate.any(
None,
validate.all(
validate.get(1),
validate.transform(parse_query),
{
"_111pix_serverURL": validate.url(scheme="rtmp"),
"en_flash_providerName": validate.text
}
)
)
示例10:
import random
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api import validate
from streamlink.plugin.api import useragents
from streamlink.stream import HLSStream
_url_re = re.compile(r"http(s)?://(www\.)?camsoda\.com/(?P<username>[^\"\']+)")
_api_user_schema = validate.Schema(
{
"status": validate.any(int, validate.text),
validate.optional("user"): {
"online": validate.any(int, validate.text),
"chatstatus": validate.text,
}
}
)
_api_video_schema = validate.Schema(
{
"token": validate.text,
"app": validate.text,
"edge_servers": [validate.text],
"stream_name": validate.text
}
)
示例11: SeeMePlay
from streamlink.plugin.api import http, validate
from streamlink.stream import HLSStream, HTTPStream
_url_re = re.compile(r"http(s)?://(\w+\.)?seemeplay.ru/")
_player_re = re.compile(r"""
SMP.(channel|video).player.init\({
\s+file:\s+"([^"]+)"
""", re.VERBOSE)
_schema = validate.Schema(
validate.transform(_player_re.search),
validate.any(
None,
validate.union({
"type": validate.get(1),
"url": validate.all(
validate.get(2),
validate.url(scheme="http"),
),
})
)
)
class SeeMePlay(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)
def _get_streams(self):
res = http.get(self.url, schema=_schema)
if not res:
示例12: spec
_room_id_re = re.compile(r'"roomId":(?P<room_id>\d+),')
_room_id_alt_re = re.compile(r'content="showroom:///room\?room_id=(?P<room_id>\d+)"')
_room_id_lookup_failure_log = 'Failed to find room_id for {0} using {1} regex'
_api_status_url = 'https://www.showroom-live.com/room/is_live?room_id={room_id}'
_api_stream_url = 'https://www.showroom-live.com/api/live/streaming_url?room_id={room_id}'
_api_stream_schema = validate.Schema(
validate.any({
"streaming_url_list": validate.all([
{
"url": validate.text,
validate.optional("stream_name"): validate.text,
"id": int,
"label": validate.text,
"is_default": int,
"type": validate.text,
"quality": int,
}
])
},
{}
)
)
# the "low latency" streams are rtmp, the others are hls
_rtmp_quality_lookup = {
"オリジナル画質": "high",
"オリジナル画質(低遅延)": "high",
"original spec(low latency)": "high",
"original spec": "high",
示例13: in
validate.optional("sequenceList"): [{
"layerList": validate.all(
[{
"name": validate.text,
validate.optional("param"): dict
}],
validate.filter(lambda l: l["name"] in ("video", "reporting"))
)
}]
}]
}])
_media_schema = validate.Schema(
validate.any(
_media_inner_schema,
validate.all(
{"sequence": _media_inner_schema},
validate.get("sequence")
)
)
)
_vod_playlist_schema = validate.Schema({
"duration": float,
"fragments": [[int, float]],
"template": validate.text
})
_vod_manifest_schema = validate.Schema({
"alternates": [{
"height": int,
"template": validate.text,
validate.optional("failover"): [validate.text]
}]
示例14: BeatFLVTagConcat
"web_medium": 10,
"web_high": 11,
"web_hd": 12
}
_url_re = re.compile(r"http(s)?://(\w+\.)?be-at.tv/")
_schema = validate.Schema(
validate.any(
None,
{
"status": int,
"media": [{
"duration": validate.any(float, int),
"offset": validate.any(float, int),
"id": int,
"parts": [{
"duration": validate.any(float, int),
"id": int,
"offset": validate.any(float, int),
validate.optional("recording"): int,
validate.optional("start"): validate.any(float, int)
}]
}]
}
)
)
Chunk = namedtuple("Chunk", "recording quality sequence extension")
class BeatFLVTagConcat(FLVTagConcat):
def __init__(self, *args, **kwargs):
示例15: http
)
}
_url_re = re.compile(r"""
http(s)?://(\w+\.)?zdf.de/
""", re.VERBOSE | re.IGNORECASE)
_api_json_re = re.compile(r'''data-zdfplayer-jsb=["'](?P<json>{.+?})["']''', re.S)
_api_schema = validate.Schema(
validate.transform(_api_json_re.search),
validate.any(
None,
validate.all(
validate.get("json"),
validate.transform(parse_json),
{
"content": validate.text,
"apiToken": validate.text
},
)
)
)
_documents_schema = validate.Schema(
{
"mainVideoContent": {
"http://zdf.de/rels/target": {
"http://zdf.de/rels/streams/ptmd": validate.text
},
},
}