Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init()
CONST_AMF_GATEWAY_LOCATION = '/tools/amf.php'
CONST_AMF_GATEWAY_PARAM = 'x-country'
CONST_DEFAULT_COUNTRY_CODE = 'en'
CONST_HEADERS = {}
CONST_HEADERS['User-Agent'] = useragents.CHROME
url_re = re.compile(r'(http(s)?://)?(\w{2}.)?(bongacams\.com)/([\w\d_-]+)')
amf_msg_schema = validate.Schema(
{'status': 'success','userData':
{'username': validate.text},'localData':
{'videoServerUrl': validate.text},'performerData':
{'username': validate.text,'displayName': validate.text,'userId': validate.get}})
class bongacams(Plugin):
@classmethod
def can_handle_url(self, url):
return url_re.match(url)
def _get_streams(self):
match = url_re.match(self.url)
stream_page_scheme = 'https'
stream_page_domain = match.group(4)
stream_page_path = match.group(5)
country_code = CONST_DEFAULT_COUNTRY_CODE
# create http session and set headers
http_session = http
class INE(Plugin):
url_re = re.compile(r"""https://streaming.ine.com/play\#?/
([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/?
(.*?)""", re.VERBOSE)
play_url = "https://streaming.ine.com/play/{vid}/watch"
js_re = re.compile(r'''script type="text/javascript" src="(https://content.jwplatform.com/players/.*?)"''')
jwplayer_re = re.compile(r'''jwConfig\s*=\s*(\{.*\});''', re.DOTALL)
setup_schema = validate.Schema(
validate.transform(jwplayer_re.search),
validate.any(
None,
validate.all(
validate.get(1),
validate.transform(json.loads),
{"playlist": validate.text},
validate.get("playlist")
)
)
)
@classmethod
def can_handle_url(cls, url):
return cls.url_re.match(url) is not None
def _get_streams(self):
vid = self.url_re.match(self.url).group(1)
self.logger.debug("Found video ID: {0}", vid)
page = self.session.http.get(self.play_url.format(vid=vid))
js_url_m = self.js_re.search(page.text)
if js_url_m:
help="""
A BTV account password to use with --btv-username.
"""
)
)
url_re = re.compile(r"https?://(?:www\.)?btv\.bg/live/?")
api_url = "http://www.btv.bg/lbin/global/player_config.php"
check_login_url = "http://www.btv.bg/lbin/userRegistration/check_user_login.php"
login_url = "https://www.btv.bg/bin/registration2/login.php?action=login&settings=0"
media_id_re = re.compile(r"media_id=(\d+)")
src_re = re.compile(r"src: \"(http.*?)\"")
api_schema = validate.Schema(
validate.all(
{"status": "ok", "config": validate.text},
validate.get("config"),
validate.all(validate.transform(src_re.search),
validate.any(
None,
validate.get(1), validate.url()
))
)
)
@classmethod
def can_handle_url(cls, url):
return cls.url_re.match(url) is not None
def login(self, username, password):
res = self.session.http.post(self.login_url, data={"username": username, "password": password})
if "success_logged_in" in res.text:
CONST_HEADERS = {}
CONST_HEADERS['User-Agent'] = useragents.CHROME
url_re = re.compile(r"(http(s)?://)?(\w{2}.)?(bongacams\.com)/([\w\d_-]+)")
amf_msg_schema = validate.Schema({
"status": "success",
"userData": {
"username": validate.text
},
"localData": {
"videoServerUrl": validate.text
},
"performerData": {
"username": validate.text,
}
})
class bongacams(Plugin):
@classmethod
def can_handle_url(self, url):
return url_re.match(url)
def _get_streams(self):
match = url_re.match(self.url)
stream_page_scheme = 'https'
stream_page_domain = match.group(4)
stream_page_path = match.group(5)
country_code = CONST_DEFAULT_COUNTRY_CODE
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
class TVRPlus(Plugin):
url_re = re.compile(r"https?://(?:www\.)?tvrplus\.ro/live/")
hls_file_re = re.compile(r"""["'](?P[^"']+\.m3u8(?:[^"']+)?)["']""")
stream_schema = validate.Schema(
validate.all(
validate.transform(hls_file_re.findall),
validate.any(None, [validate.text])
),
)
@classmethod
def can_handle_url(cls, url):
return cls.url_re.match(url) is not None
def _get_streams(self):
headers = {
"User-Agent": useragents.FIREFOX,
"Referer": self.url
}
stream_url = self.stream_schema.validate(self.session.http.get(self.url).text)
if stream_url:
stream_url = list(set(stream_url))
for url in stream_url:
QUALITY_WEIGHTS = {
"original": 1080,
"hd": 720,
"sd": 480
}
_url_re = re.compile(r"https?://play\.afreecatv\.com/(?P\w+)(?:/\d+)?")
_channel_schema = validate.Schema(
{
"CHANNEL": {
"RESULT": validate.transform(int),
validate.optional("BPWD"): validate.text,
validate.optional("BNO"): validate.text,
validate.optional("RMD"): validate.text,
validate.optional("AID"): validate.text,
validate.optional("CDN"): validate.text
}
},
validate.get("CHANNEL")
)
_stream_schema = validate.Schema(
{
validate.optional("view_url"): validate.url(
scheme=validate.any("rtmp", "http")
),
"stream_status": validate.text
}
)
from streamlink.plugin.api import useragents, validate
from streamlink.stream import HLSStream, RTMPStream
from streamlink.utils import parse_json
class Cam4(Plugin):
_url_re = re.compile(r'https?://([a-z]+\.)?cam4.com/.+')
_video_data_re = re.compile(r"flashData: (?P{.*}), hlsUrl: '(?P.+?)'")
_flash_data_schema = validate.Schema(
validate.all(
validate.transform(parse_json),
validate.Schema({
'playerUrl': validate.url(),
'flashVars': validate.Schema({
'videoPlayUrl': validate.text,
'videoAppUrl': validate.url(scheme='rtmp')
})
})
)
)
@classmethod
def can_handle_url(cls, url):
return Cam4._url_re.match(url)
def _get_streams(self):
res = self.session.http.get(self.url, headers={'User-Agent': useragents.ANDROID})
match = self._video_data_re.search(res.text)
if match is None:
return
PLAYER_EMBED_URL = "http://player2.majorleaguegaming.com/api/v2/player/embed/live/?ch={0}"
CHANNEL_API = "https://www.majorleaguegaming.com/api/channel/{0}"
_player_config_re = re.compile(r"var playerConfig = (.+);")
_player_embed_re = re.compile(r"""https?://player2\.majorleaguegaming\.com/api/v2/player/embed/live/\?ch=(?P[^"']+)""")
_site_data_re = re.compile(r"window\.siteData = (?P<data>.+);")
_stream_id_re = re.compile(r"")
_url_re = re.compile(r"http(s)?://(\w+\.)?(majorleaguegaming\.com|mlg\.tv)")
_player_config_schema = validate.Schema(
{
"media": {
"streams": [{
"streamUrl": validate.text,
"abr": validate.text
}]
}
},
validate.get("media", {}),
validate.get("streams")
)
_site_data_schema = validate.Schema(
{
"status_code": 200,
"status_text": "OK",
"data": {
"slug": validate.text,
}
},
validate.get("data", {}),</data>
import random
import re
from streamlink.plugin import Plugin
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[^\"\']+)")
_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
}
)
_access_token_schema = validate.Schema(
{
"token": validate.text,
"sig": validate.text
},
validate.union((
validate.get("sig"),
validate.get("token")
))
)
_token_schema = validate.Schema(
{
"chansub": {
"restricted_bitrates": validate.all(
[validate.text],
validate.filter(
lambda n: not re.match(r"(.+_)?archives|live|chunked", n)
)
)
}
},
validate.get("chansub")
)
_user_schema = validate.Schema(
{
validate.optional("display_name"): validate.text
},
validate.get("display_name")
)
_video_schema = validate.Schema(
{