本文整理汇总了Python中streamlink.plugin.api.validate.url函数的典型用法代码示例。如果您正苦于以下问题:Python url函数的具体用法?Python url怎么用?Python url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SeeMePlay
_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:
return
示例2: Skai
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
_url_re = re.compile(r'http(s)?://www\.skai(?:tv)?.gr/.*')
_api_url = "http://www.skaitv.gr/json/live.php"
_api_res_schema = validate.Schema(validate.all(
validate.get("now"),
{
"livestream": validate.url()
},
validate.get("livestream"))
)
class Skai(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)
def _get_streams(self):
api_res = self.session.http.get(_api_url)
yt_url = self.session.http.json(api_res, schema=_api_res_schema)
if yt_url:
return self.session.streams(yt_url)
__plugin__ = Skai
示例3:
(?:
/live/[^/]+
)?
(?:
/video/\d+/[^/]+
)?
""", re.VERBOSE)
_file_re = re.compile("\"?file\"?:\s+['\"]([^'\"]+)['\"]")
_swf_url_re = re.compile("swfobject.embedSWF\(\"([^\"]+)\",")
_schema = validate.Schema(
validate.union({
"urls": validate.all(
validate.transform(_file_re.findall),
validate.map(unquote),
[validate.url()]
),
"swf": validate.all(
validate.transform(_swf_url_re.search),
validate.any(
None,
validate.all(
validate.get(1),
validate.url(
scheme="http",
path=validate.endswith("swf")
)
)
)
)
})
示例4: http
from streamlink.plugin.api import http, validate
from streamlink.stream import FLVPlaylist, HTTPStream
API_URL = "http://veetle.com/index.php/stream/ajaxStreamLocation/{0}/flash"
_url_re = re.compile("""
http(s)?://(\w+\.)?veetle.com
(:?
/.*(v|view)/
(?P<channel>[^/]+/[^/&?]+)
)?
""", re.VERBOSE)
_schema = validate.Schema({
validate.optional("isLive"): bool,
"payload": validate.any(int, validate.url(scheme="http")),
"success": bool
})
class Veetle(Plugin):
@classmethod
def can_handle_url(self, url):
return _url_re.match(url)
def _get_streams(self):
self.url = http.resolve_url(self.url)
match = _url_re.match(self.url)
parsed = urlparse(self.url)
if parsed.fragment:
channel_id = parsed.fragment
示例5: Livestation
_csrf_token_re = re.compile("<meta content=\"([^\"]+)\" name=\"csrf-token\"")
_hls_playlist_re = re.compile("<meta content=\"([^\"]+.m3u8)\" property=\"og:video\" />")
_url_re = re.compile("http(s)?://(\w+\.)?livestation.com")
_csrf_token_schema = validate.Schema(
validate.transform(_csrf_token_re.search),
validate.any(None, validate.get(1))
)
_hls_playlist_schema = validate.Schema(
validate.transform(_hls_playlist_re.search),
validate.any(
None,
validate.all(
validate.get(1),
validate.url(scheme="http", path=validate.endswith(".m3u8"))
)
)
)
_login_schema = validate.Schema({
"email": validate.text,
validate.optional("errors"): validate.all(
{
"base": [validate.text]
},
validate.get("base"),
)
})
class Livestation(Plugin):
示例6:
}
BLOCKED_MSG_FORMAT = (
"You have crossed the free viewing limit. You have been blocked for "
"{0} minutes. Try again in {1} minutes"
)
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),
},
)
)
示例7: http
"360": 1,
"low": 1
}
_url_re = re.compile("""
http(s)?://(\w+\.)?gaminglive\.tv
/(?P<type>channels|videos)/(?P<name>[^/]+)
""", re.VERBOSE)
_quality_re = re.compile("[^/]+-(?P<quality>[^/]+)")
_channel_schema = validate.Schema(
{
validate.optional("state"): {
"stream": {
"qualities": [validate.text],
"rootUrl": validate.url(scheme="rtmp")
}
}
},
validate.get("state")
)
_vod_schema = validate.Schema(
{
"name": validate.text,
"channel_slug": validate.text,
"title": validate.text,
"created_at": validate.transform(int)
},
)
示例8: Bambuser
from streamlink.plugin.api import http, validate
from streamlink.stream import HTTPStream, RTMPStream
API_CLIENT_NAME = "Bambuser AS2"
API_CONTEXT = "b_broadcastpage"
API_KEY = "005f64509e19a868399060af746a00aa"
API_URL_VIDEO = "http://player-c.api.bambuser.com/getVideo.json"
_url_re = re.compile("http(s)?://(\w+.)?bambuser.com/v/(?P<video_id>\d+)")
_video_schema = validate.Schema({
validate.optional("error"): validate.text,
validate.optional("result"): {
"id": validate.text,
"size": validate.text,
"url": validate.url(
scheme=validate.any("rtmp", "http")
)
}
})
class Bambuser(Plugin):
@classmethod
def can_handle_url(self, url):
return _url_re.match(url)
def _get_streams(self):
match = _url_re.match(self.url)
video_id = match.group("video_id")
params = {
"client_name": API_CLIENT_NAME,
示例9:
_url_re = re.compile(
r'http(s)?://([^.]*.)?ceskatelevize.cz'
)
_player_re = re.compile(
r'ivysilani/embed/iFramePlayer[^"]+'
)
_hash_re = re.compile(
r'hash:"([0-9a-z]+)"'
)
_playlist_info_re = re.compile(
r'{"type":"([a-z]+)","id":"([0-9]+)"'
)
_playlist_url_schema = validate.Schema({
validate.optional("streamingProtocol"): validate.text,
"url": validate.any(
validate.url(),
"Error",
"error_region"
)
})
_playlist_schema = validate.Schema({
"playlist": [{
validate.optional("type"): validate.text,
"streamUrls": {
"main": validate.url(),
}
}]
})
log = logging.getLogger(__name__)
示例10:
}
},
validate.get("chansub")
)
_user_schema = validate.Schema(
{
validate.optional("display_name"): validate.text
},
validate.get("display_name")
)
_video_schema = validate.Schema(
{
"chunks": {
validate.text: [{
"length": int,
"url": validate.any(None, validate.url(scheme="http")),
"upkeep": validate.any("pass", "fail", None)
}]
},
"restrictions": {validate.text: validate.text},
"start_offset": int,
"end_offset": int,
}
)
_viewer_info_schema = validate.Schema(
{
validate.optional("login"): validate.text
},
validate.get("login")
)
_viewer_token_schema = validate.Schema(
示例11:
"channel" : validate.any(None, {
"id" : validate.all(
validate.text,
validate.transform(int)
),
"vid" : int
})
})
},
validate.get("data")
)
_plu_schema = validate.Schema(
{
"urls": [{
"securityUrl": validate.url(scheme=validate.any("rtmp", "http")),
"resolution": validate.text,
"ext": validate.text
}]
}
)
_qq_schema = validate.Schema(
{
validate.optional("playurl"): validate.url(scheme="http")
},
validate.get("playurl")
)
STREAM_WEIGHTS = {
"middle": 540,
示例12:
"<iframe src=\"(https://www.filmon.com/channel/export[^\"]+)\""
)
_live_json_re = re.compile("var startupChannel = (.+);")
_replay_json_re = re.compile("var standByVideo = encodeURIComponent\('(.+)'\);")
_history_re = re.compile(
"helpers.common.flash.flashplayerinstall\({url:'([^']+)',"
)
_video_flashvars_re = re.compile(
"<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,
示例13:
from streamlink.plugin import Plugin, PluginError
from streamlink.plugin.api import http, validate
from streamlink.stream import RTMPStream, HLSStream
SWF_URL = "http://play.streamingvideoprovider.com/player2.swf"
API_URL = "http://player.webvideocore.net/index.php"
_url_re = re.compile(
r"http(s)?://(\w+\.)?streamingvideoprovider.co.uk/(?P<channel>[^/&?]+)"
)
_hls_re = re.compile(r"'(http://.+\.m3u8)'")
_rtmp_schema = validate.Schema(
validate.xml_findtext("./info/url"),
validate.url(scheme="rtmp")
)
_hls_schema = validate.Schema(
validate.transform(_hls_re.search),
validate.any(
None,
validate.all(
validate.get(1),
validate.url(
scheme="http",
path=validate.endswith("m3u8")
)
)
)
)
示例14: NRK
"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):
@classmethod
示例15:
from streamlink.plugin.api import http, validate
from streamlink.stream import RTMPStream, HLSStream
RUURL = "b=chrome&p=win&v=56&f=0&d=1"
_url_re = re.compile(r"https?://www.rtvs.sk/televizia/live-[\w-]+")
_playlist_url_re = re.compile(r'"playlist": "([^"]+)"')
_playlist_schema = validate.Schema(
[
{
"sources": [
validate.any(
{
"type": "dash",
"file": validate.url(scheme="http")
}, {
"type": "hls",
"file": validate.url(scheme="http")
}, {
"type": "rtmp",
"file": validate.text,
"streamer": validate.url(scheme="rtmp")
}
)
]
}
],
validate.get(0),
validate.get("sources")
)