• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python hds.hdsparse函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中svtplay_dl.fetcher.hds.hdsparse函数的典型用法代码示例。如果您正苦于以下问题:Python hdsparse函数的具体用法?Python hdsparse怎么用?Python hdsparse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了hdsparse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get

    def get(self, options):
        data = self.get_urldata()

        if self.exclude(options):
            return

        extention = False
        filename = os.path.basename(self.url[:self.url.rfind("/")-1])
        if options.output and os.path.isdir(options.output):
            options.output = os.path.join(os.path.dirname(options.output), filename)
            extention = True
        elif options.output is None:
            options.output = "%s" % filename
            extention = True

        if self.url.find(".f4m") > 0:
            if extention:
                options.output = "%s.flv" % options.output

            streams = hdsparse(options, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url)
            if streams:
                for n in list(streams.keys()):
                    yield streams[n]
        if self.url.find(".m3u8") > 0:
            streams = hlsparse(options, self.http.request("get", self.url), self.url)
            if extention:
                options.output = "%s.ts" % options.output

            for n in list(streams.keys()):
                yield streams[n]
开发者ID:Fredro,项目名称:svtplay-dl,代码行数:30,代码来源:raw.py


示例2: get

    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]
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:34,代码来源:nrk.py


示例3: get

    def get(self):
        if self.exclude():
            return

        extention = False
        filename = os.path.basename(self.url[:self.url.rfind("/")])
        if self.options.output and os.path.isdir(self.options.output):
            self.options.output = os.path.join(os.path.dirname(self.options.output), filename)
            extention = True
        elif self.options.output is None:
            self.options.output = filename
            extention = True

        streams = []
        if re.search(".f4m", self.url):
            if extention:
                self.options.output = "{0}.flv".format(self.options.output)

            streams.append(hdsparse(self.options, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url))

        if re.search(".m3u8", self.url):
            streams.append(hlsparse(self.options, self.http.request("get", self.url), self.url))

        if re.search(".mpd", self.url):
            streams.append(dashparse(self.options, self.http.request("get", self.url), self.url))

        for stream in streams:
            if stream:
                for n in list(stream.keys()):
                    yield stream[n]
开发者ID:olof,项目名称:svtplay-dl,代码行数:30,代码来源:raw.py


示例4: _get_video

    def _get_video(self, janson):

        articleid = janson["article"]["currentArticleId"]
        components = janson["articles"][articleid]["article"]["components"]
        for i in components:
            if "components" in i:
                for n in i["components"]:
                    if "type" in n and n["type"] == "video":
                        streams = hlsparse(self.options, self.http.request("get", n["videoAsset"]["streamUrls"]["hls"]),
                                           n["videoAsset"]["streamUrls"]["hls"])
                        if streams:
                            for key in list(streams.keys()):
                                yield streams[key]

            if "videoAsset" in i and "streamUrls" in i["videoAsset"]:

                streams = []
                streamUrls = i["videoAsset"]["streamUrls"]

                if "hls" in streamUrls:
                    streams.append(hlsparse(self.options, self.http.request("get", streamUrls["hls"]),
                                            streamUrls["hls"]))

                if "hds" in streamUrls:
                    streams.append(hdsparse(self.options, self.http.request("get", streamUrls["hds"],
                                                                            params={"hdcore": "3.7.0"}),
                                            streamUrls["hds"]))

                if streams:
                    for s in streams:
                        for key in list(s.keys()):
                            yield s[key]
开发者ID:olof,项目名称:svtplay-dl,代码行数:32,代码来源:aftonbladet.py


示例5: get

    def get(self, options):
        error, data = self.get_urldata()
        if error:
            log.error("Can't get the page")
            return

        if self.exclude(options):
            return

        extention = False
        filename = os.path.basename(self.url[:self.url.rfind("/")-1])
        if options.output and os.path.isdir(options.output):
            options.output = "%s/%s" % (os.path.dirname(options.output), filename)
            extention = True
        elif options.output is None:
            options.output = "%s" % filename
            extention = True

        if self.url.find(".f4m") > 0:
            if extention:
                options.output = "%s.flv" % options.output

            streams = hdsparse(copy.copy(options), self.url)
            if streams:
                for n in list(streams.keys()):
                    yield streams[n]
        if self.url.find(".m3u8") > 0:
            streams = hlsparse(self.url)
            if extention:
                options.output = "%s.ts" % options.output

            for n in list(streams.keys()):
                yield HLS(copy.copy(options), streams[n], n)
开发者ID:dapstr,项目名称:svtplay-dl,代码行数:33,代码来源:raw.py


示例6: get

    def get(self):
        data = self.get_urldata()
        match = re.search(r'data-videoid="([^"]+)"', data)
        if not match:
            parse = urlparse(self.url)
            match = re.search(r'video/(\d+)/', parse.fragment)
            if not match:
                yield ServiceError("Can't find video file for: {0}".format(self.url))
                return
        videoid = match.group(1)
        data = self.http.request("get", "http://svp.vg.no/svp/api/v1/vgtv/assets/{0}?appName=vgtv-website".format(videoid)).text
        jsondata = json.loads(data)
        self.output["title"] = jsondata["title"]

        if "hds" in jsondata["streamUrls"]:
            streams = hdsparse(self.config, self.http.request("get", jsondata["streamUrls"]["hds"], params={"hdcore": "3.7.0"}),
                               jsondata["streamUrls"]["hds"], output=self.output)
            for n in list(streams.keys()):
                yield streams[n]
        if "hls" in jsondata["streamUrls"]:
            streams = hlsparse(self.config, self.http.request("get", jsondata["streamUrls"]["hls"]),
                               jsondata["streamUrls"]["hls"], output=self.output)
            for n in list(streams.keys()):
                yield streams[n]
        if "mp4" in jsondata["streamUrls"]:
            yield HTTP(copy.copy(self.config), jsondata["streamUrls"]["mp4"], output=self.output)
开发者ID:olof,项目名称:debian-svtplay-dl,代码行数:26,代码来源:vg.py


示例7: get

    def get(self, options):
        data = self.get_urldata()

        if self.exclude(options):
            yield ServiceError("Excluding video")
            return

        match = re.search("<link rel='shortlink' href='http://www.dplay.se/\?p=(\d+)", data)
        if not match:
            yield ServiceError("Can't find video id")
            return

        data = self.http.request("get", "http://geo.dplay.se/geo.js").text
        dataj = json.loads(data)
        geo = dataj["countryCode"]
        timestamp = (int(time.time())+3600)*1000
        cookie = {"dsc-geo": quote('{"countryCode":"%s","expiry":%s}' % (geo, timestamp))}
        data = self.http.request("get", "https://secure.dplay.se/secure/api/v2/user/authorization/stream/%s?stream_type=hds" % match.group(1), cookies=cookie)
        dataj = json.loads(data.text)
        if "hds" in dataj:
            streams = hdsparse(copy.copy(options), self.http.request("get", dataj["hds"], params={"hdcore": "3.8.0"}), dataj["hds"])
            if streams:
                for n in list(streams.keys()):
                    yield streams[n]
        data = self.http.request("get", "https://secure.dplay.se/secure/api/v2/user/authorization/stream/%s?stream_type=hls" % match.group(1), cookies=cookie)
        dataj = json.loads(data.text)
        if "hls" in dataj:
            streams = hlsparse(options, self.http.request("get", dataj["hls"]), dataj["hls"])
            if streams:
                for n in list(streams.keys()):
                    yield streams[n]
开发者ID:deadbeef84,项目名称:svtplay-dl,代码行数:31,代码来源:dplay.py


示例8: get

    def get(self, options):
        match = re.search(r'data-videoid="([^"]+)"', self.get_urldata())
        if not match:
            parse = urlparse(self.url)
            match = re.search(r'video/(\d+)/', parse.fragment)
            if not match:
                log.error("Can't find video id")
                sys.exit(2)
        videoid = match.group(1)
        data = get_http_data("http://svp.vg.no/svp/api/v1/vgtv/assets/%s?appName=vgtv-website" % videoid)
        jsondata = json.loads(data)

        if options.output_auto:
            directory = os.path.dirname(options.output)
            title = "%s" % jsondata["title"]
            title = filenamify(title)
            if len(directory):
                options.output = "%s/%s" % (directory, title)
            else:
                options.output = title
        if "hds" in jsondata["streamUrls"]:
            parse = urlparse(jsondata["streamUrls"]["hds"])
            manifest = "%s://%s%s?%s&hdcore=3.3.0" % (parse.scheme, parse.netloc, parse.path, parse.query)
            streams = hdsparse(copy.copy(options), manifest)
            if streams:
                for n in list(streams.keys()):
                    yield streams[n]
        if "hls" in jsondata["streamUrls"]:
            streams = hlsparse(jsondata["streamUrls"]["hls"])
            for n in list(streams.keys()):
                yield HLS(copy.copy(options), streams[n], n)
        if "mp4" in jsondata["streamUrls"]:
            yield HTTP(copy.copy(options), jsondata["streamUrls"]["mp4"])
开发者ID:TetragrammatonHermit,项目名称:svtplay-dl,代码行数:33,代码来源:vg.py


示例9: get

    def get(self):
        data = self.get_urldata()

        if self.exclude():
            yield ServiceError("Excluding video")
            return

        match = re.search(r'id="(bcPl[^"]+)"', data)
        if not match:
            yield ServiceError("Can't find flash id.")
            return
        flashid = match.group(1)

        match = re.search(r'playerID" value="([^"]+)"', self.get_urldata())
        if not match:
            yield ServiceError("Can't find playerID")
            return
        playerid = match.group(1)

        match = re.search(r'playerKey" value="([^"]+)"', self.get_urldata())
        if not match:
            yield ServiceError("Can't find playerKey")
            return
        playerkey = match.group(1)

        match = re.search(r'videoPlayer" value="([^"]+)"', self.get_urldata())
        if not match:
            yield ServiceError("Can't find videoPlayer info")
            return
        videoplayer = match.group(1)

        dataurl = "http://c.brightcove.com/services/viewer/htmlFederated?flashID={0}&playerID={1}&playerKey={2}&isVid=true&isUI=true&dynamicStreaming=true&@videoPlayer={3}".format(flashid, playerid, playerkey, videoplayer)
        data = self.http.request("get", dataurl).content
        match = re.search(r'experienceJSON = ({.*});', data)
        if not match:
            yield ServiceError("Can't find json data")
            return
        jsondata = json.loads(match.group(1))
        renditions = jsondata["data"]["programmedContent"]["videoPlayer"]["mediaDTO"]["renditions"]

        if jsondata["data"]["publisherType"] == "PREMIUM":
            yield ServiceError("Premium content")
            return

        for i in renditions:
            if i["defaultURL"].endswith("f4m"):
                streams = hdsparse(copy.copy(self.options), self.http.request("get", i["defaultURL"], params={"hdcore": "3.7.0"}), i["defaultURL"])
                if streams:
                    for n in list(streams.keys()):
                        yield streams[n]

            if i["defaultURL"].endswith("m3u8"):
                streams = hlsparse(self.options, self.http.request("get", i["defaultURL"]), i["defaultURL"])
                for n in list(streams.keys()):
                    yield streams[n]

            if i["defaultURL"].endswith("mp4"):
                yield HTTP(copy.copy(self.options), i["defaultURL"], i["encodingRate"] / 1024)
开发者ID:olof,项目名称:svtplay-dl,代码行数:58,代码来源:bigbrother.py


示例10: _get_video

    def _get_video(self, janson):
        if "subtitleReferences" in janson:
            for i in janson["subtitleReferences"]:
                if i["format"] == "websrt" and "url" in i:
                    yield subtitle(copy.copy(self.config), "wrst", i["url"], output=self.output)

        if "videoReferences" in janson:
            if len(janson["videoReferences"]) == 0:
                yield ServiceError("Media doesn't have any associated videos.")
                return

            for i in janson["videoReferences"]:
                streams = None
                alt_streams = None
                alt = None
                query = parse_qs(urlparse(i["url"]).query)
                if "alt" in query and len(query["alt"]) > 0:
                    alt = self.http.get(query["alt"][0])

                if i["format"] == "hls":
                    streams = hlsparse(self.config, self.http.request("get", i["url"]), i["url"], output=self.output)
                    if alt:
                        alt_streams = hlsparse(self.config, self.http.request("get", alt.request.url), alt.request.url, output=self.output)

                elif i["format"] == "hds":
                    match = re.search(r"\/se\/secure\/", i["url"])
                    if not match:
                        streams = hdsparse(self.config, self.http.request("get", i["url"], params={"hdcore": "3.7.0"}),
                                           i["url"], output=self.output)
                        if alt:
                            alt_streams = hdsparse(self.config, self.http.request("get", alt.request.url, params={"hdcore": "3.7.0"}),
                                                   alt.request.url, output=self.output)
                elif i["format"] == "dash264" or i["format"] == "dashhbbtv":
                    streams = dashparse(self.config, self.http.request("get", i["url"]), i["url"], output=self.output)
                    if alt:
                        alt_streams = dashparse(self.config, self.http.request("get", alt.request.url),
                                                alt.request.url, output=self.output)

                if streams:
                    for n in list(streams.keys()):
                        yield streams[n]
                if alt_streams:
                    for n in list(alt_streams.keys()):
                        yield alt_streams[n]
开发者ID:spaam,项目名称:svtplay-dl,代码行数:44,代码来源:svtplay.py


示例11: get

    def get(self, options):
        if re.findall("svt.se", self.url):
            match = re.search(r"data-json-href=\"(.*)\"", self.get_urldata())
            if match:
                filename = match.group(1).replace("&amp;", "&").replace("&format=json", "")
                url = "http://www.svt.se%s" % filename
            else:
                log.error("Can't find video file")
                sys.exit(2)
        else:
            url = self.url

        pos = url.find("?")
        if pos < 0:
            dataurl = "%s?&output=json&format=json" % url
        else:
            dataurl = "%s&output=json&format=json" % url
        data = json.loads(get_http_data(dataurl))
        if "live" in data["video"]:
            options.live = data["video"]["live"]
        else:
            options.live = False

        if data["video"]["subtitleReferences"]:
            try:
                subtitle = data["video"]["subtitleReferences"][0]["url"]
            except KeyError:
                pass
            if len(subtitle) > 0:
                yield subtitle_wsrt(subtitle)

        for i in data["video"]["videoReferences"]:
            parse = urlparse(i["url"])

            if parse.path.find("m3u8") > 0:
                streams = hlsparse(i["url"])
                for n in list(streams.keys()):
                    yield HLS(copy.copy(options), streams[n], n)
            elif parse.path.find("f4m") > 0:
                match = re.search(r"\/se\/secure\/", i["url"])
                if not match:
                    parse = urlparse(i["url"])
                    manifest = "%s://%s%s?%s&hdcore=3.3.0" % (parse.scheme, parse.netloc, parse.path, parse.query)
                    streams = hdsparse(copy.copy(options), manifest)
                    for n in list(streams.keys()):
                        yield streams[n]
            elif parse.scheme == "rtmp":
                embedurl = "%s?type=embed" % url
                data = get_http_data(embedurl)
                match = re.search(r"value=\"(/(public)?(statiskt)?/swf(/video)?/svtplayer-[0-9\.a-f]+swf)\"", data)
                swf = "http://www.svtplay.se%s" % match.group(1)
                options.other = "-W %s" % swf
                yield RTMP(copy.copy(options), i["url"], i["bitrate"])
            else:
                yield HTTP(copy.copy(options), i["url"], "0")
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:55,代码来源:svtplay.py


示例12: get

    def get(self, options):
        error, data = self.get_urldata()
        if error:
            log.error("Can't download page.")
            return

        if self.exclude(options):
            return

        match = re.search(r'id="(bcPl[^"]+)"', data)
        if not match:
            log.error("Can't find flash id.")
            return
        flashid = match.group(1)

        match = re.search(r'playerID" value="([^"]+)"', self.get_urldata()[1])
        if not match:
            log.error("Can't find playerID")
            return
        playerid = match.group(1)

        match = re.search(r'playerKey" value="([^"]+)"', self.get_urldata()[1])
        if not match:
            log.error("Can't find playerKey")
            return
        playerkey = match.group(1)

        match = re.search(r'videoPlayer" value="([^"]+)"', self.get_urldata()[1])
        if not match:
            log.error("Can't find videoPlayer info")
            return
        videoplayer = match.group(1)

        dataurl = "http://c.brightcove.com/services/viewer/htmlFederated?flashID=%s&playerID=%s&playerKey=%s&isVid=true&isUI=true&dynamicStreaming=true&@videoPlayer=%s" % (flashid, playerid, playerkey, videoplayer)
        error, data = get_http_data(dataurl)
        if error:
            log.error("Cant download video info")
            return
        match = re.search(r'experienceJSON = ({.*});', data)
        if not match:
            log.error("Can't find json data")
            return
        jsondata = json.loads(match.group(1))
        renditions = jsondata["data"]["programmedContent"]["videoPlayer"]["mediaDTO"]["renditions"]
        for i in renditions:
            if i["defaultURL"].endswith("f4m"):
                streams = hdsparse(copy.copy(options), i["defaultURL"])
                if streams:
                    for n in list(streams.keys()):
                        yield streams[n]

            if i["defaultURL"].endswith("m3u8"):
                streams = hlsparse(i["defaultURL"])
                for n in list(streams.keys()):
                    yield HLS(copy.copy(options), streams[n], n)
开发者ID:dapstr,项目名称:svtplay-dl,代码行数:55,代码来源:bigbrother.py


示例13: get

    def get(self, options):
        error, data = self.get_urldata()
        if error:
            log.error("Can't download page.")
            return

        if self.exclude(options):
            return

        match = re.search(r'resource:[ ]*"([^"]*)",', data)
        if match:
            resource_url = match.group(1)
            error, resource_data = get_http_data(resource_url)
            if error:
                log.error("Can't get resource data")
                return
            resource = json.loads(resource_data)
            streams = find_stream(options, resource)
            for i in streams:
                yield i
        else:
            match = re.search(r'resource="([^"]*)"', data)
            if not match:
                log.error("Cant find resource info for this video")
                return
            resource_url = "%s" % match.group(1)
            error, resource_data = get_http_data(resource_url)
            if error:
                log.error("Can't get resource data")
                return
            resource = json.loads(resource_data)

            if "SubtitlesList" in resource:
                suburl = resource["SubtitlesList"][0]["Uri"]
                yield subtitle(copy.copy(options), "wrst", suburl)
            if "Data" in resource:
                streams = find_stream(options, resource)
                for i in streams:
                    yield i
            else:
                for stream in resource['Links']:
                    if stream["Target"] == "HDS":
                        streams = hdsparse(copy.copy(options), stream["Uri"])
                        if streams:
                            for n in list(streams.keys()):
                                yield streams[n]
                    if stream["Target"] == "HLS":
                        streams = hlsparse(stream["Uri"])
                        for n in list(streams.keys()):
                            yield HLS(copy.copy(options), streams[n], n)
                    if stream["Target"] == "Streaming":
                        options.other = "-v -y '%s'" % stream['Uri'].replace("rtmp://vod.dr.dk/cms/", "")
                        rtmp = "rtmp://vod.dr.dk/cms/"
                        yield RTMP(copy.copy(options), rtmp, stream['Bitrate'])
开发者ID:dapstr,项目名称:svtplay-dl,代码行数:54,代码来源:dr.py


示例14: get

    def get(self, options):
        data = self.get_urldata()

        if self.exclude(options):
            yield ServiceError("Excluding video")
            return

        match = re.search(r'resource:[ ]*"([^"]*)",', data)
        if match:
            resource_url = match.group(1)
            resource_data = self.http.request("get", resource_url).content
            resource = json.loads(resource_data)
            streams = self.find_stream(options, resource)
            for i in streams:
                yield i
        else:
            match = re.search(r'resource="([^"]*)"', data)
            if not match:
                yield ServiceError("Cant find resource info for this video")
                return
            if match.group(1)[:4] != "http":
                resource_url = "http:%s" % match.group(1)
            else:
                resource_url = match.group(1)
            resource_data = self.http.request("get", resource_url).text
            resource = json.loads(resource_data)

            if "Links" not in resource:
                yield ServiceError("Cant access this video. its geoblocked.")
                return

            if "SubtitlesList" in resource:
                suburl = resource["SubtitlesList"][0]["Uri"]
                yield subtitle(copy.copy(options), "wrst", suburl)
            if "Data" in resource:
                streams = self.find_stream(options, resource)
                for i in streams:
                    yield i
            else:
                for stream in resource['Links']:
                    if stream["Target"] == "HDS":
                        streams = hdsparse(copy.copy(options), self.http.request("get", stream["Uri"], params={"hdcore": "3.7.0"}), stream["Uri"])
                        if streams:
                            for n in list(streams.keys()):
                                yield streams[n]
                    if stream["Target"] == "HLS":
                        streams = hlsparse(options, self.http.request("get", stream["Uri"]), stream["Uri"])
                        for n in list(streams.keys()):
                            yield streams[n]
                    if stream["Target"] == "Streaming":
                        options.other = "-v -y '%s'" % stream['Uri'].replace("rtmp://vod.dr.dk/cms/", "")
                        rtmp = "rtmp://vod.dr.dk/cms/"
                        yield RTMP(copy.copy(options), rtmp, stream['Bitrate'])
开发者ID:deadbeef84,项目名称:svtplay-dl,代码行数:53,代码来源:dr.py


示例15: get

    def get(self):
        data = self.get_urldata()

        match = re.search(r'resource:[ ]*"([^"]*)",', data)
        if match:
            resource_url = match.group(1)
            resource_data = self.http.request("get", resource_url).content
            resource = json.loads(resource_data)
            streams = self.find_stream(self.config, resource)
            for i in streams:
                yield i
        else:
            match = re.search(r'resource="([^"]*)"', data)
            if not match:
                yield ServiceError("Cant find resource info for this video")
                return
            if match.group(1)[:4] != "http":
                resource_url = "http:{0}".format(match.group(1))
            else:
                resource_url = match.group(1)
            resource_data = self.http.request("get", resource_url).text
            resource = json.loads(resource_data)

            if "Links" not in resource:
                yield ServiceError("Cant access this video. its geoblocked.")
                return
            if "SubtitlesList" in resource and len(resource["SubtitlesList"]) > 0:
                suburl = resource["SubtitlesList"][0]["Uri"]
                yield subtitle(copy.copy(self.config), "wrst", suburl, output=self.output)
            if "Data" in resource:
                streams = self.find_stream(self.config, resource)
                for i in streams:
                    yield i
            else:
                for stream in resource['Links']:
                    uri = stream["Uri"]
                    if uri is None:
                        uri = self._decrypt(stream["EncryptedUri"])

                    if stream["Target"] == "HDS":
                        streams = hdsparse(copy.copy(self.config),
                                           self.http.request("get", uri, params={"hdcore": "3.7.0"}),
                                           uri, output=self.output)
                        if streams:
                            for n in list(streams.keys()):
                                yield streams[n]
                    if stream["Target"] == "HLS":
                        streams = hlsparse(self.config, self.http.request("get", uri), uri, output=self.output)
                        for n in list(streams.keys()):
                            yield streams[n]
开发者ID:spaam,项目名称:svtplay-dl,代码行数:50,代码来源:dr.py


示例16: get

    def get(self, options):
        vid = self._get_video_id()
        if vid is None:
            log.error("Cant find video file")
            sys.exit(2)

        url = "http://playapi.mtgx.tv/v3/videos/%s" % vid
        options.other = ""
        data = get_http_data(url)
        dataj = json.loads(data)
        if "msg" in dataj:
            log.error("%s" % dataj["msg"])
            return

        if dataj["type"] == "live":
            options.live = True

        if dataj["sami_path"]:
            yield subtitle_sami(dataj["sami_path"])

        streams = get_http_data("http://playapi.mtgx.tv/v3/videos/stream/%s" % vid)
        streamj = json.loads(streams)

        if "msg" in streamj:
            log.error("Can't play this because the video is either not found or geoblocked.")
            return

        if streamj["streams"]["medium"]:
            filename = streamj["streams"]["medium"]
            if filename[len(filename)-3:] == "f4m":
                manifest = "%s?hdcore=2.8.0&g=hejsan" % filename
                streams = hdsparse(copy.copy(options), manifest)
                if streams:
                    for n in list(streams.keys()):
                        yield streams[n]
            else:
                parse = urlparse(filename)
                match = re.search("^(/[^/]+)/(.*)", parse.path)
                if not match:
                    log.error("Somthing wrong with rtmpparse")
                    sys.exit(2)
                filename = "%s://%s:%s%s" % (parse.scheme, parse.hostname, parse.port, match.group(1))
                path = "-y %s" % match.group(2)
                options.other = "-W http://flvplayer.viastream.viasat.tv/flvplayer/play/swf/player.swf %s" % path
                yield RTMP(copy.copy(options), filename, 800)

        if streamj["streams"]["hls"]:
            streams = hlsparse(streamj["streams"]["hls"])
            for n in list(streams.keys()):
                yield HLS(copy.copy(options), streams[n], n)
开发者ID:TetragrammatonHermit,项目名称:svtplay-dl,代码行数:50,代码来源:viaplay.py


示例17: get

    def get(self):
        data = self.get_urldata()

        match = re.search(r'resource:[ ]*"([^"]*)",', data)
        if match:
            resource_url = match.group(1)
            resource_data = self.http.request("get", resource_url).content
            resource = json.loads(resource_data)
            streams = self.find_stream(self.config, resource)
            for i in streams:
                yield i
        else:
            match = re.search(r'resource="([^"]*)"', data)
            if not match:
                yield ServiceError("Cant find resource info for this video")
                return
            if match.group(1)[:4] != "http":
                resource_url = "http:{0}".format(match.group(1))
            else:
                resource_url = match.group(1)
            resource_data = self.http.request("get", resource_url).text
            resource = json.loads(resource_data)

            if "Links" not in resource:
                yield ServiceError("Cant access this video. its geoblocked.")
                return
            if "SubtitlesList" in resource and len(resource["SubtitlesList"]) > 0:
                suburl = resource["SubtitlesList"][0]["Uri"]
                yield subtitle(copy.copy(self.config), "wrst", suburl, output=self.output)
            if "Data" in resource:
                streams = self.find_stream(self.config, resource)
                for i in streams:
                    yield i
            else:
                for stream in resource['Links']:
                    if stream["Target"] == "HDS":
                        streams = hdsparse(copy.copy(self.config),
                                           self.http.request("get", stream["Uri"], params={"hdcore": "3.7.0"}),
                                           stream["Uri"], output=self.output)
                        if streams:
                            for n in list(streams.keys()):
                                yield streams[n]
                    if stream["Target"] == "HLS":
                        streams = hlsparse(self.config, self.http.request("get", stream["Uri"]), stream["Uri"], output=self.output)
                        for n in list(streams.keys()):
                            yield streams[n]
                    if stream["Target"] == "Streaming":
                        self.config.set("other", "-v -y '{0}'".format(stream['Uri'].replace("rtmp://vod.dr.dk/cms/", "")))
                        rtmp = "rtmp://vod.dr.dk/cms/"
                        yield RTMP(copy.copy(self.config), rtmp, stream['Bitrate'], output=self.output)
开发者ID:olof,项目名称:debian-svtplay-dl,代码行数:50,代码来源:dr.py


示例18: get

    def get(self, options):
        data = self.get_urldata()
        match = re.search(r'resource:[ ]*"([^"]*)",', data)
        if match:
            resource_url = match.group(1)
            resource_data = get_http_data(resource_url)
            resource = json.loads(resource_data)
            tempresource = resource['Data'][0]['Assets']
            # To find the VideoResource, they have Images as well
            for resources in tempresource:
                if resources['Kind'] == 'VideoResource':
                    links = resources['Links']
                    break

            for i in links:
                if i["Target"] == "Ios":
                    streams = hlsparse(i["Uri"])
                    for n in list(streams.keys()):
                        yield HLS(copy.copy(options), streams[n], n)
                else:
                    if i["Target"] == "Streaming":
                        options.other = "-y '%s'" % i["Uri"].replace("rtmp://vod.dr.dk/cms/", "")
                        rtmp = "rtmp://vod.dr.dk/cms/"
                        yield RTMP(copy.copy(options), rtmp, i["Bitrate"])

        else:
            match = re.search(r'resource="([^"]*)"', data)
            if not match:
                log.error("Cant find resource info for this video")
                sys.exit(2)
            resource_url = "%s" % match.group(1)
            resource_data = get_http_data(resource_url)
            resource = json.loads(resource_data)

            for stream in resource['Links']:
                if stream["Target"] == "HDS":
                    manifest = "%s?hdcore=2.8.0&g=hejsan" % stream["Uri"]
                    streams = hdsparse(copy.copy(options), manifest)
                    for n in list(streams.keys()):
                        yield streams[n]
                if stream["Target"] == "HLS":
                    streams = hlsparse(stream["Uri"])
                    for n in list(streams.keys()):
                        yield HLS(copy.copy(options), streams[n], n)
                if stream["Target"] == "Streaming":
                    options.other = "-v -y '%s'" % stream['Uri'].replace("rtmp://vod.dr.dk/cms/", "")
                    rtmp = "rtmp://vod.dr.dk/cms/"
                    yield RTMP(copy.copy(options), rtmp, stream['Bitrate'])
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:48,代码来源:dr.py


示例19: get


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python hls.hlsparse函数代码示例发布时间:2022-05-27
下一篇:
Python file.Vcf类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap