Ejemplo n.º 1
0
    def get(self, options):
        data = self.get_urldata()
        match = re.search('data-subtitlesurl = "(/.*)"', data)
        if match:
            parse = urlparse(self.url)
            subtitle = "%s://%s%s" % (parse.scheme, parse.netloc, match.group(1))
            yield subtitle_tt(subtitle)
        match = re.search(r'data-media="(.*manifest.f4m)"', data)
        if match:
            manifest_url = match.group(1)
        else:
            match = re.search(r'data-video-id="(\d+)"', data)
            if match is None:
                log.error("Can't find video id.")
                sys.exit(2)
            vid = match.group(1)
            match = re.search(r"PS_VIDEO_API_URL : '([^']*)',", data)
            if match is None:
                log.error("Can't find server address with media info")
                sys.exit(2)
            dataurl = "%smediaelement/%s" % (match.group(1), vid)
            data = json.loads(get_http_data(dataurl))
            manifest_url = data["mediaUrl"]
            options.live = data["isLive"]

        hlsurl = manifest_url.replace("/z/", "/i/").replace("manifest.f4m", "master.m3u8")
        streams = hlsparse(hlsurl)
        for n in list(streams.keys()):
            yield HLS(copy.copy(options), streams[n], n)

        manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url
        streams = hdsparse(copy.copy(options), manifest_url)
        for n in list(streams.keys()):
            yield streams[n]
Ejemplo n.º 2
0
 def get(self, options):
     match = re.search(r"urPlayer.init\((.*)\);", self.get_urldata())
     if not match:
         log.error("Can't find json info")
         sys.exit(2)
     data = match.group(1)
     jsondata = json.loads(data)
     yield subtitle_tt(jsondata["subtitles"].split(",")[0])
     basedomain = jsondata["streaming_config"]["streamer"]["redirect"]
     http = "http://%s/%s" % (basedomain, jsondata["file_html5"])
     hd = None
     if len(jsondata["file_html5_hd"]) > 0:
         http_hd = "http://%s/%s" % (basedomain, jsondata["file_html5_hd"])
         hls_hd = "%s%s" % (http_hd, jsondata["streaming_config"]["http_streaming"]["hls_file"])
         tmp = jsondata["file_html5_hd"]
         match = re.search(".*(mp[34]:.*$)", tmp)
         path_hd = match.group(1)
         hd = True
     hls = "%s%s" % (http, jsondata["streaming_config"]["http_streaming"]["hls_file"])
     rtmp = "rtmp://%s/%s" % (basedomain, jsondata["streaming_config"]["rtmp"]["application"])
     path = "mp%s:%s" % (jsondata["file_flash"][-1], jsondata["file_flash"])
     streams = hlsparse(hls)
     for n in list(streams.keys()):
         yield HLS(options, streams[n], n)
     options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], path)
     yield RTMP(options, rtmp, "480")
     if hd:
         streams = hlsparse(hls_hd)
         for n in list(streams.keys()):
             yield HLS(copy.copy(options), streams[n], n)
         options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], path_hd)
         yield RTMP(copy.copy(options), rtmp, "720")
Ejemplo n.º 3
0
    def get(self, options):
        data = self.get_urldata()
        match = re.search("data-subtitlesurl = \"(/.*)\"", data)
        if match:
            parse = urlparse(self.url)
            subtitle = "%s://%s%s" % (parse.scheme, parse.netloc,
                                      match.group(1))
            yield subtitle_tt(subtitle)

        if options.force_subtitle:
            return

        match = re.search(r'data-media="(.*manifest.f4m)"', data)
        if match:
            manifest_url = match.group(1)
        else:
            match = re.search(r'data-video-id="(\d+)"', data)
            if match is None:
                log.error("Can't find video id.")
                sys.exit(2)
            vid = match.group(1)
            match = re.search(r"PS_VIDEO_API_URL : '([^']*)',", data)
            if match is None:
                log.error("Can't find server address with media info")
                sys.exit(2)
            dataurl = "%smediaelement/%s" % (match.group(1), vid)
            data = json.loads(get_http_data(dataurl))
            manifest_url = data["mediaUrl"]
            options.live = data["isLive"]

        hlsurl = manifest_url.replace("/z/",
                                      "/i/").replace("manifest.f4m",
                                                     "master.m3u8")
        streams = hlsparse(hlsurl)
        for n in list(streams.keys()):
            yield HLS(copy.copy(options), streams[n], n)

        manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url
        streams = hdsparse(copy.copy(options), manifest_url)
        if streams:
            for n in list(streams.keys()):
                yield streams[n]
Ejemplo n.º 4
0
 def get(self, options):
     match = re.search(r"urPlayer.init\((.*)\);", self.get_urldata())
     if not match:
         log.error("Can't find json info")
         sys.exit(2)
     data = match.group(1)
     jsondata = json.loads(data)
     yield subtitle_tt(jsondata["subtitles"].split(",")[0])
     basedomain = jsondata["streaming_config"]["streamer"]["redirect"]
     http = "http://%s/%s" % (basedomain, jsondata["file_html5"])
     hd = None
     if len(jsondata["file_html5_hd"]) > 0:
         http_hd = "http://%s/%s" % (basedomain, jsondata["file_html5_hd"])
         hls_hd = "%s%s" % (http_hd, jsondata["streaming_config"]
                            ["http_streaming"]["hls_file"])
         tmp = jsondata["file_html5_hd"]
         match = re.search(".*(mp[34]:.*$)", tmp)
         path_hd = match.group(1)
         hd = True
     hls = "%s%s" % (
         http, jsondata["streaming_config"]["http_streaming"]["hls_file"])
     rtmp = "rtmp://%s/%s" % (
         basedomain, jsondata["streaming_config"]["rtmp"]["application"])
     path = "mp%s:%s" % (jsondata["file_flash"][-1], jsondata["file_flash"])
     streams = hlsparse(hls)
     for n in list(streams.keys()):
         yield HLS(options, streams[n], n)
     options.other = "-v -a %s -y %s" % (
         jsondata["streaming_config"]["rtmp"]["application"], path)
     yield RTMP(options, rtmp, "480")
     if hd:
         streams = hlsparse(hls_hd)
         for n in list(streams.keys()):
             yield HLS(copy.copy(options), streams[n], n)
         options.other = "-v -a %s -y %s" % (
             jsondata["streaming_config"]["rtmp"]["application"], path_hd)
         yield RTMP(copy.copy(options), rtmp, "720")