Example #1
0
    def _parse_stream_map(self, streammap):
        streams = []

        for stream_qs in streammap.split(","):
            stream = parse_qs(stream_qs)
            streams.append(stream)

        return streams
Example #2
0
    def _get_vod_streams(self):
        res = urlget(self.url)
        flashvars = re.search("FlashVars=\"(.+?)\"", res.text)

        if not flashvars:
            raise PluginError("Unable to find flashvars on page")

        flashvars = parse_qs(flashvars.group(1))
        for var in ("vjoinid", "conid", "leagueid"):
            if not var in flashvars:
                raise PluginError(
                    ("Missing key '{0}' in flashvars").format(var))

        streams = {}
        qualities = ["SQ", "HQ"]

        for quality in qualities:
            params = dict(leagueid=flashvars["leagueid"][0],
                          vjoinid=flashvars["vjoinid"][0],
                          conid=flashvars["conid"][0],
                          title="",
                          ref="",
                          tmpstamp=int(time.time()),
                          strLevel=quality)
            res = urlget(self.GOXVODURL, params=params, session=self.rsession)

            if res.text != "1002" and len(res.text) > 0:
                gox = self._parse_gox_file(res.text)
                entry = gox[0]

                nokey = False
                for var in ("NODEIP", "NODEID", "UNO", "USERIP"):
                    if not var in entry:
                        nokey = True

                if nokey:
                    self.logger.warning(
                        "Unable to fetch key, make sure that you have access to this VOD"
                    )
                    continue

                key = self._check_vod_key(entry["NODEIP"], entry["NODEID"],
                                          entry["UNO"], entry["USERIP"])

                streams[quality.lower()] = HTTPStream(
                    self.session,
                    gox[0]["REF"],
                    params=dict(key=key),
                    headers=self.StreamHeaders)

        return streams