Пример #1
0
 def test_decrpyt(self):
     # data generated with:
     #   echo "this is a test" | openssl enc -aes-256-cbc -pass pass:"******" -base64
     data = base64.b64decode("U2FsdGVkX18nVyJ6Y+ksOASMSHKuRoQ9b4DKHuPbyQc=")
     self.assertEqual(
         b"this is a test\n",
         decrypt_openssl(data, b"streamlink")
     )
Пример #2
0
    def _get_streams(self):
        # Get the query string
        encrypted_data = urlparse(self.url).query
        data = base64.b64decode(encrypted_data)
        # and decrypt it
        passphrase = self.passphrase()
        if passphrase:
            params = decrypt_openssl(data, passphrase)
            config = parse_qsd(params.decode("utf8"))

            return HLSStream.parse_variant_playlist(self.session,
                                                    self.stream_url.format(time=self.time,
                                                                           deviceId=self.device_id,
                                                                           token=self.get_token(**config),
                                                                           **config))
Пример #3
0
 def _get_streams(self):
     # Get the query string
     encrypted_data = urlparse(self.url).query
     data = base64.b64decode(encrypted_data)
     # and decrypt it
     passphrase = self.passphrase()
     if passphrase:
         self.logger.debug("Found passphrase")
         params = decrypt_openssl(data, passphrase)
         config = parse_qsd(params.decode("utf8"))
         hls_url = self.stream_url.format(time=self.time,
                                          deviceId=self.device_id,
                                          token=self.get_token(**config),
                                          **config)
         self.logger.debug("URL={0}".format(hls_url))
         return HLSStream.parse_variant_playlist(self.session, hls_url, headers=self._headers)
Пример #4
0
 def _get_streams(self):
     # Get the query string
     encrypted_data = urlparse(self.url).query
     data = base64.b64decode(encrypted_data)
     # and decrypt it
     passphrase = self.passphrase()
     if passphrase:
         self.logger.debug("Found passphrase")
         params = decrypt_openssl(data, passphrase)
         config = parse_qsd(params.decode("utf8"))
         hls_url = self.stream_url.format(time=self.time,
                                          deviceId=self.device_id,
                                          token=self.get_token(**config),
                                          **config)
         self.logger.debug("URL={0}".format(hls_url))
         return HLSStream.parse_variant_playlist(self.session, hls_url, headers=self._headers)
Пример #5
0
    def _get_streams(self):
        if not self.matches[0]:
            self._domain = urlparse(self.url).netloc
            iframes = self.session.http.get(
                self.url,
                schema=validate.Schema(
                    validate.parse_html(),
                    validate.xml_findall(".//iframe[@src]"),
                    validate.filter(lambda elem: urlparse(
                        elem.attrib.get("src")).netloc == "ott.streann.com")))
            if not iframes:
                log.error("Could not find 'ott.streann.com' iframe")
                return
            self.url = iframes[0].attrib.get("src")

        if not self._domain and self.get_option("url"):
            self._domain = urlparse(self.get_option("url")).netloc

        if self._domain is None:
            log.error("Missing source URL, use --streann-url")
            return

        self.session.http.headers.update({"Referer": self.url})
        # Get the query string
        encrypted_data = urlparse(self.url).query
        data = base64.b64decode(encrypted_data)
        # and decrypt it
        passphrase = self.passphrase()
        if passphrase:
            log.debug("Found passphrase")
            params = decrypt_openssl(data, passphrase)
            config = parse_qsd(params.decode("utf8"))
            log.trace("config: {0!r}".format(config))
            token = self.get_token(**config)
            if not token:
                return
            hls_url = self.stream_url.format(time=self.time,
                                             deviceId=self.device_id,
                                             token=token,
                                             **config)
            log.debug("URL={0}".format(hls_url))
            return HLSStream.parse_variant_playlist(
                self.session, hls_url, acceptable_status=(200, 403, 404, 500))
Пример #6
0
    def _get_streams(self):
        p = urlparse(self.url)
        if "ott.streann.com" != p.netloc:
            self._domain = p.netloc
            res = self.session.http.get(self.url)
            for iframe in itertags(res.text, "iframe"):
                iframe_url = html_unescape(iframe.attributes.get("src"))
                if "ott.streann.com" in iframe_url:
                    self.url = iframe_url
                    break
            else:
                log.error("Could not find 'ott.streann.com' iframe")
                return

        if not self._domain and self.get_option("url"):
            self._domain = urlparse(self.get_option("url")).netloc

        if self._domain is None:
            log.error("Missing source URL use --streann-url")
            return

        self.session.http.headers.update({"Referer": self.url})
        # Get the query string
        encrypted_data = urlparse(self.url).query
        data = base64.b64decode(encrypted_data)
        # and decrypt it
        passphrase = self.passphrase()
        if passphrase:
            log.debug("Found passphrase")
            params = decrypt_openssl(data, passphrase)
            config = parse_qsd(params.decode("utf8"))
            log.trace(f"config: {config!r}")
            token = self.get_token(**config)
            if not token:
                return
            hls_url = self.stream_url.format(time=self.time,
                                             deviceId=self.device_id,
                                             token=token,
                                             **config)
            log.debug("URL={0}".format(hls_url))
            return HLSStream.parse_variant_playlist(
                self.session, hls_url, acceptable_status=(200, 403, 404, 500))
Пример #7
0
 def test_decrpyt(self):
     # data generated with:
     #   echo "this is a test" | openssl enc -aes-256-cbc -pass pass:"******" -base64
     data = base64.b64decode("U2FsdGVkX18nVyJ6Y+ksOASMSHKuRoQ9b4DKHuPbyQc=")
     self.assertEqual(b"this is a test\n",
                      decrypt_openssl(data, b"streamlink"))