How to use the streamlink.plugin.api.http.get function in streamlink

To help you get started, we’ve selected a few streamlink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github streamlink / streamlink / src / streamlink / plugins / wattv.py View on Github external
def _generate_security_token(self, type_, video_id):
        # Get timestamp
        res = http.get('http://www.wat.tv/servertime')
        timestamp = int(res.text.split('|')[0])
        timestamp_hex = format(timestamp, 'x').rjust(8, '0')

        # Player id
        player_prefix = "/{0}/{1}".format(type_, video_id)

        # Create the token
        data = (TOKEN_SECRET + player_prefix + timestamp_hex).encode('utf8')
        token = hashlib.md5(data)
        token = "{0}/{1}".format(token.hexdigest(), timestamp_hex)

        return token
github streamlink / streamlink / src / streamlink / plugins / gomexp.py View on Github external
def _get_live_cubeid(self):
        res = http.get(API_URL_APP, params=dict(mode="get_live"))
        root = http.xml(res)
        return root.findtext("./cube/cubeid")
github streamlink / streamlink / src / streamlink / plugins / streamupcom.py View on Github external
def _get_streams(self):
        res = http.get(self.url)
        if not res:
            return
        match = _hls_manifest_re.search(res.text)
        url = match.group(1)
        hls_url = "http://video-cdn.streamup.com{}".format(url)
        return HLSStream.parse_variant_playlist(self.session, hls_url)
github streamlink / streamlink / src / streamlink / plugins / daisuki.py View on Github external
rtn = http.json(res, schema=_init_schema)
        if not rtn:
            return

        init_data = parse_json(aes_decrypt(aeskey, rtn))

        parsed = urlparse(init_data["play_url"])
        if parsed.scheme != "https" or not parsed.path.startswith("/i/") or not parsed.path.endswith("/master.m3u8"):
            return
        hlsstream_url = init_data["play_url"]

        streams = HLSStream.parse_variant_playlist(self.session, hlsstream_url)

        if "caption_url" in init_data:
            if self.get_option("mux_subtitles") and FFMPEGMuxer.is_usable(self.session):
                res = http.get(init_data["caption_url"])
                srt = http.xml(res, ignore_ns=True, schema=_xml_to_srt_schema)
                subfiles = []
                metadata = {}
                for i, lang, srt in ((i, s[0], s[1]) for i, s in enumerate(srt)):
                    subfile = tempfile.TemporaryFile()
                    subfile.write(srt.encode("utf8"))
                    subfile.seek(0)
                    subfiles.append(FileStream(self.session, fileobj=subfile))
                    metadata["s:s:{0}".format(i)] = ["language={0}".format(lang)]

                for n, s in streams.items():
                    yield n, MuxedStream(self.session, s, *subfiles,
                                         maps=list(range(0, len(metadata) + 1)),
                                         metadata=metadata)
                return
            else:
github streamlink / streamlink / src / streamlink / plugins / dmcloud.py View on Github external
def _get_rtmp_stream(self, swfurl):
        res = http.get(swfurl)
        swf = swfdecompress(res.content)
        match = _rtmp_re.search(swf)
        if not match:
            return

        res = http.get(match.group(1))
        rtmp, playpath = rtmpparse(res.text)
        params = {
            "rtmp": rtmp,
            "pageUrl": self.url,
            "playpath": playpath,
            "swfUrl": swfurl,
            "live": True
        }

        return RTMPStream(self.session, params)
github streamlink / streamlink / src / streamlink / plugins / wattv.py View on Github external
def _create_streams(self, type_, video_id):
        url = self._generate_security_url(type_, video_id)
        res = http.get(url)

        return HDSStream.parse_manifest(self.session, res.text, cookies=res.cookies)
github streamlink / streamlink / src / streamlink / plugins / disney_de.py View on Github external
def _get_streams(self):
        res = http.get(self.url)
        match = (_stream_hls_re.search(res.text) or
                 _stream_data_re.search(res.text))
        if not match:
            return

        stream_url = parse_json(match.group(1))

        return HLSStream.parse_variant_playlist(self.session, stream_url)
github streamlink / streamlink / src / streamlink / plugins / bliptv.py View on Github external
def _get_streams(self):
        match = _url_re.match(self.url)
        videoid = match.group('videoid')
        get_return = http.get(VIDEO_GET_URL.format(videoid))
        json_decode = http.json(get_return)
        streams = {}
        quality_list = []
        for stream in json_decode:
            if SINGLE_VIDEO_URL.match(stream['direct_url']):
                quality_list.append(int(stream['video_bitrate']))
        if len(quality_list) == 0:
            return
        quality_dict = get_quality_dict(quality_list)
        for stream in json_decode:
            if SINGLE_VIDEO_URL.match(stream['direct_url']):
                streams[quality_dict[stream['video_bitrate']]] = HTTPStream(self.session, stream['direct_url'])
        return streams