partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | SegmentedStreamWriter.queue | Puts a value into a queue but aborts if this thread is closed. | src/streamlink/stream/segmented.py | def queue(self, queue_, value):
"""Puts a value into a queue but aborts if this thread is closed."""
while not self.closed:
try:
queue_.put(value, block=True, timeout=1)
return
except queue.Full:
continue | def queue(self, queue_, value):
"""Puts a value into a queue but aborts if this thread is closed."""
while not self.closed:
try:
queue_.put(value, block=True, timeout=1)
return
except queue.Full:
continue | [
"Puts",
"a",
"value",
"into",
"a",
"queue",
"but",
"aborts",
"if",
"this",
"thread",
"is",
"closed",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/segmented.py#L124-L131 | [
"def",
"queue",
"(",
"self",
",",
"queue_",
",",
"value",
")",
":",
"while",
"not",
"self",
".",
"closed",
":",
"try",
":",
"queue_",
".",
"put",
"(",
"value",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"1",
")",
"return",
"except",
"queue",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HDSStream.parse_manifest | Parses a HDS manifest and returns its substreams.
:param url: The URL to the manifest.
:param timeout: How long to wait for data to be returned from
from the stream before raising an error.
:param is_akamai: force adding of the akamai parameters
:param pvswf: URL... | src/streamlink/stream/hds.py | def parse_manifest(cls, session, url, timeout=60, pvswf=None, is_akamai=False,
**request_params):
"""Parses a HDS manifest and returns its substreams.
:param url: The URL to the manifest.
:param timeout: How long to wait for data to be returned from
... | def parse_manifest(cls, session, url, timeout=60, pvswf=None, is_akamai=False,
**request_params):
"""Parses a HDS manifest and returns its substreams.
:param url: The URL to the manifest.
:param timeout: How long to wait for data to be returned from
... | [
"Parses",
"a",
"HDS",
"manifest",
"and",
"returns",
"its",
"substreams",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/hds.py#L428-L566 | [
"def",
"parse_manifest",
"(",
"cls",
",",
"session",
",",
"url",
",",
"timeout",
"=",
"60",
",",
"pvswf",
"=",
"None",
",",
"is_akamai",
"=",
"False",
",",
"*",
"*",
"request_params",
")",
":",
"# private argument, should only be used in recursive calls",
"raise... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HDSStream._pv_params | Returns any parameters needed for Akamai HD player verification.
Algorithm originally documented by KSV, source:
http://stream-recorder.com/forum/showpost.php?p=43761&postcount=13 | src/streamlink/stream/hds.py | def _pv_params(cls, session, pvswf, pv, **request_params):
"""Returns any parameters needed for Akamai HD player verification.
Algorithm originally documented by KSV, source:
http://stream-recorder.com/forum/showpost.php?p=43761&postcount=13
"""
try:
data, hdntl = p... | def _pv_params(cls, session, pvswf, pv, **request_params):
"""Returns any parameters needed for Akamai HD player verification.
Algorithm originally documented by KSV, source:
http://stream-recorder.com/forum/showpost.php?p=43761&postcount=13
"""
try:
data, hdntl = p... | [
"Returns",
"any",
"parameters",
"needed",
"for",
"Akamai",
"HD",
"player",
"verification",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/hds.py#L569-L616 | [
"def",
"_pv_params",
"(",
"cls",
",",
"session",
",",
"pvswf",
",",
"pv",
",",
"*",
"*",
"request_params",
")",
":",
"try",
":",
"data",
",",
"hdntl",
"=",
"pv",
".",
"split",
"(",
"\";\"",
")",
"except",
"ValueError",
":",
"data",
"=",
"pv",
"hdnt... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | BBCiPlayer._extract_nonce | Given an HTTP response from the sessino endpoint, extract the nonce, so we can "sign" requests with it.
We don't really sign the requests in the traditional sense of a nonce, we just incude them in the auth requests.
:param http_result: HTTP response from the bbc session endpoint.
:type http_re... | src/streamlink/plugins/bbciplayer.py | def _extract_nonce(cls, http_result):
"""
Given an HTTP response from the sessino endpoint, extract the nonce, so we can "sign" requests with it.
We don't really sign the requests in the traditional sense of a nonce, we just incude them in the auth requests.
:param http_result: HTTP res... | def _extract_nonce(cls, http_result):
"""
Given an HTTP response from the sessino endpoint, extract the nonce, so we can "sign" requests with it.
We don't really sign the requests in the traditional sense of a nonce, we just incude them in the auth requests.
:param http_result: HTTP res... | [
"Given",
"an",
"HTTP",
"response",
"from",
"the",
"sessino",
"endpoint",
"extract",
"the",
"nonce",
"so",
"we",
"can",
"sign",
"requests",
"with",
"it",
".",
"We",
"don",
"t",
"really",
"sign",
"the",
"requests",
"in",
"the",
"traditional",
"sense",
"of",
... | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/bbciplayer.py#L100-L120 | [
"def",
"_extract_nonce",
"(",
"cls",
",",
"http_result",
")",
":",
"# Extract the redirect URL from the last call",
"last_redirect_url",
"=",
"urlparse",
"(",
"http_result",
".",
"history",
"[",
"-",
"1",
"]",
".",
"request",
".",
"url",
")",
"last_redirect_query",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | BBCiPlayer.find_vpid | Find the Video Packet ID in the HTML for the provided URL
:param url: URL to download, if res is not provided.
:param res: Provide a cached version of the HTTP response to search
:type url: string
:type res: requests.Response
:return: Video Packet ID for a Programme in iPlayer
... | src/streamlink/plugins/bbciplayer.py | def find_vpid(self, url, res=None):
"""
Find the Video Packet ID in the HTML for the provided URL
:param url: URL to download, if res is not provided.
:param res: Provide a cached version of the HTTP response to search
:type url: string
:type res: requests.Response
... | def find_vpid(self, url, res=None):
"""
Find the Video Packet ID in the HTML for the provided URL
:param url: URL to download, if res is not provided.
:param res: Provide a cached version of the HTTP response to search
:type url: string
:type res: requests.Response
... | [
"Find",
"the",
"Video",
"Packet",
"ID",
"in",
"the",
"HTML",
"for",
"the",
"provided",
"URL"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/bbciplayer.py#L122-L138 | [
"def",
"find_vpid",
"(",
"self",
",",
"url",
",",
"res",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"Looking for vpid on {0}\"",
",",
"url",
")",
"# Use pre-fetched page if available",
"res",
"=",
"res",
"or",
"self",
".",
"session",
".",
"http",
"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | BBCiPlayer.login | Create session using BBC ID. See https://www.bbc.co.uk/usingthebbc/account/
:param ptrt_url: The snapback URL to redirect to after successful authentication
:type ptrt_url: string
:return: Whether authentication was successful
:rtype: bool | src/streamlink/plugins/bbciplayer.py | def login(self, ptrt_url):
"""
Create session using BBC ID. See https://www.bbc.co.uk/usingthebbc/account/
:param ptrt_url: The snapback URL to redirect to after successful authentication
:type ptrt_url: string
:return: Whether authentication was successful
:rtype: bool
... | def login(self, ptrt_url):
"""
Create session using BBC ID. See https://www.bbc.co.uk/usingthebbc/account/
:param ptrt_url: The snapback URL to redirect to after successful authentication
:type ptrt_url: string
:return: Whether authentication was successful
:rtype: bool
... | [
"Create",
"session",
"using",
"BBC",
"ID",
".",
"See",
"https",
":",
"//",
"www",
".",
"bbc",
".",
"co",
".",
"uk",
"/",
"usingthebbc",
"/",
"account",
"/"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/bbciplayer.py#L180-L217 | [
"def",
"login",
"(",
"self",
",",
"ptrt_url",
")",
":",
"def",
"auth_check",
"(",
"res",
")",
":",
"return",
"ptrt_url",
"in",
"(",
"[",
"h",
".",
"url",
"for",
"h",
"in",
"res",
".",
"history",
"]",
"+",
"[",
"res",
".",
"url",
"]",
")",
"# ma... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | pkcs7_decode | Remove the PKCS#7 padding | src/streamlink/stream/hls.py | def pkcs7_decode(paddedData, keySize=16):
'''
Remove the PKCS#7 padding
'''
# Use ord + [-1:] to support both python 2 and 3
val = ord(paddedData[-1:])
if val > keySize:
raise StreamError("Input is not padded or padding is corrupt, got padding size of {0}".format(val))
return padded... | def pkcs7_decode(paddedData, keySize=16):
'''
Remove the PKCS#7 padding
'''
# Use ord + [-1:] to support both python 2 and 3
val = ord(paddedData[-1:])
if val > keySize:
raise StreamError("Input is not padded or padding is corrupt, got padding size of {0}".format(val))
return padded... | [
"Remove",
"the",
"PKCS#7",
"padding"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/hls.py#L24-L33 | [
"def",
"pkcs7_decode",
"(",
"paddedData",
",",
"keySize",
"=",
"16",
")",
":",
"# Use ord + [-1:] to support both python 2 and 3",
"val",
"=",
"ord",
"(",
"paddedData",
"[",
"-",
"1",
":",
"]",
")",
"if",
"val",
">",
"keySize",
":",
"raise",
"StreamError",
"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HLSStream.parse_variant_playlist | Attempts to parse a variant playlist and return its streams.
:param url: The URL of the variant playlist.
:param name_key: Prefer to use this key as stream name, valid keys are:
name, pixels, bitrate.
:param name_prefix: Add this prefix to the stream names.
:par... | src/streamlink/stream/hls.py | def parse_variant_playlist(cls, session_, url, name_key="name",
name_prefix="", check_streams=False,
force_restart=False, name_fmt=None,
start_offset=0, duration=None,
**request_params):
"... | def parse_variant_playlist(cls, session_, url, name_key="name",
name_prefix="", check_streams=False,
force_restart=False, name_fmt=None,
start_offset=0, duration=None,
**request_params):
"... | [
"Attempts",
"to",
"parse",
"a",
"variant",
"playlist",
"and",
"return",
"its",
"streams",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/hls.py#L358-L486 | [
"def",
"parse_variant_playlist",
"(",
"cls",
",",
"session_",
",",
"url",
",",
"name_key",
"=",
"\"name\"",
",",
"name_prefix",
"=",
"\"\"",
",",
"check_streams",
"=",
"False",
",",
"force_restart",
"=",
"False",
",",
"name_fmt",
"=",
"None",
",",
"start_off... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | prepend_www | Changes google.com to www.google.com | src/streamlink/utils/__init__.py | def prepend_www(url):
"""Changes google.com to www.google.com"""
parsed = urlparse(url)
if parsed.netloc.split(".")[0] != "www":
return parsed.scheme + "://www." + parsed.netloc + parsed.path
else:
return url | def prepend_www(url):
"""Changes google.com to www.google.com"""
parsed = urlparse(url)
if parsed.netloc.split(".")[0] != "www":
return parsed.scheme + "://www." + parsed.netloc + parsed.path
else:
return url | [
"Changes",
"google",
".",
"com",
"to",
"www",
".",
"google",
".",
"com"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L43-L49 | [
"def",
"prepend_www",
"(",
"url",
")",
":",
"parsed",
"=",
"urlparse",
"(",
"url",
")",
"if",
"parsed",
".",
"netloc",
".",
"split",
"(",
"\".\"",
")",
"[",
"0",
"]",
"!=",
"\"www\"",
":",
"return",
"parsed",
".",
"scheme",
"+",
"\"://www.\"",
"+",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | parse_json | Wrapper around json.loads.
Wraps errors in custom exception with a snippet of the data in the message. | src/streamlink/utils/__init__.py | def parse_json(data, name="JSON", exception=PluginError, schema=None):
"""Wrapper around json.loads.
Wraps errors in custom exception with a snippet of the data in the message.
"""
try:
json_data = json.loads(data)
except ValueError as err:
snippet = repr(data)
if len(snippe... | def parse_json(data, name="JSON", exception=PluginError, schema=None):
"""Wrapper around json.loads.
Wraps errors in custom exception with a snippet of the data in the message.
"""
try:
json_data = json.loads(data)
except ValueError as err:
snippet = repr(data)
if len(snippe... | [
"Wrapper",
"around",
"json",
".",
"loads",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L52-L71 | [
"def",
"parse_json",
"(",
"data",
",",
"name",
"=",
"\"JSON\"",
",",
"exception",
"=",
"PluginError",
",",
"schema",
"=",
"None",
")",
":",
"try",
":",
"json_data",
"=",
"json",
".",
"loads",
"(",
"data",
")",
"except",
"ValueError",
"as",
"err",
":",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | parse_xml | Wrapper around ElementTree.fromstring with some extras.
Provides these extra features:
- Handles incorrectly encoded XML
- Allows stripping namespace information
- Wraps errors in custom exception with a snippet of the data in the message | src/streamlink/utils/__init__.py | def parse_xml(data, name="XML", ignore_ns=False, exception=PluginError, schema=None, invalid_char_entities=False):
"""Wrapper around ElementTree.fromstring with some extras.
Provides these extra features:
- Handles incorrectly encoded XML
- Allows stripping namespace information
- Wraps errors i... | def parse_xml(data, name="XML", ignore_ns=False, exception=PluginError, schema=None, invalid_char_entities=False):
"""Wrapper around ElementTree.fromstring with some extras.
Provides these extra features:
- Handles incorrectly encoded XML
- Allows stripping namespace information
- Wraps errors i... | [
"Wrapper",
"around",
"ElementTree",
".",
"fromstring",
"with",
"some",
"extras",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L74-L105 | [
"def",
"parse_xml",
"(",
"data",
",",
"name",
"=",
"\"XML\"",
",",
"ignore_ns",
"=",
"False",
",",
"exception",
"=",
"PluginError",
",",
"schema",
"=",
"None",
",",
"invalid_char_entities",
"=",
"False",
")",
":",
"if",
"is_py2",
"and",
"isinstance",
"(",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | parse_qsd | Parses a query string into a dict.
Unlike parse_qs and parse_qsl, duplicate keys are not preserved in
favor of a simpler return value. | src/streamlink/utils/__init__.py | def parse_qsd(data, name="query string", exception=PluginError, schema=None, **params):
"""Parses a query string into a dict.
Unlike parse_qs and parse_qsl, duplicate keys are not preserved in
favor of a simpler return value.
"""
value = dict(parse_qsl(data, **params))
if schema:
value... | def parse_qsd(data, name="query string", exception=PluginError, schema=None, **params):
"""Parses a query string into a dict.
Unlike parse_qs and parse_qsl, duplicate keys are not preserved in
favor of a simpler return value.
"""
value = dict(parse_qsl(data, **params))
if schema:
value... | [
"Parses",
"a",
"query",
"string",
"into",
"a",
"dict",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L108-L119 | [
"def",
"parse_qsd",
"(",
"data",
",",
"name",
"=",
"\"query string\"",
",",
"exception",
"=",
"PluginError",
",",
"schema",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"value",
"=",
"dict",
"(",
"parse_qsl",
"(",
"data",
",",
"*",
"*",
"params",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | search_dict | Search for a key in a nested dict, or list of nested dicts, and return the values.
:param data: dict/list to search
:param key: key to find
:return: matches for key | src/streamlink/utils/__init__.py | def search_dict(data, key):
"""
Search for a key in a nested dict, or list of nested dicts, and return the values.
:param data: dict/list to search
:param key: key to find
:return: matches for key
"""
if isinstance(data, dict):
for dkey, value in data.items():
if dkey ==... | def search_dict(data, key):
"""
Search for a key in a nested dict, or list of nested dicts, and return the values.
:param data: dict/list to search
:param key: key to find
:return: matches for key
"""
if isinstance(data, dict):
for dkey, value in data.items():
if dkey ==... | [
"Search",
"for",
"a",
"key",
"in",
"a",
"nested",
"dict",
"or",
"list",
"of",
"nested",
"dicts",
"and",
"return",
"the",
"values",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L158-L175 | [
"def",
"search_dict",
"(",
"data",
",",
"key",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"for",
"dkey",
",",
"value",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"dkey",
"==",
"key",
":",
"yield",
"value",
"for",
"res... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | OlympicChannel._get_live_streams | Get the live stream in a particular language
:param lang:
:param path:
:return: | src/streamlink/plugins/olympicchannel.py | def _get_live_streams(self, lang, path):
"""
Get the live stream in a particular language
:param lang:
:param path:
:return:
"""
res = self.session.http.get(self._live_api_url.format(lang, path))
live_res = self.session.http.json(res)['default']['uid']
... | def _get_live_streams(self, lang, path):
"""
Get the live stream in a particular language
:param lang:
:param path:
:return:
"""
res = self.session.http.get(self._live_api_url.format(lang, path))
live_res = self.session.http.json(res)['default']['uid']
... | [
"Get",
"the",
"live",
"stream",
"in",
"a",
"particular",
"language",
":",
"param",
"lang",
":",
":",
"param",
"path",
":",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/olympicchannel.py#L29-L43 | [
"def",
"_get_live_streams",
"(",
"self",
",",
"lang",
",",
"path",
")",
":",
"res",
"=",
"self",
".",
"session",
".",
"http",
".",
"get",
"(",
"self",
".",
"_live_api_url",
".",
"format",
"(",
"lang",
",",
"path",
")",
")",
"live_res",
"=",
"self",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | OlympicChannel._get_streams | Find the streams for OlympicChannel
:return: | src/streamlink/plugins/olympicchannel.py | def _get_streams(self):
"""
Find the streams for OlympicChannel
:return:
"""
match = self._url_re.match(self.url)
type_of_stream = match.group('type')
lang = re.search(r"/../", self.url).group(0)
if type_of_stream == 'tv':
path = re.search(r"t... | def _get_streams(self):
"""
Find the streams for OlympicChannel
:return:
"""
match = self._url_re.match(self.url)
type_of_stream = match.group('type')
lang = re.search(r"/../", self.url).group(0)
if type_of_stream == 'tv':
path = re.search(r"t... | [
"Find",
"the",
"streams",
"for",
"OlympicChannel",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/olympicchannel.py#L45-L60 | [
"def",
"_get_streams",
"(",
"self",
")",
":",
"match",
"=",
"self",
".",
"_url_re",
".",
"match",
"(",
"self",
".",
"url",
")",
"type_of_stream",
"=",
"match",
".",
"group",
"(",
"'type'",
")",
"lang",
"=",
"re",
".",
"search",
"(",
"r\"/../\"",
",",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HLSPlugin.priority | Returns LOW priority if the URL is not prefixed with hls:// but ends with
.m3u8 and return NORMAL priority if the URL is prefixed.
:param url: the URL to find the plugin priority for
:return: plugin priority for the given URL | src/streamlink/plugins/hls.py | def priority(cls, url):
"""
Returns LOW priority if the URL is not prefixed with hls:// but ends with
.m3u8 and return NORMAL priority if the URL is prefixed.
:param url: the URL to find the plugin priority for
:return: plugin priority for the given URL
"""
m = cl... | def priority(cls, url):
"""
Returns LOW priority if the URL is not prefixed with hls:// but ends with
.m3u8 and return NORMAL priority if the URL is prefixed.
:param url: the URL to find the plugin priority for
:return: plugin priority for the given URL
"""
m = cl... | [
"Returns",
"LOW",
"priority",
"if",
"the",
"URL",
"is",
"not",
"prefixed",
"with",
"hls",
":",
"//",
"but",
"ends",
"with",
".",
"m3u8",
"and",
"return",
"NORMAL",
"priority",
"if",
"the",
"URL",
"is",
"prefixed",
".",
":",
"param",
"url",
":",
"the",
... | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/hls.py#L14-L29 | [
"def",
"priority",
"(",
"cls",
",",
"url",
")",
":",
"m",
"=",
"cls",
".",
"_url_re",
".",
"match",
"(",
"url",
")",
"if",
"m",
":",
"prefix",
",",
"url",
"=",
"cls",
".",
"_url_re",
".",
"match",
"(",
"url",
")",
".",
"groups",
"(",
")",
"ur... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | StreamProcess.spawn | Spawn the process defined in `cmd`
parameters is converted to options the short and long option prefixes
if a list is given as the value, the parameter is repeated with each
value
If timeout is set the spawn will block until the process returns or
the timeout expires.
... | src/streamlink/stream/streamprocess.py | def spawn(self, parameters=None, arguments=None, stderr=None, timeout=None, short_option_prefix="-", long_option_prefix="--"):
"""
Spawn the process defined in `cmd`
parameters is converted to options the short and long option prefixes
if a list is given as the value, the parameter is r... | def spawn(self, parameters=None, arguments=None, stderr=None, timeout=None, short_option_prefix="-", long_option_prefix="--"):
"""
Spawn the process defined in `cmd`
parameters is converted to options the short and long option prefixes
if a list is given as the value, the parameter is r... | [
"Spawn",
"the",
"process",
"defined",
"in",
"cmd"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/streamprocess.py#L107-L151 | [
"def",
"spawn",
"(",
"self",
",",
"parameters",
"=",
"None",
",",
"arguments",
"=",
"None",
",",
"stderr",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"short_option_prefix",
"=",
"\"-\"",
",",
"long_option_prefix",
"=",
"\"--\"",
")",
":",
"stderr",
"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | itertags | Brute force regex based HTML tag parser. This is a rough-and-ready searcher to find HTML tags when
standards compliance is not required. Will find tags that are commented out, or inside script tag etc.
:param html: HTML page
:param tag: tag name to find
:return: generator with Tags | src/streamlink/plugin/api/utils.py | def itertags(html, tag):
"""
Brute force regex based HTML tag parser. This is a rough-and-ready searcher to find HTML tags when
standards compliance is not required. Will find tags that are commented out, or inside script tag etc.
:param html: HTML page
:param tag: tag name to find
:return: gen... | def itertags(html, tag):
"""
Brute force regex based HTML tag parser. This is a rough-and-ready searcher to find HTML tags when
standards compliance is not required. Will find tags that are commented out, or inside script tag etc.
:param html: HTML page
:param tag: tag name to find
:return: gen... | [
"Brute",
"force",
"regex",
"based",
"HTML",
"tag",
"parser",
".",
"This",
"is",
"a",
"rough",
"-",
"and",
"-",
"ready",
"searcher",
"to",
"find",
"HTML",
"tags",
"when",
"standards",
"compliance",
"is",
"not",
"required",
".",
"Will",
"find",
"tags",
"th... | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/utils.py#L16-L28 | [
"def",
"itertags",
"(",
"html",
",",
"tag",
")",
":",
"for",
"match",
"in",
"tag_re",
".",
"finditer",
"(",
"html",
")",
":",
"if",
"match",
".",
"group",
"(",
"\"tag\"",
")",
"==",
"tag",
":",
"attrs",
"=",
"dict",
"(",
"(",
"a",
".",
"group",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | DASHStream.parse_manifest | Attempt to parse a DASH manifest file and return its streams
:param session: Streamlink session instance
:param url_or_manifest: URL of the manifest file or an XML manifest string
:return: a dict of name -> DASHStream instances | src/streamlink/stream/dash.py | def parse_manifest(cls, session, url_or_manifest, **args):
"""
Attempt to parse a DASH manifest file and return its streams
:param session: Streamlink session instance
:param url_or_manifest: URL of the manifest file or an XML manifest string
:return: a dict of name -> DASHStrea... | def parse_manifest(cls, session, url_or_manifest, **args):
"""
Attempt to parse a DASH manifest file and return its streams
:param session: Streamlink session instance
:param url_or_manifest: URL of the manifest file or an XML manifest string
:return: a dict of name -> DASHStrea... | [
"Attempt",
"to",
"parse",
"a",
"DASH",
"manifest",
"file",
"and",
"return",
"its",
"streams"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/dash.py#L166-L239 | [
"def",
"parse_manifest",
"(",
"cls",
",",
"session",
",",
"url_or_manifest",
",",
"*",
"*",
"args",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"url_or_manifest",
".",
"startswith",
"(",
"'<?xml'",
")",
":",
"mpd",
"=",
"MPD",
"(",
"parse_xml",
"(",
"url_or_... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HTTPSession.determine_json_encoding | Determine which Unicode encoding the JSON text sample is encoded with
RFC4627 (http://www.ietf.org/rfc/rfc4627.txt) suggests that the encoding of JSON text can be determined
by checking the pattern of NULL bytes in first 4 octets of the text.
:param sample: a sample of at least 4 bytes of the J... | src/streamlink/plugin/api/http_session.py | def determine_json_encoding(cls, sample):
"""
Determine which Unicode encoding the JSON text sample is encoded with
RFC4627 (http://www.ietf.org/rfc/rfc4627.txt) suggests that the encoding of JSON text can be determined
by checking the pattern of NULL bytes in first 4 octets of the text... | def determine_json_encoding(cls, sample):
"""
Determine which Unicode encoding the JSON text sample is encoded with
RFC4627 (http://www.ietf.org/rfc/rfc4627.txt) suggests that the encoding of JSON text can be determined
by checking the pattern of NULL bytes in first 4 octets of the text... | [
"Determine",
"which",
"Unicode",
"encoding",
"the",
"JSON",
"text",
"sample",
"is",
"encoded",
"with"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L76-L95 | [
"def",
"determine_json_encoding",
"(",
"cls",
",",
"sample",
")",
":",
"nulls_at",
"=",
"[",
"i",
"for",
"i",
",",
"j",
"in",
"enumerate",
"(",
"bytearray",
"(",
"sample",
"[",
":",
"4",
"]",
")",
")",
"if",
"j",
"==",
"0",
"]",
"if",
"nulls_at",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HTTPSession.json | Parses JSON from a response. | src/streamlink/plugin/api/http_session.py | def json(cls, res, *args, **kwargs):
"""Parses JSON from a response."""
# if an encoding is already set then use the provided encoding
if res.encoding is None:
res.encoding = cls.determine_json_encoding(res.content[:4])
return parse_json(res.text, *args, **kwargs) | def json(cls, res, *args, **kwargs):
"""Parses JSON from a response."""
# if an encoding is already set then use the provided encoding
if res.encoding is None:
res.encoding = cls.determine_json_encoding(res.content[:4])
return parse_json(res.text, *args, **kwargs) | [
"Parses",
"JSON",
"from",
"a",
"response",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L98-L103 | [
"def",
"json",
"(",
"cls",
",",
"res",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# if an encoding is already set then use the provided encoding",
"if",
"res",
".",
"encoding",
"is",
"None",
":",
"res",
".",
"encoding",
"=",
"cls",
".",
"determine... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HTTPSession.xml | Parses XML from a response. | src/streamlink/plugin/api/http_session.py | def xml(cls, res, *args, **kwargs):
"""Parses XML from a response."""
return parse_xml(res.text, *args, **kwargs) | def xml(cls, res, *args, **kwargs):
"""Parses XML from a response."""
return parse_xml(res.text, *args, **kwargs) | [
"Parses",
"XML",
"from",
"a",
"response",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L106-L108 | [
"def",
"xml",
"(",
"cls",
",",
"res",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"parse_xml",
"(",
"res",
".",
"text",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HTTPSession.parse_cookies | Parses a semi-colon delimited list of cookies.
Example: foo=bar;baz=qux | src/streamlink/plugin/api/http_session.py | def parse_cookies(self, cookies, **kwargs):
"""Parses a semi-colon delimited list of cookies.
Example: foo=bar;baz=qux
"""
for name, value in _parse_keyvalue_list(cookies):
self.cookies.set(name, value, **kwargs) | def parse_cookies(self, cookies, **kwargs):
"""Parses a semi-colon delimited list of cookies.
Example: foo=bar;baz=qux
"""
for name, value in _parse_keyvalue_list(cookies):
self.cookies.set(name, value, **kwargs) | [
"Parses",
"a",
"semi",
"-",
"colon",
"delimited",
"list",
"of",
"cookies",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L110-L116 | [
"def",
"parse_cookies",
"(",
"self",
",",
"cookies",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"value",
"in",
"_parse_keyvalue_list",
"(",
"cookies",
")",
":",
"self",
".",
"cookies",
".",
"set",
"(",
"name",
",",
"value",
",",
"*",
"*",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HTTPSession.parse_headers | Parses a semi-colon delimited list of headers.
Example: foo=bar;baz=qux | src/streamlink/plugin/api/http_session.py | def parse_headers(self, headers):
"""Parses a semi-colon delimited list of headers.
Example: foo=bar;baz=qux
"""
for name, value in _parse_keyvalue_list(headers):
self.headers[name] = value | def parse_headers(self, headers):
"""Parses a semi-colon delimited list of headers.
Example: foo=bar;baz=qux
"""
for name, value in _parse_keyvalue_list(headers):
self.headers[name] = value | [
"Parses",
"a",
"semi",
"-",
"colon",
"delimited",
"list",
"of",
"headers",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L118-L124 | [
"def",
"parse_headers",
"(",
"self",
",",
"headers",
")",
":",
"for",
"name",
",",
"value",
"in",
"_parse_keyvalue_list",
"(",
"headers",
")",
":",
"self",
".",
"headers",
"[",
"name",
"]",
"=",
"value"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | HTTPSession.parse_query_params | Parses a semi-colon delimited list of query parameters.
Example: foo=bar;baz=qux | src/streamlink/plugin/api/http_session.py | def parse_query_params(self, cookies, **kwargs):
"""Parses a semi-colon delimited list of query parameters.
Example: foo=bar;baz=qux
"""
for name, value in _parse_keyvalue_list(cookies):
self.params[name] = value | def parse_query_params(self, cookies, **kwargs):
"""Parses a semi-colon delimited list of query parameters.
Example: foo=bar;baz=qux
"""
for name, value in _parse_keyvalue_list(cookies):
self.params[name] = value | [
"Parses",
"a",
"semi",
"-",
"colon",
"delimited",
"list",
"of",
"query",
"parameters",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/http_session.py#L126-L132 | [
"def",
"parse_query_params",
"(",
"self",
",",
"cookies",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"value",
"in",
"_parse_keyvalue_list",
"(",
"cookies",
")",
":",
"self",
".",
"params",
"[",
"name",
"]",
"=",
"value"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | USTVNow._get_streams | Finds the streams from tvcatchup.com. | src/streamlink/plugins/ustvnow.py | def _get_streams(self):
"""
Finds the streams from tvcatchup.com.
"""
token = self.login(self.get_option("username"), self.get_option("password"))
m = self._url_re.match(self.url)
scode = m and m.group("scode") or self.get_option("station_code")
res = self.sessio... | def _get_streams(self):
"""
Finds the streams from tvcatchup.com.
"""
token = self.login(self.get_option("username"), self.get_option("password"))
m = self._url_re.match(self.url)
scode = m and m.group("scode") or self.get_option("station_code")
res = self.sessio... | [
"Finds",
"the",
"streams",
"from",
"tvcatchup",
".",
"com",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/ustvnow.py#L66-L99 | [
"def",
"_get_streams",
"(",
"self",
")",
":",
"token",
"=",
"self",
".",
"login",
"(",
"self",
".",
"get_option",
"(",
"\"username\"",
")",
",",
"self",
".",
"get_option",
"(",
"\"password\"",
")",
")",
"m",
"=",
"self",
".",
"_url_re",
".",
"match",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streann.device_id | Randomly generated deviceId.
:return: | src/streamlink/plugins/streann.py | def device_id(self):
"""
Randomly generated deviceId.
:return:
"""
if self._device_id is None:
self._device_id = "".join(
random.choice("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") for _ in range(50))
return self._device_id | def device_id(self):
"""
Randomly generated deviceId.
:return:
"""
if self._device_id is None:
self._device_id = "".join(
random.choice("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") for _ in range(50))
return self._device_id | [
"Randomly",
"generated",
"deviceId",
".",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/streann.py#L35-L43 | [
"def",
"device_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_id",
"is",
"None",
":",
"self",
".",
"_device_id",
"=",
"\"\"",
".",
"join",
"(",
"random",
".",
"choice",
"(",
"\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"",
")",
"for... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | _LogRecord.getMessage | Return the message for this LogRecord.
Return the message for this LogRecord after merging any user-supplied
arguments with the message. | src/streamlink/logger.py | def getMessage(self):
"""
Return the message for this LogRecord.
Return the message for this LogRecord after merging any user-supplied
arguments with the message.
"""
msg = self.msg
if self.args:
msg = msg.format(*self.args)
return maybe_encod... | def getMessage(self):
"""
Return the message for this LogRecord.
Return the message for this LogRecord after merging any user-supplied
arguments with the message.
"""
msg = self.msg
if self.args:
msg = msg.format(*self.args)
return maybe_encod... | [
"Return",
"the",
"message",
"for",
"this",
"LogRecord",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/logger.py#L36-L46 | [
"def",
"getMessage",
"(",
"self",
")",
":",
"msg",
"=",
"self",
".",
"msg",
"if",
"self",
".",
"args",
":",
"msg",
"=",
"msg",
".",
"format",
"(",
"*",
"self",
".",
"args",
")",
"return",
"maybe_encode",
"(",
"msg",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | StreamlinkLogger.makeRecord | A factory method which can be overridden in subclasses to create
specialized LogRecords. | src/streamlink/logger.py | def makeRecord(self, name, level, fn, lno, msg, args, exc_info,
func=None, extra=None, sinfo=None):
"""
A factory method which can be overridden in subclasses to create
specialized LogRecords.
"""
if name.startswith("streamlink"):
rv = _LogRecord(na... | def makeRecord(self, name, level, fn, lno, msg, args, exc_info,
func=None, extra=None, sinfo=None):
"""
A factory method which can be overridden in subclasses to create
specialized LogRecords.
"""
if name.startswith("streamlink"):
rv = _LogRecord(na... | [
"A",
"factory",
"method",
"which",
"can",
"be",
"overridden",
"in",
"subclasses",
"to",
"create",
"specialized",
"LogRecords",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/logger.py#L57-L72 | [
"def",
"makeRecord",
"(",
"self",
",",
"name",
",",
"level",
",",
"fn",
",",
"lno",
",",
"msg",
",",
"args",
",",
"exc_info",
",",
"func",
"=",
"None",
",",
"extra",
"=",
"None",
",",
"sinfo",
"=",
"None",
")",
":",
"if",
"name",
".",
"startswith... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | FileAdapter.send | Wraps a file, described in request, in a Response object.
:param request: The PreparedRequest` being "sent".
:returns: a Response object containing the file | src/streamlink/packages/requests_file.py | def send(self, request, **kwargs):
""" Wraps a file, described in request, in a Response object.
:param request: The PreparedRequest` being "sent".
:returns: a Response object containing the file
"""
# Check that the method makes sense. Only support GET
if reque... | def send(self, request, **kwargs):
""" Wraps a file, described in request, in a Response object.
:param request: The PreparedRequest` being "sent".
:returns: a Response object containing the file
"""
# Check that the method makes sense. Only support GET
if reque... | [
"Wraps",
"a",
"file",
"described",
"in",
"request",
"in",
"a",
"Response",
"object",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/packages/requests_file.py#L33-L148 | [
"def",
"send",
"(",
"self",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"# Check that the method makes sense. Only support GET",
"if",
"request",
".",
"method",
"not",
"in",
"(",
"\"GET\"",
",",
"\"HEAD\"",
")",
":",
"raise",
"ValueError",
"(",
"\"Inval... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | WWENetwork._get_media_info | Get the info about the content, based on the ID
:param content_id:
:return: | src/streamlink/plugins/wwenetwork.py | def _get_media_info(self, content_id):
"""
Get the info about the content, based on the ID
:param content_id:
:return:
"""
params = {"identityPointId": self._session_attributes.get("ipid"),
"fingerprint": self._session_attributes.get("fprt"),
... | def _get_media_info(self, content_id):
"""
Get the info about the content, based on the ID
:param content_id:
:return:
"""
params = {"identityPointId": self._session_attributes.get("ipid"),
"fingerprint": self._session_attributes.get("fprt"),
... | [
"Get",
"the",
"info",
"about",
"the",
"content",
"based",
"on",
"the",
"ID",
":",
"param",
"content_id",
":",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/wwenetwork.py#L110-L128 | [
"def",
"_get_media_info",
"(",
"self",
",",
"content_id",
")",
":",
"params",
"=",
"{",
"\"identityPointId\"",
":",
"self",
".",
"_session_attributes",
".",
"get",
"(",
"\"ipid\"",
")",
",",
"\"fingerprint\"",
":",
"self",
".",
"_session_attributes",
".",
"get... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | VK._get_streams | Find the streams for vk.com
:return: | src/streamlink/plugins/vk.py | def _get_streams(self):
"""
Find the streams for vk.com
:return:
"""
self.session.http.headers.update({'User-Agent': useragents.IPHONE_6})
# If this is a 'videos' catalog URL
# with an video ID in the GET request, get that instead
url = self.follow_vk_red... | def _get_streams(self):
"""
Find the streams for vk.com
:return:
"""
self.session.http.headers.update({'User-Agent': useragents.IPHONE_6})
# If this is a 'videos' catalog URL
# with an video ID in the GET request, get that instead
url = self.follow_vk_red... | [
"Find",
"the",
"streams",
"for",
"vk",
".",
"com",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/vk.py#L50-L102 | [
"def",
"_get_streams",
"(",
"self",
")",
":",
"self",
".",
"session",
".",
"http",
".",
"headers",
".",
"update",
"(",
"{",
"'User-Agent'",
":",
"useragents",
".",
"IPHONE_6",
"}",
")",
"# If this is a 'videos' catalog URL",
"# with an video ID in the GET request, g... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | WebTV._get_streams | Find the streams for web.tv
:return: | src/streamlink/plugins/webtv.py | def _get_streams(self):
"""
Find the streams for web.tv
:return:
"""
headers = {}
res = self.session.http.get(self.url, headers=headers)
headers["Referer"] = self.url
sources = self._sources_re.findall(res.text)
if len(sources):
sdata ... | def _get_streams(self):
"""
Find the streams for web.tv
:return:
"""
headers = {}
res = self.session.http.get(self.url, headers=headers)
headers["Referer"] = self.url
sources = self._sources_re.findall(res.text)
if len(sources):
sdata ... | [
"Find",
"the",
"streams",
"for",
"web",
".",
"tv",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/webtv.py#L49-L76 | [
"def",
"_get_streams",
"(",
"self",
")",
":",
"headers",
"=",
"{",
"}",
"res",
"=",
"self",
".",
"session",
".",
"http",
".",
"get",
"(",
"self",
".",
"url",
",",
"headers",
"=",
"headers",
")",
"headers",
"[",
"\"Referer\"",
"]",
"=",
"self",
".",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | LiveEdu.login | Attempt a login to LiveEdu.tv | src/streamlink/plugins/liveedu.py | def login(self):
"""
Attempt a login to LiveEdu.tv
"""
email = self.get_option("email")
password = self.get_option("password")
if email and password:
res = self.session.http.get(self.login_url)
csrf_match = self.csrf_re.search(res.text)
... | def login(self):
"""
Attempt a login to LiveEdu.tv
"""
email = self.get_option("email")
password = self.get_option("password")
if email and password:
res = self.session.http.get(self.login_url)
csrf_match = self.csrf_re.search(res.text)
... | [
"Attempt",
"a",
"login",
"to",
"LiveEdu",
".",
"tv"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/liveedu.py#L52-L72 | [
"def",
"login",
"(",
"self",
")",
":",
"email",
"=",
"self",
".",
"get_option",
"(",
"\"email\"",
")",
"password",
"=",
"self",
".",
"get_option",
"(",
"\"password\"",
")",
"if",
"email",
"and",
"password",
":",
"res",
"=",
"self",
".",
"session",
".",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | LiveEdu._get_streams | Get the config object from the page source and call the
API to get the list of streams
:return: | src/streamlink/plugins/liveedu.py | def _get_streams(self):
"""
Get the config object from the page source and call the
API to get the list of streams
:return:
"""
# attempt a login
self.login()
res = self.session.http.get(self.url)
# decode the config for the page
matches =... | def _get_streams(self):
"""
Get the config object from the page source and call the
API to get the list of streams
:return:
"""
# attempt a login
self.login()
res = self.session.http.get(self.url)
# decode the config for the page
matches =... | [
"Get",
"the",
"config",
"object",
"from",
"the",
"page",
"source",
"and",
"call",
"the",
"API",
"to",
"get",
"the",
"list",
"of",
"streams",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/liveedu.py#L74-L125 | [
"def",
"_get_streams",
"(",
"self",
")",
":",
"# attempt a login",
"self",
".",
"login",
"(",
")",
"res",
"=",
"self",
".",
"session",
".",
"http",
".",
"get",
"(",
"self",
".",
"url",
")",
"# decode the config for the page",
"matches",
"=",
"self",
".",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | load_support_plugin | Loads a plugin from the same directory as the calling plugin.
The path used is extracted from the last call in module scope,
therefore this must be called only from module level in the
originating plugin or the correct plugin path will not be found. | src/streamlink/plugin/api/support_plugin.py | def load_support_plugin(name):
"""Loads a plugin from the same directory as the calling plugin.
The path used is extracted from the last call in module scope,
therefore this must be called only from module level in the
originating plugin or the correct plugin path will not be found.
"""
# Get... | def load_support_plugin(name):
"""Loads a plugin from the same directory as the calling plugin.
The path used is extracted from the last call in module scope,
therefore this must be called only from module level in the
originating plugin or the correct plugin path will not be found.
"""
# Get... | [
"Loads",
"a",
"plugin",
"from",
"the",
"same",
"directory",
"as",
"the",
"calling",
"plugin",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/support_plugin.py#L9-L30 | [
"def",
"load_support_plugin",
"(",
"name",
")",
":",
"# Get the path of the caller module",
"stack",
"=",
"list",
"(",
"filter",
"(",
"lambda",
"f",
":",
"f",
"[",
"3",
"]",
"==",
"\"<module>\"",
",",
"inspect",
".",
"stack",
"(",
")",
")",
")",
"prev_fram... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | update_scheme | Take the scheme from the current URL and applies it to the
target URL if the target URL startswith // or is missing a scheme
:param current: current URL
:param target: target URL
:return: target URL with the current URLs scheme | src/streamlink/utils/url.py | def update_scheme(current, target):
"""
Take the scheme from the current URL and applies it to the
target URL if the target URL startswith // or is missing a scheme
:param current: current URL
:param target: target URL
:return: target URL with the current URLs scheme
"""
target_p = urlpa... | def update_scheme(current, target):
"""
Take the scheme from the current URL and applies it to the
target URL if the target URL startswith // or is missing a scheme
:param current: current URL
:param target: target URL
:return: target URL with the current URLs scheme
"""
target_p = urlpa... | [
"Take",
"the",
"scheme",
"from",
"the",
"current",
"URL",
"and",
"applies",
"it",
"to",
"the",
"target",
"URL",
"if",
"the",
"target",
"URL",
"startswith",
"//",
"or",
"is",
"missing",
"a",
"scheme",
":",
"param",
"current",
":",
"current",
"URL",
":",
... | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/url.py#L6-L22 | [
"def",
"update_scheme",
"(",
"current",
",",
"target",
")",
":",
"target_p",
"=",
"urlparse",
"(",
"target",
")",
"if",
"not",
"target_p",
".",
"scheme",
"and",
"target_p",
".",
"netloc",
":",
"return",
"\"{0}:{1}\"",
".",
"format",
"(",
"urlparse",
"(",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | url_equal | Compare two URLs and return True if they are equal, some parts of the URLs can be ignored
:param first: URL
:param second: URL
:param ignore_scheme: ignore the scheme
:param ignore_netloc: ignore the netloc
:param ignore_path: ignore the path
:param ignore_params: ignore the params
:param ig... | src/streamlink/utils/url.py | def url_equal(first, second, ignore_scheme=False, ignore_netloc=False, ignore_path=False, ignore_params=False,
ignore_query=False, ignore_fragment=False):
"""
Compare two URLs and return True if they are equal, some parts of the URLs can be ignored
:param first: URL
:param second: URL
... | def url_equal(first, second, ignore_scheme=False, ignore_netloc=False, ignore_path=False, ignore_params=False,
ignore_query=False, ignore_fragment=False):
"""
Compare two URLs and return True if they are equal, some parts of the URLs can be ignored
:param first: URL
:param second: URL
... | [
"Compare",
"two",
"URLs",
"and",
"return",
"True",
"if",
"they",
"are",
"equal",
"some",
"parts",
"of",
"the",
"URLs",
"can",
"be",
"ignored",
":",
"param",
"first",
":",
"URL",
":",
"param",
"second",
":",
"URL",
":",
"param",
"ignore_scheme",
":",
"i... | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/url.py#L25-L49 | [
"def",
"url_equal",
"(",
"first",
",",
"second",
",",
"ignore_scheme",
"=",
"False",
",",
"ignore_netloc",
"=",
"False",
",",
"ignore_path",
"=",
"False",
",",
"ignore_params",
"=",
"False",
",",
"ignore_query",
"=",
"False",
",",
"ignore_fragment",
"=",
"Fa... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | url_concat | Join extra paths to a URL, does not join absolute paths
:param base: the base URL
:param parts: a list of the parts to join
:param allow_fragments: include url fragments
:return: the joined URL | src/streamlink/utils/url.py | def url_concat(base, *parts, **kwargs):
"""
Join extra paths to a URL, does not join absolute paths
:param base: the base URL
:param parts: a list of the parts to join
:param allow_fragments: include url fragments
:return: the joined URL
"""
allow_fragments = kwargs.get("allow_fragments"... | def url_concat(base, *parts, **kwargs):
"""
Join extra paths to a URL, does not join absolute paths
:param base: the base URL
:param parts: a list of the parts to join
:param allow_fragments: include url fragments
:return: the joined URL
"""
allow_fragments = kwargs.get("allow_fragments"... | [
"Join",
"extra",
"paths",
"to",
"a",
"URL",
"does",
"not",
"join",
"absolute",
"paths",
":",
"param",
"base",
":",
"the",
"base",
"URL",
":",
"param",
"parts",
":",
"a",
"list",
"of",
"the",
"parts",
"to",
"join",
":",
"param",
"allow_fragments",
":",
... | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/url.py#L52-L63 | [
"def",
"url_concat",
"(",
"base",
",",
"*",
"parts",
",",
"*",
"*",
"kwargs",
")",
":",
"allow_fragments",
"=",
"kwargs",
".",
"get",
"(",
"\"allow_fragments\"",
",",
"True",
")",
"for",
"part",
"in",
"parts",
":",
"base",
"=",
"urljoin",
"(",
"base",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | update_qsd | Update or remove keys from a query string in a URL
:param url: URL to update
:param qsd: dict of keys to update, a None value leaves it unchanged
:param remove: list of keys to remove, or "*" to remove all
note: updated keys are never removed, even if unchanged
:return: updated URL | src/streamlink/utils/url.py | def update_qsd(url, qsd=None, remove=None):
"""
Update or remove keys from a query string in a URL
:param url: URL to update
:param qsd: dict of keys to update, a None value leaves it unchanged
:param remove: list of keys to remove, or "*" to remove all
note: updated keys are nev... | def update_qsd(url, qsd=None, remove=None):
"""
Update or remove keys from a query string in a URL
:param url: URL to update
:param qsd: dict of keys to update, a None value leaves it unchanged
:param remove: list of keys to remove, or "*" to remove all
note: updated keys are nev... | [
"Update",
"or",
"remove",
"keys",
"from",
"a",
"query",
"string",
"in",
"a",
"URL"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/url.py#L66-L97 | [
"def",
"update_qsd",
"(",
"url",
",",
"qsd",
"=",
"None",
",",
"remove",
"=",
"None",
")",
":",
"qsd",
"=",
"qsd",
"or",
"{",
"}",
"remove",
"=",
"remove",
"or",
"[",
"]",
"# parse current query string",
"parsed",
"=",
"urlparse",
"(",
"url",
")",
"c... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | ITVPlayer._get_streams | Find all the streams for the ITV url
:return: Mapping of quality to stream | src/streamlink/plugins/itvplayer.py | def _get_streams(self):
"""
Find all the streams for the ITV url
:return: Mapping of quality to stream
"""
self.session.http.headers.update({"User-Agent": useragents.FIREFOX})
video_info = self.video_info()
video_info_url = video_info.get("data-html5-playl... | def _get_streams(self):
"""
Find all the streams for the ITV url
:return: Mapping of quality to stream
"""
self.session.http.headers.update({"User-Agent": useragents.FIREFOX})
video_info = self.video_info()
video_info_url = video_info.get("data-html5-playl... | [
"Find",
"all",
"the",
"streams",
"for",
"the",
"ITV",
"url",
":",
"return",
":",
"Mapping",
"of",
"quality",
"to",
"stream"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/itvplayer.py#L57-L79 | [
"def",
"_get_streams",
"(",
"self",
")",
":",
"self",
".",
"session",
".",
"http",
".",
"headers",
".",
"update",
"(",
"{",
"\"User-Agent\"",
":",
"useragents",
".",
"FIREFOX",
"}",
")",
"video_info",
"=",
"self",
".",
"video_info",
"(",
")",
"video_info... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | FLVTagConcat.iter_chunks | Reads FLV tags from fd or buf and returns them with adjusted
timestamps. | src/streamlink/stream/flvconcat.py | def iter_chunks(self, fd=None, buf=None, skip_header=None):
"""Reads FLV tags from fd or buf and returns them with adjusted
timestamps."""
timestamps = dict(self.timestamps_add)
tag_iterator = self.iter_tags(fd=fd, buf=buf, skip_header=skip_header)
if not self.flv_header_writ... | def iter_chunks(self, fd=None, buf=None, skip_header=None):
"""Reads FLV tags from fd or buf and returns them with adjusted
timestamps."""
timestamps = dict(self.timestamps_add)
tag_iterator = self.iter_tags(fd=fd, buf=buf, skip_header=skip_header)
if not self.flv_header_writ... | [
"Reads",
"FLV",
"tags",
"from",
"fd",
"or",
"buf",
"and",
"returns",
"them",
"with",
"adjusted",
"timestamps",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/flvconcat.py#L207-L239 | [
"def",
"iter_chunks",
"(",
"self",
",",
"fd",
"=",
"None",
",",
"buf",
"=",
"None",
",",
"skip_header",
"=",
"None",
")",
":",
"timestamps",
"=",
"dict",
"(",
"self",
".",
"timestamps_add",
")",
"tag_iterator",
"=",
"self",
".",
"iter_tags",
"(",
"fd",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Arguments.requires | Find all the arguments required by name
:param name: name of the argument the find the dependencies
:return: list of dependant arguments | src/streamlink/options.py | def requires(self, name):
"""
Find all the arguments required by name
:param name: name of the argument the find the dependencies
:return: list of dependant arguments
"""
results = set([name])
argument = self.get(name)
for reqname in argument.requires:
... | def requires(self, name):
"""
Find all the arguments required by name
:param name: name of the argument the find the dependencies
:return: list of dependant arguments
"""
results = set([name])
argument = self.get(name)
for reqname in argument.requires:
... | [
"Find",
"all",
"the",
"arguments",
"required",
"by",
"name"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/options.py#L126-L150 | [
"def",
"requires",
"(",
"self",
",",
"name",
")",
":",
"results",
"=",
"set",
"(",
"[",
"name",
"]",
")",
"argument",
"=",
"self",
".",
"get",
"(",
"name",
")",
"for",
"reqname",
"in",
"argument",
".",
"requires",
":",
"required",
"=",
"self",
".",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | check_file_output | Checks if file already exists and ask the user if it should
be overwritten if it does. | src/streamlink_cli/main.py | def check_file_output(filename, force):
"""Checks if file already exists and ask the user if it should
be overwritten if it does."""
log.debug("Checking file output")
if os.path.isfile(filename) and not force:
if sys.stdin.isatty():
answer = console.ask("File {0} already exists! Ov... | def check_file_output(filename, force):
"""Checks if file already exists and ask the user if it should
be overwritten if it does."""
log.debug("Checking file output")
if os.path.isfile(filename) and not force:
if sys.stdin.isatty():
answer = console.ask("File {0} already exists! Ov... | [
"Checks",
"if",
"file",
"already",
"exists",
"and",
"ask",
"the",
"user",
"if",
"it",
"should",
"be",
"overwritten",
"if",
"it",
"does",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L53-L70 | [
"def",
"check_file_output",
"(",
"filename",
",",
"force",
")",
":",
"log",
".",
"debug",
"(",
"\"Checking file output\"",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
"and",
"not",
"force",
":",
"if",
"sys",
".",
"stdin",
".",
"i... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | create_output | Decides where to write the stream.
Depending on arguments it can be one of these:
- The stdout pipe
- A subprocess' stdin pipe
- A named pipe that the subprocess reads from
- A regular file | src/streamlink_cli/main.py | def create_output(plugin):
"""Decides where to write the stream.
Depending on arguments it can be one of these:
- The stdout pipe
- A subprocess' stdin pipe
- A named pipe that the subprocess reads from
- A regular file
"""
if (args.output or args.stdout) and (args.record or args.... | def create_output(plugin):
"""Decides where to write the stream.
Depending on arguments it can be one of these:
- The stdout pipe
- A subprocess' stdin pipe
- A named pipe that the subprocess reads from
- A regular file
"""
if (args.output or args.stdout) and (args.record or args.... | [
"Decides",
"where",
"to",
"write",
"the",
"stream",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L73-L129 | [
"def",
"create_output",
"(",
"plugin",
")",
":",
"if",
"(",
"args",
".",
"output",
"or",
"args",
".",
"stdout",
")",
"and",
"(",
"args",
".",
"record",
"or",
"args",
".",
"record_and_pipe",
")",
":",
"console",
".",
"exit",
"(",
"\"Cannot use record opti... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | create_http_server | Creates a HTTP server listening on a given host and port.
If host is empty, listen on all available interfaces, and if port is 0,
listen on a random high port. | src/streamlink_cli/main.py | def create_http_server(host=None, port=0):
"""Creates a HTTP server listening on a given host and port.
If host is empty, listen on all available interfaces, and if port is 0,
listen on a random high port.
"""
try:
http = HTTPServer()
http.bind(host=host, port=port)
except OSEr... | def create_http_server(host=None, port=0):
"""Creates a HTTP server listening on a given host and port.
If host is empty, listen on all available interfaces, and if port is 0,
listen on a random high port.
"""
try:
http = HTTPServer()
http.bind(host=host, port=port)
except OSEr... | [
"Creates",
"a",
"HTTP",
"server",
"listening",
"on",
"a",
"given",
"host",
"and",
"port",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L132-L145 | [
"def",
"create_http_server",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"0",
")",
":",
"try",
":",
"http",
"=",
"HTTPServer",
"(",
")",
"http",
".",
"bind",
"(",
"host",
"=",
"host",
",",
"port",
"=",
"port",
")",
"except",
"OSError",
"as",
"err",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | iter_http_requests | Repeatedly accept HTTP connections on a server.
Forever if the serving externally, or while a player is running if it is not
empty. | src/streamlink_cli/main.py | def iter_http_requests(server, player):
"""Repeatedly accept HTTP connections on a server.
Forever if the serving externally, or while a player is running if it is not
empty.
"""
while not player or player.running:
try:
yield server.open(timeout=2.5)
except OSError:
... | def iter_http_requests(server, player):
"""Repeatedly accept HTTP connections on a server.
Forever if the serving externally, or while a player is running if it is not
empty.
"""
while not player or player.running:
try:
yield server.open(timeout=2.5)
except OSError:
... | [
"Repeatedly",
"accept",
"HTTP",
"connections",
"on",
"a",
"server",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L163-L174 | [
"def",
"iter_http_requests",
"(",
"server",
",",
"player",
")",
":",
"while",
"not",
"player",
"or",
"player",
".",
"running",
":",
"try",
":",
"yield",
"server",
".",
"open",
"(",
"timeout",
"=",
"2.5",
")",
"except",
"OSError",
":",
"continue"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | output_stream_http | Continuously output the stream over HTTP. | src/streamlink_cli/main.py | def output_stream_http(plugin, initial_streams, external=False, port=0):
"""Continuously output the stream over HTTP."""
global output
if not external:
if not args.player:
console.exit("The default player (VLC) does not seem to be "
"installed. You must specify ... | def output_stream_http(plugin, initial_streams, external=False, port=0):
"""Continuously output the stream over HTTP."""
global output
if not external:
if not args.player:
console.exit("The default player (VLC) does not seem to be "
"installed. You must specify ... | [
"Continuously",
"output",
"the",
"stream",
"over",
"HTTP",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L177-L246 | [
"def",
"output_stream_http",
"(",
"plugin",
",",
"initial_streams",
",",
"external",
"=",
"False",
",",
"port",
"=",
"0",
")",
":",
"global",
"output",
"if",
"not",
"external",
":",
"if",
"not",
"args",
".",
"player",
":",
"console",
".",
"exit",
"(",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | output_stream_passthrough | Prepares a filename to be passed to the player. | src/streamlink_cli/main.py | def output_stream_passthrough(plugin, stream):
"""Prepares a filename to be passed to the player."""
global output
title = create_title(plugin)
filename = '"{0}"'.format(stream_to_url(stream))
output = PlayerOutput(args.player, args=args.player_args,
filename=filename, cal... | def output_stream_passthrough(plugin, stream):
"""Prepares a filename to be passed to the player."""
global output
title = create_title(plugin)
filename = '"{0}"'.format(stream_to_url(stream))
output = PlayerOutput(args.player, args=args.player_args,
filename=filename, cal... | [
"Prepares",
"a",
"filename",
"to",
"be",
"passed",
"to",
"the",
"player",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L249-L267 | [
"def",
"output_stream_passthrough",
"(",
"plugin",
",",
"stream",
")",
":",
"global",
"output",
"title",
"=",
"create_title",
"(",
"plugin",
")",
"filename",
"=",
"'\"{0}\"'",
".",
"format",
"(",
"stream_to_url",
"(",
"stream",
")",
")",
"output",
"=",
"Play... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | open_stream | Opens a stream and reads 8192 bytes from it.
This is useful to check if a stream actually has data
before opening the output. | src/streamlink_cli/main.py | def open_stream(stream):
"""Opens a stream and reads 8192 bytes from it.
This is useful to check if a stream actually has data
before opening the output.
"""
global stream_fd
# Attempts to open the stream
try:
stream_fd = stream.open()
except StreamError as err:
raise ... | def open_stream(stream):
"""Opens a stream and reads 8192 bytes from it.
This is useful to check if a stream actually has data
before opening the output.
"""
global stream_fd
# Attempts to open the stream
try:
stream_fd = stream.open()
except StreamError as err:
raise ... | [
"Opens",
"a",
"stream",
"and",
"reads",
"8192",
"bytes",
"from",
"it",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L270-L298 | [
"def",
"open_stream",
"(",
"stream",
")",
":",
"global",
"stream_fd",
"# Attempts to open the stream",
"try",
":",
"stream_fd",
"=",
"stream",
".",
"open",
"(",
")",
"except",
"StreamError",
"as",
"err",
":",
"raise",
"StreamError",
"(",
"\"Could not open stream: ... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | output_stream | Open stream, create output and finally write the stream to output. | src/streamlink_cli/main.py | def output_stream(plugin, stream):
"""Open stream, create output and finally write the stream to output."""
global output
success_open = False
for i in range(args.retry_open):
try:
stream_fd, prebuffer = open_stream(stream)
success_open = True
break
e... | def output_stream(plugin, stream):
"""Open stream, create output and finally write the stream to output."""
global output
success_open = False
for i in range(args.retry_open):
try:
stream_fd, prebuffer = open_stream(stream)
success_open = True
break
e... | [
"Open",
"stream",
"create",
"output",
"and",
"finally",
"write",
"the",
"stream",
"to",
"output",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L301-L333 | [
"def",
"output_stream",
"(",
"plugin",
",",
"stream",
")",
":",
"global",
"output",
"success_open",
"=",
"False",
"for",
"i",
"in",
"range",
"(",
"args",
".",
"retry_open",
")",
":",
"try",
":",
"stream_fd",
",",
"prebuffer",
"=",
"open_stream",
"(",
"st... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | read_stream | Reads data from stream and then writes it to the output. | src/streamlink_cli/main.py | def read_stream(stream, output, prebuffer, chunk_size=8192):
"""Reads data from stream and then writes it to the output."""
is_player = isinstance(output, PlayerOutput)
is_http = isinstance(output, HTTPServer)
is_fifo = is_player and output.namedpipe
show_progress = isinstance(output, FileOutput) an... | def read_stream(stream, output, prebuffer, chunk_size=8192):
"""Reads data from stream and then writes it to the output."""
is_player = isinstance(output, PlayerOutput)
is_http = isinstance(output, HTTPServer)
is_fifo = is_player and output.namedpipe
show_progress = isinstance(output, FileOutput) an... | [
"Reads",
"data",
"from",
"stream",
"and",
"then",
"writes",
"it",
"to",
"the",
"output",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L336-L382 | [
"def",
"read_stream",
"(",
"stream",
",",
"output",
",",
"prebuffer",
",",
"chunk_size",
"=",
"8192",
")",
":",
"is_player",
"=",
"isinstance",
"(",
"output",
",",
"PlayerOutput",
")",
"is_http",
"=",
"isinstance",
"(",
"output",
",",
"HTTPServer",
")",
"i... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | handle_stream | Decides what to do with the selected stream.
Depending on arguments it can be one of these:
- Output internal command-line
- Output JSON represenation
- Continuously output the stream over HTTP
- Output stream data to selected output | src/streamlink_cli/main.py | def handle_stream(plugin, streams, stream_name):
"""Decides what to do with the selected stream.
Depending on arguments it can be one of these:
- Output internal command-line
- Output JSON represenation
- Continuously output the stream over HTTP
- Output stream data to selected output
... | def handle_stream(plugin, streams, stream_name):
"""Decides what to do with the selected stream.
Depending on arguments it can be one of these:
- Output internal command-line
- Output JSON represenation
- Continuously output the stream over HTTP
- Output stream data to selected output
... | [
"Decides",
"what",
"to",
"do",
"with",
"the",
"selected",
"stream",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L385-L450 | [
"def",
"handle_stream",
"(",
"plugin",
",",
"streams",
",",
"stream_name",
")",
":",
"stream_name",
"=",
"resolve_stream_name",
"(",
"streams",
",",
"stream_name",
")",
"stream",
"=",
"streams",
"[",
"stream_name",
"]",
"# Print internal command-line if this stream",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | fetch_streams | Fetches streams using correct parameters. | src/streamlink_cli/main.py | def fetch_streams(plugin):
"""Fetches streams using correct parameters."""
return plugin.streams(stream_types=args.stream_types,
sorting_excludes=args.stream_sorting_excludes) | def fetch_streams(plugin):
"""Fetches streams using correct parameters."""
return plugin.streams(stream_types=args.stream_types,
sorting_excludes=args.stream_sorting_excludes) | [
"Fetches",
"streams",
"using",
"correct",
"parameters",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L453-L457 | [
"def",
"fetch_streams",
"(",
"plugin",
")",
":",
"return",
"plugin",
".",
"streams",
"(",
"stream_types",
"=",
"args",
".",
"stream_types",
",",
"sorting_excludes",
"=",
"args",
".",
"stream_sorting_excludes",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | fetch_streams_with_retry | Attempts to fetch streams repeatedly
until some are returned or limit hit. | src/streamlink_cli/main.py | def fetch_streams_with_retry(plugin, interval, count):
"""Attempts to fetch streams repeatedly
until some are returned or limit hit."""
try:
streams = fetch_streams(plugin)
except PluginError as err:
log.error(u"{0}", err)
streams = None
if not streams:
log.info(... | def fetch_streams_with_retry(plugin, interval, count):
"""Attempts to fetch streams repeatedly
until some are returned or limit hit."""
try:
streams = fetch_streams(plugin)
except PluginError as err:
log.error(u"{0}", err)
streams = None
if not streams:
log.info(... | [
"Attempts",
"to",
"fetch",
"streams",
"repeatedly",
"until",
"some",
"are",
"returned",
"or",
"limit",
"hit",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L460-L490 | [
"def",
"fetch_streams_with_retry",
"(",
"plugin",
",",
"interval",
",",
"count",
")",
":",
"try",
":",
"streams",
"=",
"fetch_streams",
"(",
"plugin",
")",
"except",
"PluginError",
"as",
"err",
":",
"log",
".",
"error",
"(",
"u\"{0}\"",
",",
"err",
")",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | resolve_stream_name | Returns the real stream name of a synonym. | src/streamlink_cli/main.py | def resolve_stream_name(streams, stream_name):
"""Returns the real stream name of a synonym."""
if stream_name in STREAM_SYNONYMS and stream_name in streams:
for name, stream in streams.items():
if stream is streams[stream_name] and name not in STREAM_SYNONYMS:
return name
... | def resolve_stream_name(streams, stream_name):
"""Returns the real stream name of a synonym."""
if stream_name in STREAM_SYNONYMS and stream_name in streams:
for name, stream in streams.items():
if stream is streams[stream_name] and name not in STREAM_SYNONYMS:
return name
... | [
"Returns",
"the",
"real",
"stream",
"name",
"of",
"a",
"synonym",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L493-L501 | [
"def",
"resolve_stream_name",
"(",
"streams",
",",
"stream_name",
")",
":",
"if",
"stream_name",
"in",
"STREAM_SYNONYMS",
"and",
"stream_name",
"in",
"streams",
":",
"for",
"name",
",",
"stream",
"in",
"streams",
".",
"items",
"(",
")",
":",
"if",
"stream",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | format_valid_streams | Formats a dict of streams.
Filters out synonyms and displays them next to
the stream they point to.
Streams are sorted according to their quality
(based on plugin.stream_weight). | src/streamlink_cli/main.py | def format_valid_streams(plugin, streams):
"""Formats a dict of streams.
Filters out synonyms and displays them next to
the stream they point to.
Streams are sorted according to their quality
(based on plugin.stream_weight).
"""
delimiter = ", "
validstreams = []
for name, strea... | def format_valid_streams(plugin, streams):
"""Formats a dict of streams.
Filters out synonyms and displays them next to
the stream they point to.
Streams are sorted according to their quality
(based on plugin.stream_weight).
"""
delimiter = ", "
validstreams = []
for name, strea... | [
"Formats",
"a",
"dict",
"of",
"streams",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L504-L534 | [
"def",
"format_valid_streams",
"(",
"plugin",
",",
"streams",
")",
":",
"delimiter",
"=",
"\", \"",
"validstreams",
"=",
"[",
"]",
"for",
"name",
",",
"stream",
"in",
"sorted",
"(",
"streams",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"stream",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | handle_url | The URL handler.
Attempts to resolve the URL to a plugin and then attempts
to fetch a list of available streams.
Proceeds to handle stream if user specified a valid one,
otherwise output list of valid streams. | src/streamlink_cli/main.py | def handle_url():
"""The URL handler.
Attempts to resolve the URL to a plugin and then attempts
to fetch a list of available streams.
Proceeds to handle stream if user specified a valid one,
otherwise output list of valid streams.
"""
try:
plugin = streamlink.resolve_url(args.url... | def handle_url():
"""The URL handler.
Attempts to resolve the URL to a plugin and then attempts
to fetch a list of available streams.
Proceeds to handle stream if user specified a valid one,
otherwise output list of valid streams.
"""
try:
plugin = streamlink.resolve_url(args.url... | [
"The",
"URL",
"handler",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L537-L611 | [
"def",
"handle_url",
"(",
")",
":",
"try",
":",
"plugin",
"=",
"streamlink",
".",
"resolve_url",
"(",
"args",
".",
"url",
")",
"setup_plugin_options",
"(",
"streamlink",
",",
"plugin",
")",
"log",
".",
"info",
"(",
"\"Found matching plugin {0} for URL {1}\"",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | print_plugins | Outputs a list of all plugins Streamlink has loaded. | src/streamlink_cli/main.py | def print_plugins():
"""Outputs a list of all plugins Streamlink has loaded."""
pluginlist = list(streamlink.get_plugins().keys())
pluginlist_formatted = ", ".join(sorted(pluginlist))
if console.json:
console.msg_json(pluginlist)
else:
console.msg("Loaded plugins: {0}", pluginlist_... | def print_plugins():
"""Outputs a list of all plugins Streamlink has loaded."""
pluginlist = list(streamlink.get_plugins().keys())
pluginlist_formatted = ", ".join(sorted(pluginlist))
if console.json:
console.msg_json(pluginlist)
else:
console.msg("Loaded plugins: {0}", pluginlist_... | [
"Outputs",
"a",
"list",
"of",
"all",
"plugins",
"Streamlink",
"has",
"loaded",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L614-L623 | [
"def",
"print_plugins",
"(",
")",
":",
"pluginlist",
"=",
"list",
"(",
"streamlink",
".",
"get_plugins",
"(",
")",
".",
"keys",
"(",
")",
")",
"pluginlist_formatted",
"=",
"\", \"",
".",
"join",
"(",
"sorted",
"(",
"pluginlist",
")",
")",
"if",
"console"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | authenticate_twitch_oauth | Opens a web browser to allow the user to grant Streamlink
access to their Twitch account. | src/streamlink_cli/main.py | def authenticate_twitch_oauth():
"""Opens a web browser to allow the user to grant Streamlink
access to their Twitch account."""
client_id = TWITCH_CLIENT_ID
redirect_uri = "https://streamlink.github.io/twitch_oauth.html"
url = ("https://api.twitch.tv/kraken/oauth2/authorize"
"?respon... | def authenticate_twitch_oauth():
"""Opens a web browser to allow the user to grant Streamlink
access to their Twitch account."""
client_id = TWITCH_CLIENT_ID
redirect_uri = "https://streamlink.github.io/twitch_oauth.html"
url = ("https://api.twitch.tv/kraken/oauth2/authorize"
"?respon... | [
"Opens",
"a",
"web",
"browser",
"to",
"allow",
"the",
"user",
"to",
"grant",
"Streamlink",
"access",
"to",
"their",
"Twitch",
"account",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L626-L647 | [
"def",
"authenticate_twitch_oauth",
"(",
")",
":",
"client_id",
"=",
"TWITCH_CLIENT_ID",
"redirect_uri",
"=",
"\"https://streamlink.github.io/twitch_oauth.html\"",
"url",
"=",
"(",
"\"https://api.twitch.tv/kraken/oauth2/authorize\"",
"\"?response_type=token\"",
"\"&client_id={0}\"",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | load_plugins | Attempts to load plugins from a list of directories. | src/streamlink_cli/main.py | def load_plugins(dirs):
"""Attempts to load plugins from a list of directories."""
dirs = [os.path.expanduser(d) for d in dirs]
for directory in dirs:
if os.path.isdir(directory):
streamlink.load_plugins(directory)
else:
log.warning("Plugin path {0} does not exist o... | def load_plugins(dirs):
"""Attempts to load plugins from a list of directories."""
dirs = [os.path.expanduser(d) for d in dirs]
for directory in dirs:
if os.path.isdir(directory):
streamlink.load_plugins(directory)
else:
log.warning("Plugin path {0} does not exist o... | [
"Attempts",
"to",
"load",
"plugins",
"from",
"a",
"list",
"of",
"directories",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L650-L660 | [
"def",
"load_plugins",
"(",
"dirs",
")",
":",
"dirs",
"=",
"[",
"os",
".",
"path",
".",
"expanduser",
"(",
"d",
")",
"for",
"d",
"in",
"dirs",
"]",
"for",
"directory",
"in",
"dirs",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"directory",
")... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | setup_args | Parses arguments. | src/streamlink_cli/main.py | def setup_args(parser, config_files=[], ignore_unknown=False):
"""Parses arguments."""
global args
arglist = sys.argv[1:]
# Load arguments from config files
for config_file in filter(os.path.isfile, config_files):
arglist.insert(0, "@" + config_file)
args, unknown = parser.parse_known_... | def setup_args(parser, config_files=[], ignore_unknown=False):
"""Parses arguments."""
global args
arglist = sys.argv[1:]
# Load arguments from config files
for config_file in filter(os.path.isfile, config_files):
arglist.insert(0, "@" + config_file)
args, unknown = parser.parse_known_... | [
"Parses",
"arguments",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L663-L682 | [
"def",
"setup_args",
"(",
"parser",
",",
"config_files",
"=",
"[",
"]",
",",
"ignore_unknown",
"=",
"False",
")",
":",
"global",
"args",
"arglist",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"# Load arguments from config files",
"for",
"config_file",
"in",... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | setup_console | Console setup. | src/streamlink_cli/main.py | def setup_console(output):
"""Console setup."""
global console
# All console related operations is handled via the ConsoleOutput class
console = ConsoleOutput(output, streamlink)
console.json = args.json
# Handle SIGTERM just like SIGINT
signal.signal(signal.SIGTERM, signal.default_int_han... | def setup_console(output):
"""Console setup."""
global console
# All console related operations is handled via the ConsoleOutput class
console = ConsoleOutput(output, streamlink)
console.json = args.json
# Handle SIGTERM just like SIGINT
signal.signal(signal.SIGTERM, signal.default_int_han... | [
"Console",
"setup",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L706-L715 | [
"def",
"setup_console",
"(",
"output",
")",
":",
"global",
"console",
"# All console related operations is handled via the ConsoleOutput class",
"console",
"=",
"ConsoleOutput",
"(",
"output",
",",
"streamlink",
")",
"console",
".",
"json",
"=",
"args",
".",
"json",
"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | setup_http_session | Sets the global HTTP settings, such as proxy and headers. | src/streamlink_cli/main.py | def setup_http_session():
"""Sets the global HTTP settings, such as proxy and headers."""
if args.http_proxy:
streamlink.set_option("http-proxy", args.http_proxy)
if args.https_proxy:
streamlink.set_option("https-proxy", args.https_proxy)
if args.http_cookie:
streamlink.set_opt... | def setup_http_session():
"""Sets the global HTTP settings, such as proxy and headers."""
if args.http_proxy:
streamlink.set_option("http-proxy", args.http_proxy)
if args.https_proxy:
streamlink.set_option("https-proxy", args.https_proxy)
if args.http_cookie:
streamlink.set_opt... | [
"Sets",
"the",
"global",
"HTTP",
"settings",
"such",
"as",
"proxy",
"and",
"headers",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L718-L760 | [
"def",
"setup_http_session",
"(",
")",
":",
"if",
"args",
".",
"http_proxy",
":",
"streamlink",
".",
"set_option",
"(",
"\"http-proxy\"",
",",
"args",
".",
"http_proxy",
")",
"if",
"args",
".",
"https_proxy",
":",
"streamlink",
".",
"set_option",
"(",
"\"htt... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | setup_plugins | Loads any additional plugins. | src/streamlink_cli/main.py | def setup_plugins(extra_plugin_dir=None):
"""Loads any additional plugins."""
if os.path.isdir(PLUGINS_DIR):
load_plugins([PLUGINS_DIR])
if extra_plugin_dir:
load_plugins(extra_plugin_dir) | def setup_plugins(extra_plugin_dir=None):
"""Loads any additional plugins."""
if os.path.isdir(PLUGINS_DIR):
load_plugins([PLUGINS_DIR])
if extra_plugin_dir:
load_plugins(extra_plugin_dir) | [
"Loads",
"any",
"additional",
"plugins",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L763-L769 | [
"def",
"setup_plugins",
"(",
"extra_plugin_dir",
"=",
"None",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"PLUGINS_DIR",
")",
":",
"load_plugins",
"(",
"[",
"PLUGINS_DIR",
"]",
")",
"if",
"extra_plugin_dir",
":",
"load_plugins",
"(",
"extra_plugin_... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | setup_options | Sets Streamlink options. | src/streamlink_cli/main.py | def setup_options():
"""Sets Streamlink options."""
if args.hls_live_edge:
streamlink.set_option("hls-live-edge", args.hls_live_edge)
if args.hls_segment_attempts:
streamlink.set_option("hls-segment-attempts", args.hls_segment_attempts)
if args.hls_playlist_reload_attempts:
str... | def setup_options():
"""Sets Streamlink options."""
if args.hls_live_edge:
streamlink.set_option("hls-live-edge", args.hls_live_edge)
if args.hls_segment_attempts:
streamlink.set_option("hls-segment-attempts", args.hls_segment_attempts)
if args.hls_playlist_reload_attempts:
str... | [
"Sets",
"Streamlink",
"options",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L779-L872 | [
"def",
"setup_options",
"(",
")",
":",
"if",
"args",
".",
"hls_live_edge",
":",
"streamlink",
".",
"set_option",
"(",
"\"hls-live-edge\"",
",",
"args",
".",
"hls_live_edge",
")",
"if",
"args",
".",
"hls_segment_attempts",
":",
"streamlink",
".",
"set_option",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | setup_plugin_args | Sets Streamlink plugin options. | src/streamlink_cli/main.py | def setup_plugin_args(session, parser):
"""Sets Streamlink plugin options."""
plugin_args = parser.add_argument_group("Plugin options")
for pname, plugin in session.plugins.items():
defaults = {}
for parg in plugin.arguments:
plugin_args.add_argument(parg.argument_name(pname), *... | def setup_plugin_args(session, parser):
"""Sets Streamlink plugin options."""
plugin_args = parser.add_argument_group("Plugin options")
for pname, plugin in session.plugins.items():
defaults = {}
for parg in plugin.arguments:
plugin_args.add_argument(parg.argument_name(pname), *... | [
"Sets",
"Streamlink",
"plugin",
"options",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L875-L885 | [
"def",
"setup_plugin_args",
"(",
"session",
",",
"parser",
")",
":",
"plugin_args",
"=",
"parser",
".",
"add_argument_group",
"(",
"\"Plugin options\"",
")",
"for",
"pname",
",",
"plugin",
"in",
"session",
".",
"plugins",
".",
"items",
"(",
")",
":",
"defaul... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | setup_plugin_options | Sets Streamlink plugin options. | src/streamlink_cli/main.py | def setup_plugin_options(session, plugin):
"""Sets Streamlink plugin options."""
pname = plugin.module
required = OrderedDict({})
for parg in plugin.arguments:
if parg.options.get("help") != argparse.SUPPRESS:
if parg.required:
required[parg.name] = parg
v... | def setup_plugin_options(session, plugin):
"""Sets Streamlink plugin options."""
pname = plugin.module
required = OrderedDict({})
for parg in plugin.arguments:
if parg.options.get("help") != argparse.SUPPRESS:
if parg.required:
required[parg.name] = parg
v... | [
"Sets",
"Streamlink",
"plugin",
"options",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L888-L914 | [
"def",
"setup_plugin_options",
"(",
"session",
",",
"plugin",
")",
":",
"pname",
"=",
"plugin",
".",
"module",
"required",
"=",
"OrderedDict",
"(",
"{",
"}",
")",
"for",
"parg",
"in",
"plugin",
".",
"arguments",
":",
"if",
"parg",
".",
"options",
".",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | log_current_versions | Show current installed versions | src/streamlink_cli/main.py | def log_current_versions():
"""Show current installed versions"""
if logger.root.isEnabledFor(logging.DEBUG):
# MAC OS X
if sys.platform == "darwin":
os_version = "macOS {0}".format(platform.mac_ver()[0])
# Windows
elif sys.platform.startswith("win"):
os_v... | def log_current_versions():
"""Show current installed versions"""
if logger.root.isEnabledFor(logging.DEBUG):
# MAC OS X
if sys.platform == "darwin":
os_version = "macOS {0}".format(platform.mac_ver()[0])
# Windows
elif sys.platform.startswith("win"):
os_v... | [
"Show",
"current",
"installed",
"versions"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/main.py#L923-L940 | [
"def",
"log_current_versions",
"(",
")",
":",
"if",
"logger",
".",
"root",
".",
"isEnabledFor",
"(",
"logging",
".",
"DEBUG",
")",
":",
"# MAC OS X",
"if",
"sys",
".",
"platform",
"==",
"\"darwin\"",
":",
"os_version",
"=",
"\"macOS {0}\"",
".",
"format",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Viasat._get_stream_id | Try to find a stream_id | src/streamlink/plugins/viasat.py | def _get_stream_id(self, text):
"""Try to find a stream_id"""
m = self._image_re.search(text)
if m:
return m.group("stream_id") | def _get_stream_id(self, text):
"""Try to find a stream_id"""
m = self._image_re.search(text)
if m:
return m.group("stream_id") | [
"Try",
"to",
"find",
"a",
"stream_id"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/viasat.py#L121-L125 | [
"def",
"_get_stream_id",
"(",
"self",
",",
"text",
")",
":",
"m",
"=",
"self",
".",
"_image_re",
".",
"search",
"(",
"text",
")",
"if",
"m",
":",
"return",
"m",
".",
"group",
"(",
"\"stream_id\"",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Viasat._get_iframe | Fallback if no stream_id was found before | src/streamlink/plugins/viasat.py | def _get_iframe(self, text):
"""Fallback if no stream_id was found before"""
m = self._iframe_re.search(text)
if m:
return self.session.streams(m.group("url")) | def _get_iframe(self, text):
"""Fallback if no stream_id was found before"""
m = self._iframe_re.search(text)
if m:
return self.session.streams(m.group("url")) | [
"Fallback",
"if",
"no",
"stream_id",
"was",
"found",
"before"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/viasat.py#L127-L131 | [
"def",
"_get_iframe",
"(",
"self",
",",
"text",
")",
":",
"m",
"=",
"self",
".",
"_iframe_re",
".",
"search",
"(",
"text",
")",
"if",
"m",
":",
"return",
"self",
".",
"session",
".",
"streams",
"(",
"m",
".",
"group",
"(",
"\"url\"",
")",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streamlink.set_option | Sets general options used by plugins and streams originating
from this session object.
:param key: key of the option
:param value: value to set the option to
**Available options**:
======================== =========================================
hds-live-edge ... | src/streamlink/session.py | def set_option(self, key, value):
"""Sets general options used by plugins and streams originating
from this session object.
:param key: key of the option
:param value: value to set the option to
**Available options**:
======================== =========================... | def set_option(self, key, value):
"""Sets general options used by plugins and streams originating
from this session object.
:param key: key of the option
:param value: value to set the option to
**Available options**:
======================== =========================... | [
"Sets",
"general",
"options",
"used",
"by",
"plugins",
"and",
"streams",
"originating",
"from",
"this",
"session",
"object",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L98-L295 | [
"def",
"set_option",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"# Backwards compatibility",
"if",
"key",
"==",
"\"rtmpdump\"",
":",
"key",
"=",
"\"rtmp-rtmpdump\"",
"elif",
"key",
"==",
"\"rtmpdump-proxy\"",
":",
"key",
"=",
"\"rtmp-proxy\"",
"elif",
"k... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streamlink.get_option | Returns current value of specified option.
:param key: key of the option | src/streamlink/session.py | def get_option(self, key):
"""Returns current value of specified option.
:param key: key of the option
"""
# Backwards compatibility
if key == "rtmpdump":
key = "rtmp-rtmpdump"
elif key == "rtmpdump-proxy":
key = "rtmp-proxy"
elif key == ... | def get_option(self, key):
"""Returns current value of specified option.
:param key: key of the option
"""
# Backwards compatibility
if key == "rtmpdump":
key = "rtmp-rtmpdump"
elif key == "rtmpdump-proxy":
key = "rtmp-proxy"
elif key == ... | [
"Returns",
"current",
"value",
"of",
"specified",
"option",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L297-L330 | [
"def",
"get_option",
"(",
"self",
",",
"key",
")",
":",
"# Backwards compatibility",
"if",
"key",
"==",
"\"rtmpdump\"",
":",
"key",
"=",
"\"rtmp-rtmpdump\"",
"elif",
"key",
"==",
"\"rtmpdump-proxy\"",
":",
"key",
"=",
"\"rtmp-proxy\"",
"elif",
"key",
"==",
"\"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streamlink.set_plugin_option | Sets plugin specific options used by plugins originating
from this session object.
:param plugin: name of the plugin
:param key: key of the option
:param value: value to set the option to | src/streamlink/session.py | def set_plugin_option(self, plugin, key, value):
"""Sets plugin specific options used by plugins originating
from this session object.
:param plugin: name of the plugin
:param key: key of the option
:param value: value to set the option to
"""
if plugin in self... | def set_plugin_option(self, plugin, key, value):
"""Sets plugin specific options used by plugins originating
from this session object.
:param plugin: name of the plugin
:param key: key of the option
:param value: value to set the option to
"""
if plugin in self... | [
"Sets",
"plugin",
"specific",
"options",
"used",
"by",
"plugins",
"originating",
"from",
"this",
"session",
"object",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L332-L344 | [
"def",
"set_plugin_option",
"(",
"self",
",",
"plugin",
",",
"key",
",",
"value",
")",
":",
"if",
"plugin",
"in",
"self",
".",
"plugins",
":",
"plugin",
"=",
"self",
".",
"plugins",
"[",
"plugin",
"]",
"plugin",
".",
"set_option",
"(",
"key",
",",
"v... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streamlink.get_plugin_option | Returns current value of plugin specific option.
:param plugin: name of the plugin
:param key: key of the option | src/streamlink/session.py | def get_plugin_option(self, plugin, key):
"""Returns current value of plugin specific option.
:param plugin: name of the plugin
:param key: key of the option
"""
if plugin in self.plugins:
plugin = self.plugins[plugin]
return plugin.get_option(key) | def get_plugin_option(self, plugin, key):
"""Returns current value of plugin specific option.
:param plugin: name of the plugin
:param key: key of the option
"""
if plugin in self.plugins:
plugin = self.plugins[plugin]
return plugin.get_option(key) | [
"Returns",
"current",
"value",
"of",
"plugin",
"specific",
"option",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L346-L356 | [
"def",
"get_plugin_option",
"(",
"self",
",",
"plugin",
",",
"key",
")",
":",
"if",
"plugin",
"in",
"self",
".",
"plugins",
":",
"plugin",
"=",
"self",
".",
"plugins",
"[",
"plugin",
"]",
"return",
"plugin",
".",
"get_option",
"(",
"key",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streamlink.resolve_url | Attempts to find a plugin that can use this URL.
The default protocol (http) will be prefixed to the URL if
not specified.
Raises :exc:`NoPluginError` on failure.
:param url: a URL to match against loaded plugins
:param follow_redirect: follow redirects | src/streamlink/session.py | def resolve_url(self, url, follow_redirect=True):
"""Attempts to find a plugin that can use this URL.
The default protocol (http) will be prefixed to the URL if
not specified.
Raises :exc:`NoPluginError` on failure.
:param url: a URL to match against loaded plugins
:pa... | def resolve_url(self, url, follow_redirect=True):
"""Attempts to find a plugin that can use this URL.
The default protocol (http) will be prefixed to the URL if
not specified.
Raises :exc:`NoPluginError` on failure.
:param url: a URL to match against loaded plugins
:pa... | [
"Attempts",
"to",
"find",
"a",
"plugin",
"that",
"can",
"use",
"this",
"URL",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L378-L415 | [
"def",
"resolve_url",
"(",
"self",
",",
"url",
",",
"follow_redirect",
"=",
"True",
")",
":",
"url",
"=",
"update_scheme",
"(",
"\"http://\"",
",",
"url",
")",
"available_plugins",
"=",
"[",
"]",
"for",
"name",
",",
"plugin",
"in",
"self",
".",
"plugins"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streamlink.streams | Attempts to find a plugin and extract streams from the *url*.
*params* are passed to :func:`Plugin.streams`.
Raises :exc:`NoPluginError` if no plugin is found. | src/streamlink/session.py | def streams(self, url, **params):
"""Attempts to find a plugin and extract streams from the *url*.
*params* are passed to :func:`Plugin.streams`.
Raises :exc:`NoPluginError` if no plugin is found.
"""
plugin = self.resolve_url(url)
return plugin.streams(**params) | def streams(self, url, **params):
"""Attempts to find a plugin and extract streams from the *url*.
*params* are passed to :func:`Plugin.streams`.
Raises :exc:`NoPluginError` if no plugin is found.
"""
plugin = self.resolve_url(url)
return plugin.streams(**params) | [
"Attempts",
"to",
"find",
"a",
"plugin",
"and",
"extract",
"streams",
"from",
"the",
"*",
"url",
"*",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L430-L439 | [
"def",
"streams",
"(",
"self",
",",
"url",
",",
"*",
"*",
"params",
")",
":",
"plugin",
"=",
"self",
".",
"resolve_url",
"(",
"url",
")",
"return",
"plugin",
".",
"streams",
"(",
"*",
"*",
"params",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Streamlink.load_plugins | Attempt to load plugins from the path specified.
:param path: full path to a directory where to look for plugins | src/streamlink/session.py | def load_plugins(self, path):
"""Attempt to load plugins from the path specified.
:param path: full path to a directory where to look for plugins
"""
for loader, name, ispkg in pkgutil.iter_modules([path]):
file, pathname, desc = imp.find_module(name, [path])
# ... | def load_plugins(self, path):
"""Attempt to load plugins from the path specified.
:param path: full path to a directory where to look for plugins
"""
for loader, name, ispkg in pkgutil.iter_modules([path]):
file, pathname, desc = imp.find_module(name, [path])
# ... | [
"Attempt",
"to",
"load",
"plugins",
"from",
"the",
"path",
"specified",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/session.py#L449-L466 | [
"def",
"load_plugins",
"(",
"self",
",",
"path",
")",
":",
"for",
"loader",
",",
"name",
",",
"ispkg",
"in",
"pkgutil",
".",
"iter_modules",
"(",
"[",
"path",
"]",
")",
":",
"file",
",",
"pathname",
",",
"desc",
"=",
"imp",
".",
"find_module",
"(",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | OneTV.vod_data | Get the VOD data path and the default VOD ID
:return: | src/streamlink/plugins/onetv.py | def vod_data(self, vid=None):
"""
Get the VOD data path and the default VOD ID
:return:
"""
page = self.session.http.get(self.url)
m = self._vod_re.search(page.text)
vod_data_url = m and urljoin(self.url, m.group(0))
if vod_data_url:
self.logge... | def vod_data(self, vid=None):
"""
Get the VOD data path and the default VOD ID
:return:
"""
page = self.session.http.get(self.url)
m = self._vod_re.search(page.text)
vod_data_url = m and urljoin(self.url, m.group(0))
if vod_data_url:
self.logge... | [
"Get",
"the",
"VOD",
"data",
"path",
"and",
"the",
"default",
"VOD",
"ID",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/onetv.py#L58-L69 | [
"def",
"vod_data",
"(",
"self",
",",
"vid",
"=",
"None",
")",
":",
"page",
"=",
"self",
".",
"session",
".",
"http",
".",
"get",
"(",
"self",
".",
"url",
")",
"m",
"=",
"self",
".",
"_vod_re",
".",
"search",
"(",
"page",
".",
"text",
")",
"vod_... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | hours_minutes_seconds | converts a timestamp to seconds
- hours:minutes:seconds to seconds
- minutes:seconds to seconds
- 11h22m33s to seconds
- 11h to seconds
- 20h15m to seconds
- seconds to seconds
:param value: hh:mm:ss ; 00h00m00s ; seconds
:return: seconds | src/streamlink/utils/times.py | def hours_minutes_seconds(value):
"""converts a timestamp to seconds
- hours:minutes:seconds to seconds
- minutes:seconds to seconds
- 11h22m33s to seconds
- 11h to seconds
- 20h15m to seconds
- seconds to seconds
:param value: hh:mm:ss ; 00h00m00s ; seconds
:return: se... | def hours_minutes_seconds(value):
"""converts a timestamp to seconds
- hours:minutes:seconds to seconds
- minutes:seconds to seconds
- 11h22m33s to seconds
- 11h to seconds
- 20h15m to seconds
- seconds to seconds
:param value: hh:mm:ss ; 00h00m00s ; seconds
:return: se... | [
"converts",
"a",
"timestamp",
"to",
"seconds"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/times.py#L20-L48 | [
"def",
"hours_minutes_seconds",
"(",
"value",
")",
":",
"try",
":",
"return",
"int",
"(",
"value",
")",
"except",
"ValueError",
":",
"pass",
"match",
"=",
"(",
"_hours_minutes_seconds_re",
".",
"match",
"(",
"value",
")",
"or",
"_hours_minutes_seconds_2_re",
"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | length | Checks value for minimum length using len(). | src/streamlink/plugin/api/validate.py | def length(length):
"""Checks value for minimum length using len()."""
def min_len(value):
if not len(value) >= length:
raise ValueError(
"Minimum length is {0} but value is {1}".format(length, len(value))
)
return True
return min_len | def length(length):
"""Checks value for minimum length using len()."""
def min_len(value):
if not len(value) >= length:
raise ValueError(
"Minimum length is {0} but value is {1}".format(length, len(value))
)
return True
return min_len | [
"Checks",
"value",
"for",
"minimum",
"length",
"using",
"len",
"()",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L109-L118 | [
"def",
"length",
"(",
"length",
")",
":",
"def",
"min_len",
"(",
"value",
")",
":",
"if",
"not",
"len",
"(",
"value",
")",
">=",
"length",
":",
"raise",
"ValueError",
"(",
"\"Minimum length is {0} but value is {1}\"",
".",
"format",
"(",
"length",
",",
"le... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | startswith | Checks if the string value starts with another string. | src/streamlink/plugin/api/validate.py | def startswith(string):
"""Checks if the string value starts with another string."""
def starts_with(value):
validate(text, value)
if not value.startswith(string):
raise ValueError("'{0}' does not start with '{1}'".format(value, string))
return True
return starts_with | def startswith(string):
"""Checks if the string value starts with another string."""
def starts_with(value):
validate(text, value)
if not value.startswith(string):
raise ValueError("'{0}' does not start with '{1}'".format(value, string))
return True
return starts_with | [
"Checks",
"if",
"the",
"string",
"value",
"starts",
"with",
"another",
"string",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L121-L129 | [
"def",
"startswith",
"(",
"string",
")",
":",
"def",
"starts_with",
"(",
"value",
")",
":",
"validate",
"(",
"text",
",",
"value",
")",
"if",
"not",
"value",
".",
"startswith",
"(",
"string",
")",
":",
"raise",
"ValueError",
"(",
"\"'{0}' does not start wi... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | endswith | Checks if the string value ends with another string. | src/streamlink/plugin/api/validate.py | def endswith(string):
"""Checks if the string value ends with another string."""
def ends_with(value):
validate(text, value)
if not value.endswith(string):
raise ValueError("'{0}' does not end with '{1}'".format(value, string))
return True
return ends_with | def endswith(string):
"""Checks if the string value ends with another string."""
def ends_with(value):
validate(text, value)
if not value.endswith(string):
raise ValueError("'{0}' does not end with '{1}'".format(value, string))
return True
return ends_with | [
"Checks",
"if",
"the",
"string",
"value",
"ends",
"with",
"another",
"string",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L132-L140 | [
"def",
"endswith",
"(",
"string",
")",
":",
"def",
"ends_with",
"(",
"value",
")",
":",
"validate",
"(",
"text",
",",
"value",
")",
"if",
"not",
"value",
".",
"endswith",
"(",
"string",
")",
":",
"raise",
"ValueError",
"(",
"\"'{0}' does not end with '{1}'... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | contains | Checks if the string value contains another string. | src/streamlink/plugin/api/validate.py | def contains(string):
"""Checks if the string value contains another string."""
def contains_str(value):
validate(text, value)
if string not in value:
raise ValueError("'{0}' does not contain '{1}'".format(value, string))
return True
return contains_str | def contains(string):
"""Checks if the string value contains another string."""
def contains_str(value):
validate(text, value)
if string not in value:
raise ValueError("'{0}' does not contain '{1}'".format(value, string))
return True
return contains_str | [
"Checks",
"if",
"the",
"string",
"value",
"contains",
"another",
"string",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L143-L151 | [
"def",
"contains",
"(",
"string",
")",
":",
"def",
"contains_str",
"(",
"value",
")",
":",
"validate",
"(",
"text",
",",
"value",
")",
"if",
"string",
"not",
"in",
"value",
":",
"raise",
"ValueError",
"(",
"\"'{0}' does not contain '{1}'\"",
".",
"format",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | get | Get item from value (value[item]).
If the item is not found, return the default.
Handles XML elements, regex matches and anything that has __getitem__. | src/streamlink/plugin/api/validate.py | def get(item, default=None):
"""Get item from value (value[item]).
If the item is not found, return the default.
Handles XML elements, regex matches and anything that has __getitem__.
"""
def getter(value):
if ET.iselement(value):
value = value.attrib
try:
... | def get(item, default=None):
"""Get item from value (value[item]).
If the item is not found, return the default.
Handles XML elements, regex matches and anything that has __getitem__.
"""
def getter(value):
if ET.iselement(value):
value = value.attrib
try:
... | [
"Get",
"item",
"from",
"value",
"(",
"value",
"[",
"item",
"]",
")",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L154-L177 | [
"def",
"get",
"(",
"item",
",",
"default",
"=",
"None",
")",
":",
"def",
"getter",
"(",
"value",
")",
":",
"if",
"ET",
".",
"iselement",
"(",
"value",
")",
":",
"value",
"=",
"value",
".",
"attrib",
"try",
":",
"# Use .group() if this is a regex match ob... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | getattr | Get a named attribute from an object.
When a default argument is given, it is returned when the attribute
doesn't exist. | src/streamlink/plugin/api/validate.py | def getattr(attr, default=None):
"""Get a named attribute from an object.
When a default argument is given, it is returned when the attribute
doesn't exist.
"""
def getter(value):
return _getattr(value, attr, default)
return transform(getter) | def getattr(attr, default=None):
"""Get a named attribute from an object.
When a default argument is given, it is returned when the attribute
doesn't exist.
"""
def getter(value):
return _getattr(value, attr, default)
return transform(getter) | [
"Get",
"a",
"named",
"attribute",
"from",
"an",
"object",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L180-L189 | [
"def",
"getattr",
"(",
"attr",
",",
"default",
"=",
"None",
")",
":",
"def",
"getter",
"(",
"value",
")",
":",
"return",
"_getattr",
"(",
"value",
",",
"attr",
",",
"default",
")",
"return",
"transform",
"(",
"getter",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | filter | Filters out unwanted items using the specified function.
Supports both dicts and sequences, key/value pairs are
expanded when applied to a dict. | src/streamlink/plugin/api/validate.py | def filter(func):
"""Filters out unwanted items using the specified function.
Supports both dicts and sequences, key/value pairs are
expanded when applied to a dict.
"""
def expand_kv(kv):
return func(*kv)
def filter_values(value):
cls = type(value)
if isinstance(value,... | def filter(func):
"""Filters out unwanted items using the specified function.
Supports both dicts and sequences, key/value pairs are
expanded when applied to a dict.
"""
def expand_kv(kv):
return func(*kv)
def filter_values(value):
cls = type(value)
if isinstance(value,... | [
"Filters",
"out",
"unwanted",
"items",
"using",
"the",
"specified",
"function",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L200-L216 | [
"def",
"filter",
"(",
"func",
")",
":",
"def",
"expand_kv",
"(",
"kv",
")",
":",
"return",
"func",
"(",
"*",
"kv",
")",
"def",
"filter_values",
"(",
"value",
")",
":",
"cls",
"=",
"type",
"(",
"value",
")",
"if",
"isinstance",
"(",
"value",
",",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | map | Apply function to each value inside the sequence or dict.
Supports both dicts and sequences, key/value pairs are
expanded when applied to a dict. | src/streamlink/plugin/api/validate.py | def map(func):
"""Apply function to each value inside the sequence or dict.
Supports both dicts and sequences, key/value pairs are
expanded when applied to a dict.
"""
# text is an alias for basestring on Python 2, which cannot be
# instantiated and therefore can't be used to transform the valu... | def map(func):
"""Apply function to each value inside the sequence or dict.
Supports both dicts and sequences, key/value pairs are
expanded when applied to a dict.
"""
# text is an alias for basestring on Python 2, which cannot be
# instantiated and therefore can't be used to transform the valu... | [
"Apply",
"function",
"to",
"each",
"value",
"inside",
"the",
"sequence",
"or",
"dict",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L219-L241 | [
"def",
"map",
"(",
"func",
")",
":",
"# text is an alias for basestring on Python 2, which cannot be",
"# instantiated and therefore can't be used to transform the value,",
"# so we force to unicode instead.",
"if",
"is_py2",
"and",
"text",
"==",
"func",
":",
"func",
"=",
"unicod... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | url | Parses an URL and validates its attributes. | src/streamlink/plugin/api/validate.py | def url(**attributes):
"""Parses an URL and validates its attributes."""
def check_url(value):
validate(text, value)
parsed = urlparse(value)
if not parsed.netloc:
raise ValueError("'{0}' is not a valid URL".format(value))
for name, schema in attributes.items():
... | def url(**attributes):
"""Parses an URL and validates its attributes."""
def check_url(value):
validate(text, value)
parsed = urlparse(value)
if not parsed.netloc:
raise ValueError("'{0}' is not a valid URL".format(value))
for name, schema in attributes.items():
... | [
"Parses",
"an",
"URL",
"and",
"validates",
"its",
"attributes",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L244-L271 | [
"def",
"url",
"(",
"*",
"*",
"attributes",
")",
":",
"def",
"check_url",
"(",
"value",
")",
":",
"validate",
"(",
"text",
",",
"value",
")",
"parsed",
"=",
"urlparse",
"(",
"value",
")",
"if",
"not",
"parsed",
".",
"netloc",
":",
"raise",
"ValueError... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | xml_find | Find a XML element via xpath. | src/streamlink/plugin/api/validate.py | def xml_find(xpath):
"""Find a XML element via xpath."""
def xpath_find(value):
validate(ET.iselement, value)
value = value.find(xpath)
if value is None:
raise ValueError("XPath '{0}' did not return an element".format(xpath))
return validate(ET.iselement, value)
... | def xml_find(xpath):
"""Find a XML element via xpath."""
def xpath_find(value):
validate(ET.iselement, value)
value = value.find(xpath)
if value is None:
raise ValueError("XPath '{0}' did not return an element".format(xpath))
return validate(ET.iselement, value)
... | [
"Find",
"a",
"XML",
"element",
"via",
"xpath",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L274-L284 | [
"def",
"xml_find",
"(",
"xpath",
")",
":",
"def",
"xpath_find",
"(",
"value",
")",
":",
"validate",
"(",
"ET",
".",
"iselement",
",",
"value",
")",
"value",
"=",
"value",
".",
"find",
"(",
"xpath",
")",
"if",
"value",
"is",
"None",
":",
"raise",
"V... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | xml_findall | Find a list of XML elements via xpath. | src/streamlink/plugin/api/validate.py | def xml_findall(xpath):
"""Find a list of XML elements via xpath."""
def xpath_findall(value):
validate(ET.iselement, value)
return value.findall(xpath)
return transform(xpath_findall) | def xml_findall(xpath):
"""Find a list of XML elements via xpath."""
def xpath_findall(value):
validate(ET.iselement, value)
return value.findall(xpath)
return transform(xpath_findall) | [
"Find",
"a",
"list",
"of",
"XML",
"elements",
"via",
"xpath",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugin/api/validate.py#L287-L293 | [
"def",
"xml_findall",
"(",
"xpath",
")",
":",
"def",
"xpath_findall",
"(",
"value",
")",
":",
"validate",
"(",
"ET",
".",
"iselement",
",",
"value",
")",
"return",
"value",
".",
"findall",
"(",
"xpath",
")",
"return",
"transform",
"(",
"xpath_findall",
"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | _find_playlist_info | Finds playlist info (type, id) in HTTP response.
:param response: Response object.
:returns: Dictionary with type and id. | src/streamlink/plugins/ceskatelevize.py | def _find_playlist_info(response):
"""
Finds playlist info (type, id) in HTTP response.
:param response: Response object.
:returns: Dictionary with type and id.
"""
values = {}
matches = _playlist_info_re.search(response.text)
if matches:
values['type'] = matches.group(1)
... | def _find_playlist_info(response):
"""
Finds playlist info (type, id) in HTTP response.
:param response: Response object.
:returns: Dictionary with type and id.
"""
values = {}
matches = _playlist_info_re.search(response.text)
if matches:
values['type'] = matches.group(1)
... | [
"Finds",
"playlist",
"info",
"(",
"type",
"id",
")",
"in",
"HTTP",
"response",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/ceskatelevize.py#L54-L67 | [
"def",
"_find_playlist_info",
"(",
"response",
")",
":",
"values",
"=",
"{",
"}",
"matches",
"=",
"_playlist_info_re",
".",
"search",
"(",
"response",
".",
"text",
")",
"if",
"matches",
":",
"values",
"[",
"'type'",
"]",
"=",
"matches",
".",
"group",
"("... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | _find_player_url | Finds embedded player url in HTTP response.
:param response: Response object.
:returns: Player url (str). | src/streamlink/plugins/ceskatelevize.py | def _find_player_url(response):
"""
Finds embedded player url in HTTP response.
:param response: Response object.
:returns: Player url (str).
"""
url = ''
matches = _player_re.search(response.text)
if matches:
tmp_url = matches.group(0).replace('&', '&')
if 'hash' no... | def _find_player_url(response):
"""
Finds embedded player url in HTTP response.
:param response: Response object.
:returns: Player url (str).
"""
url = ''
matches = _player_re.search(response.text)
if matches:
tmp_url = matches.group(0).replace('&', '&')
if 'hash' no... | [
"Finds",
"embedded",
"player",
"url",
"in",
"HTTP",
"response",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/ceskatelevize.py#L70-L89 | [
"def",
"_find_player_url",
"(",
"response",
")",
":",
"url",
"=",
"''",
"matches",
"=",
"_player_re",
".",
"search",
"(",
"response",
".",
"text",
")",
"if",
"matches",
":",
"tmp_url",
"=",
"matches",
".",
"group",
"(",
"0",
")",
".",
"replace",
"(",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Euronews._get_vod_stream | Find the VOD video url
:return: video url | src/streamlink/plugins/euronews.py | def _get_vod_stream(self):
"""
Find the VOD video url
:return: video url
"""
res = self.session.http.get(self.url)
video_urls = self._re_vod.findall(res.text)
if len(video_urls):
return dict(vod=HTTPStream(self.session, video_urls[0])) | def _get_vod_stream(self):
"""
Find the VOD video url
:return: video url
"""
res = self.session.http.get(self.url)
video_urls = self._re_vod.findall(res.text)
if len(video_urls):
return dict(vod=HTTPStream(self.session, video_urls[0])) | [
"Find",
"the",
"VOD",
"video",
"url",
":",
"return",
":",
"video",
"url"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/euronews.py#L26-L34 | [
"def",
"_get_vod_stream",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"session",
".",
"http",
".",
"get",
"(",
"self",
".",
"url",
")",
"video_urls",
"=",
"self",
".",
"_re_vod",
".",
"findall",
"(",
"res",
".",
"text",
")",
"if",
"len",
"(",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Euronews._get_live_streams | Get the live stream in a particular language
:param match:
:return: | src/streamlink/plugins/euronews.py | def _get_live_streams(self, match):
"""
Get the live stream in a particular language
:param match:
:return:
"""
live_url = self._live_api_url.format(match.get("subdomain"))
live_res = self.session.http.json(self.session.http.get(live_url), schema=self._live_schema... | def _get_live_streams(self, match):
"""
Get the live stream in a particular language
:param match:
:return:
"""
live_url = self._live_api_url.format(match.get("subdomain"))
live_res = self.session.http.json(self.session.http.get(live_url), schema=self._live_schema... | [
"Get",
"the",
"live",
"stream",
"in",
"a",
"particular",
"language",
":",
"param",
"match",
":",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/euronews.py#L36-L48 | [
"def",
"_get_live_streams",
"(",
"self",
",",
"match",
")",
":",
"live_url",
"=",
"self",
".",
"_live_api_url",
".",
"format",
"(",
"match",
".",
"get",
"(",
"\"subdomain\"",
")",
")",
"live_res",
"=",
"self",
".",
"session",
".",
"http",
".",
"json",
... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Euronews._get_streams | Find the streams for euronews
:return: | src/streamlink/plugins/euronews.py | def _get_streams(self):
"""
Find the streams for euronews
:return:
"""
match = self._url_re.match(self.url).groupdict()
if match.get("path") == "live":
return self._get_live_streams(match)
else:
return self._get_vod_stream() | def _get_streams(self):
"""
Find the streams for euronews
:return:
"""
match = self._url_re.match(self.url).groupdict()
if match.get("path") == "live":
return self._get_live_streams(match)
else:
return self._get_vod_stream() | [
"Find",
"the",
"streams",
"for",
"euronews",
":",
"return",
":"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/euronews.py#L50-L60 | [
"def",
"_get_streams",
"(",
"self",
")",
":",
"match",
"=",
"self",
".",
"_url_re",
".",
"match",
"(",
"self",
".",
"url",
")",
".",
"groupdict",
"(",
")",
"if",
"match",
".",
"get",
"(",
"\"path\"",
")",
"==",
"\"live\"",
":",
"return",
"self",
".... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | load | Attempts to parse a M3U8 playlist from a string of data.
If specified, *base_uri* is the base URI that relative URIs will
be joined together with, otherwise relative URIs will be as is.
If specified, *parser* can be a M3U8Parser subclass to be used
to parse the data. | src/streamlink/stream/hls_playlist.py | def load(data, base_uri=None, parser=M3U8Parser, **kwargs):
"""Attempts to parse a M3U8 playlist from a string of data.
If specified, *base_uri* is the base URI that relative URIs will
be joined together with, otherwise relative URIs will be as is.
If specified, *parser* can be a M3U8Parser subclass t... | def load(data, base_uri=None, parser=M3U8Parser, **kwargs):
"""Attempts to parse a M3U8 playlist from a string of data.
If specified, *base_uri* is the base URI that relative URIs will
be joined together with, otherwise relative URIs will be as is.
If specified, *parser* can be a M3U8Parser subclass t... | [
"Attempts",
"to",
"parse",
"a",
"M3U8",
"playlist",
"from",
"a",
"string",
"of",
"data",
"."
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/hls_playlist.py#L306-L316 | [
"def",
"load",
"(",
"data",
",",
"base_uri",
"=",
"None",
",",
"parser",
"=",
"M3U8Parser",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"parser",
"(",
"base_uri",
",",
"*",
"*",
"kwargs",
")",
".",
"parse",
"(",
"data",
")"
] | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | PlayerOutput.supported_player | Check if the current player supports adding a title
:param cmd: command to test
:return: name of the player|None | src/streamlink_cli/output.py | def supported_player(cls, cmd):
"""
Check if the current player supports adding a title
:param cmd: command to test
:return: name of the player|None
"""
if not is_win32:
# under a POSIX system use shlex to find the actual command
# under windows t... | def supported_player(cls, cmd):
"""
Check if the current player supports adding a title
:param cmd: command to test
:return: name of the player|None
"""
if not is_win32:
# under a POSIX system use shlex to find the actual command
# under windows t... | [
"Check",
"if",
"the",
"current",
"player",
"supports",
"adding",
"a",
"title"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink_cli/output.py#L116-L132 | [
"def",
"supported_player",
"(",
"cls",
",",
"cmd",
")",
":",
"if",
"not",
"is_win32",
":",
"# under a POSIX system use shlex to find the actual command",
"# under windows this is not an issue because executables end in .exe",
"cmd",
"=",
"shlex",
".",
"split",
"(",
"cmd",
"... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | Schoolism.login | Login to the schoolism account and return the users account
:param email: (str) email for account
:param password: (str) password for account
:return: (str) users email | src/streamlink/plugins/schoolism.py | def login(self, email, password):
"""
Login to the schoolism account and return the users account
:param email: (str) email for account
:param password: (str) password for account
:return: (str) users email
"""
if self.options.get("email") and self.options.get("pa... | def login(self, email, password):
"""
Login to the schoolism account and return the users account
:param email: (str) email for account
:param password: (str) password for account
:return: (str) users email
"""
if self.options.get("email") and self.options.get("pa... | [
"Login",
"to",
"the",
"schoolism",
"account",
"and",
"return",
"the",
"users",
"account",
":",
"param",
"email",
":",
"(",
"str",
")",
"email",
"for",
"account",
":",
"param",
"password",
":",
"(",
"str",
")",
"password",
"for",
"account",
":",
"return",... | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/schoolism.py#L80-L98 | [
"def",
"login",
"(",
"self",
",",
"email",
",",
"password",
")",
":",
"if",
"self",
".",
"options",
".",
"get",
"(",
"\"email\"",
")",
"and",
"self",
".",
"options",
".",
"get",
"(",
"\"password\"",
")",
":",
"res",
"=",
"self",
".",
"session",
"."... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
test | DailyMotion.get_live_id | Get the livestream videoid from a username.
https://developer.dailymotion.com/tools/apiexplorer#/user/videos/list | src/streamlink/plugins/dailymotion.py | def get_live_id(self, username):
"""Get the livestream videoid from a username.
https://developer.dailymotion.com/tools/apiexplorer#/user/videos/list
"""
params = {
"flags": "live_onair"
}
api_user_videos = USER_INFO_URL.format(username) + "/videos"
... | def get_live_id(self, username):
"""Get the livestream videoid from a username.
https://developer.dailymotion.com/tools/apiexplorer#/user/videos/list
"""
params = {
"flags": "live_onair"
}
api_user_videos = USER_INFO_URL.format(username) + "/videos"
... | [
"Get",
"the",
"livestream",
"videoid",
"from",
"a",
"username",
".",
"https",
":",
"//",
"developer",
".",
"dailymotion",
".",
"com",
"/",
"tools",
"/",
"apiexplorer#",
"/",
"user",
"/",
"videos",
"/",
"list"
] | streamlink/streamlink | python | https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/plugins/dailymotion.py#L74-L93 | [
"def",
"get_live_id",
"(",
"self",
",",
"username",
")",
":",
"params",
"=",
"{",
"\"flags\"",
":",
"\"live_onair\"",
"}",
"api_user_videos",
"=",
"USER_INFO_URL",
".",
"format",
"(",
"username",
")",
"+",
"\"/videos\"",
"try",
":",
"res",
"=",
"self",
"."... | c8ed1daff14ac03195870238b9b900c1109dd5c1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.