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

Python log.error函数代码示例

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

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



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

示例1: get

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

        if self.exclude(options):
            return

        parse = urlparse(self.url)
        vidoid = parse.path[parse.path.rfind("/")+1:]
        match = re.search(r'JSONdata = ({.*});', data)
        if not match:
            log.error("Cant find json data")
            return
        janson = json.loads(match.group(1))
        playlist = janson["playlist"]
        for i in playlist:
            if i["brightcoveId"] == vidoid:
                if i["HLSURL"]:
                    streams = hlsparse(i["HLSURL"])
                    for n in list(streams.keys()):
                        yield HLS(copy.copy(options), streams[n], n)
                for n in i["renditions"]:
                    if n["container"] == "MP4":
                        yield HTTP(copy.copy(options), n["URL"], int(n["rate"])/1000)
开发者ID:dapstr,项目名称:svtplay-dl,代码行数:26,代码来源:dbtv.py


示例2: find_all_episodes

    def find_all_episodes(self, options):
        premium = False
        if options.username and options.password:
            premium = self._login(options.username, options.password)
            if isinstance(premium, Exception):
                log.error(premium.message)
                return None

        jsondata = self._get_show_info()

        episodes = []
        n = 1
        for i in jsondata["results"]:
            if premium:
                text = "availability_group_premium"
            else:
                text = "availability_group_free"

            try:
                days = int(i["availability"][text])
            except (ValueError, TypeError):
                days = 999
            if days > 0:
                video_id = i["id"]
                url = "http://www.tv4play.se/program/%s?video_id=%s" % (
                    show, video_id)
                episodes.append(url)
                if n == options.all_last:
                    break
                n += 1

        return episodes
开发者ID:deadbeef84,项目名称:svtplay-dl,代码行数:32,代码来源:tv4play.py


示例3: find_all_episodes

    def find_all_episodes(self, options):
        page = 1
        data = self.get_urldata()
        match = re.search(r'"/etikett/titel/([^"/]+)', data)
        if match is None:
            match = re.search(r'"http://www.oppetarkiv.se/etikett/titel/([^/]+)/', self.url)
            if match is None:
                log.error("Couldn't find title")
                return
        program = match.group(1)
        episodes = []

        n = 0
        if self.options.all_last > 0:
            sort = "tid_fallande"
        else:
            sort = "tid_stigande"

        while True:
            url = "http://www.oppetarkiv.se/etikett/titel/{0}/?sida={1}&sort={2}&embed=true".format(program, page, sort)
            data = self.http.request("get", url)
            if data.status_code == 404:
                break

            data = data.text
            regex = re.compile(r'href="(/video/[^"]+)"')
            for match in regex.finditer(data):
                if n == self.options.all_last:
                    break
                episodes.append("http://www.oppetarkiv.se{0}".format(match.group(1)))
                n += 1
            page += 1

        return episodes
开发者ID:magic75,项目名称:svtplay-dl,代码行数:34,代码来源:oppetarkiv.py


示例4: 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


示例5: output

def output(options, extention="mp4", openfd=True, mode="wb", **kwargs):
    if is_py2:
        file_d = file
    else:
        file_d = io.IOBase

    if options.output != "-":
        ext = re.search(r"(\.\w{2,3})$", options.output)
        if not ext:
            options.output = "%s.%s" % (options.output, extention)
        if options.output_auto and ext:
            options.output = "%s.%s" % (options.output, extention)
        if extention == "srt" and ext:
            options.output = "%s.srt" % options.output[:options.output.rfind(ext.group(1))]
        log.info("Outfile: %s", options.output)
        if os.path.isfile(options.output) or \
                findexpisode(os.path.dirname(os.path.realpath(options.output)), options.service, os.path.basename(options.output)):
            if extention == "srt":
                if not options.force_subtitle:
                    log.error("File (%s) already exists. Use --force-subtitle to overwrite" % options.output)
                    return None
            else:
                if not options.force:
                    log.error("File (%s) already exists. Use --force to overwrite" % options.output)
                    return None
        if openfd:
            file_d = open(options.output, mode, **kwargs)
    else:
        if openfd:
            if is_py2:
                file_d = sys.stdout
            else:
                file_d = sys.stdout.buffer

    return file_d
开发者ID:chenliang100,项目名称:svtplay-dl,代码行数:35,代码来源:output.py


示例6: main

def main():
    """ Main program """
    usage = "usage: %prog [options] url"
    parser = OptionParser(usage=usage, version=__version__)
    parser.add_option("-o", "--output",
                      metavar="OUTPUT", help="Outputs to the given filename.")
    parser.add_option("-r", "--resume",
                      action="store_true", dest="resume", default=False,
                      help="Resume a download (RTMP based ones)")
    parser.add_option("-l", "--live",
                      action="store_true", dest="live", default=False,
                      help="Enable for live streams (RTMP based ones)")
    parser.add_option("-s", "--silent",
                      action="store_true", dest="silent", default=False)
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False)
    parser.add_option("-f", "--force",
                      action="store_true", dest="force", default=False)
    parser.add_option("-q", "--quality", default=0,
                      metavar="quality", help="Choose what format to download.\nIt will download the best format by default")
    parser.add_option("-Q", "--flexible-quality", default=0,
                      metavar="amount", dest="flexibleq", help="Allow given quality (as above) to differ by an amount.")
    parser.add_option("-H", "--hls",
                      action="store_true", dest="hls", default=False, help="obsolete use -P")
    parser.add_option("-S", "--subtitle",
                      action="store_true", dest="subtitle", default=False,
                      help="Download subtitle from the site if available.")
    parser.add_option("--force-subtitle", dest="force_subtitle", default=False,
                      action="store_true", help="Download only subtitle if its used with -S")
    parser.add_option("-u", "--username", default=None,
                      help="Username")
    parser.add_option("-p", "--password", default=None,
                      help="Password")
    parser.add_option("-t", "--thumbnail",
                      action="store_true", dest="thumbnail", default=False,
                      help="Download thumbnail from the site if available.")
    parser.add_option("-A", "--all-episodes",
                      action="store_true", dest="all_episodes", default=False,
                      help="Try to download all episodes.")
    parser.add_option("-P", "--preferred", default=None,
                      metavar="preferred", help="preferred download method (rtmp, hls or hds)")
    (options, args) = parser.parse_args()
    if not args:
        parser.print_help()
        sys.exit(0)
    if len(args) != 1:
        parser.error("incorrect number of arguments")
    options = mergeParserOption(Options(), options)
    setup_log(options.silent, options.verbose)

    if options.flexibleq and not options.quality:
        log.error("flexible-quality requires a quality")
        sys.exit(4)

    url = args[0]

    try:
        get_media(url, options)
    except KeyboardInterrupt:
        print("")
开发者ID:magnusaberg,项目名称:svtplay-dl,代码行数:60,代码来源:__init__.py


示例7: get_media

def get_media(url, options):
    if "http" not in url[:4]:
        url = "http://%s" % url

    if options.silent_semi:
        options.silent = True
    if options.verbose:
        log.debug("version: {0}".format( __version__))
    stream = service_handler(sites, options, url)
    if not stream:
        generic = Generic(options, url)
        url, stream = generic.get(sites)
    if not stream:
        if url.find(".f4m") > 0 or url.find(".m3u8") > 0:
            stream = Raw(options, url)
        if not stream:
            log.error("That site is not supported. Make a ticket or send a message")
            sys.exit(2)

    if is_py2:
        url = ensure_unicode(url)

    if options.all_episodes:
        get_all_episodes(stream, copy.copy(options), url)
    else:
        get_one_media(stream, copy.copy(options))
开发者ID:magic75,项目名称:svtplay-dl,代码行数:26,代码来源:__init__.py


示例8: get

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


示例9: find_all_episodes

    def find_all_episodes(self, options):
        page = 1
        data = self.get_urldata()
        match = re.search(r'"/etikett/titel/([^"/]+)', data)
        if match is None:
            match = re.search(r'"http://www.oppetarkiv.se/etikett/titel/([^/]+)/', self.url)
            if match is None:
                log.error("Couldn't find title")
                return
        program = match.group(1)
        more = True
        episodes = []

        n = 0
        if options.all_last > 0:
            sort = "tid_fallande"
        else:
            sort = "tid_stigande"

        while more:
            url = "http://www.oppetarkiv.se/etikett/titel/%s/?sida=%s&sort=%s&embed=true" % (program, page, sort)
            data = self.http.request("get", url).text
            visa = re.search(r'svtXColorDarkLightGrey', data)
            if not visa:
                more = False
            regex = re.compile(r'href="(/video/[^"]+)"')
            for match in regex.finditer(data):
                if n == options.all_last:
                    break
                episodes.append("http://www.oppetarkiv.se%s" % match.group(1))
                n += 1
            page += 1

        return episodes
开发者ID:Sopor-,项目名称:svtplay-dl,代码行数:34,代码来源:oppetarkiv.py


示例10: get

    def get(self, options):
        match = re.search("xmlUrl=([^ ]+)\" ", self.get_urldata())
        if match:
            xmlurl = unquote_plus(match.group(1))
        else:
            match = re.search("moviesList: \[\{\"VideoId\":\"(\d+)\"", self.get_urldata())
            if not match:
                log.error("Can't find video id")
                sys.exit(2)
            vid = match.group(1)
            xmlurl = "http://www.expressen.se/Handlers/WebTvHandler.ashx?id=%s" % vid
        data = get_http_data(xmlurl)

        xml = ET.XML(data)
        live = xml.find("live").text
        if live != "0":
            options.live = True
        ss = xml.find("vurls")
        if is_py2_old:
            sa = list(ss.getiterator("vurl"))
        else:
            sa = list(ss.iter("vurl"))

        for i in sa:
            options2 = copy.copy(options)
            match = re.search(r"rtmp://([-0-9a-z\.]+/[-a-z0-9]+/)(.*)", i.text)
            filename = "rtmp://%s" % match.group(1)
            options2.other = "-y %s" % match.group(2)
            yield RTMP(options2, filename, int(i.attrib["bitrate"]))

        ipadurl = xml.find("mobileurls").find("ipadurl").text
        streams = hlsparse(ipadurl)
        for n in list(streams.keys()):
            yield HLS(copy.copy(options), streams[n], n)
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:34,代码来源:expressen.py


示例11: get

    def get(self, options):
        vid = None
        data = self.get_urldata()
        match = re.search(r'video url-([^"]+)', data)
        if not match:
            match = re.search(r'embed.jsp\?id=([^&]+)&', data)
            if not match:
                log.error("Cant find video id")
                sys.exit(2)
            vid = match.group(1)
        if not vid:
            path = unquote_plus(match.group(1))
            data = get_http_data("http://www.svd.se%s" % path)
            match = re.search(r'embed.jsp\?id=([^&]+)&', data)
            if not match:
                log.error("Cant find video id2")
                sys.exit(2)
            vid = match.group(1)

        url = "http://amz.lwcdn.com/api/cache/VideoCache.jsp?id=%s" % vid
        data = get_http_data(url)
        xml = ET.XML(data)
        videofile = xml.find("{http://www.lemonwhale.com/xml11}VideoFile")
        mediafiles = videofile.find("{http://www.lemonwhale.com/xml11}MediaFiles")
        high = mediafiles.find("{http://www.lemonwhale.com/xml11}VideoURLHigh")
        if high.text:
            yield HTTP(copy.copy(options), high.text, 720)
        file = mediafiles.find("{http://www.lemonwhale.com/xml11}VideoURL").text
        yield HTTP(copy.copy(options), file, 480)
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:29,代码来源:lemonwhale.py


示例12: get

    def get(self, options):
        data = self.get_urldata()
        match = re.search('data-aptomaId="([-0-9a-z]+)"', data)
        if not match:
            log.error("Can't find video info")
            sys.exit(2)
        videoId = match.group(1)
        match = re.search(r'data-isLive="(\w+)"', data)
        if not match:
            log.error("Can't find live info")
            sys.exit(2)
        if match.group(1) == "true":
            options.live = True
        if not options.live:
            dataurl = "http://aftonbladet-play-metadata.cdn.drvideo.aptoma.no/video/%s.json" % videoId
            data = get_http_data(dataurl)
            data = json.loads(data)
            videoId = data["videoId"]

        streamsurl = "http://aftonbladet-play-static-ext.cdn.drvideo.aptoma.no/actions/video/?id=%s&formats&callback=" % videoId
        streams = json.loads(get_http_data(streamsurl))
        hlsstreams = streams["formats"]["hls"]
        if "level3" in hlsstreams.keys():
            hls = hlsstreams["level3"]["csmil"][0]
        else:
            hls = hlsstreams["akamai"]["m3u8"][0]
        address = hls["address"]
        path = hls["path"]

        for i in hls["files"]:
            if "filename" in i.keys():
                playlist = "http://%s/%s/%s/master.m3u8" % (address, path, i["filename"])
            else:
                playlist = "http://%s/%s/%s/master.m3u8" % (address, path, hls["filename"])
            yield HLS(copy.copy(options), playlist, i["bitrate"])
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:35,代码来源:aftonbladet.py


示例13: get

    def get(self, options, url):
        data = get_http_data(url)
        match = re.search("xmlUrl: '(http://www.expressen.*)'", data)
        if not match:
            log.error("Can't find video file")
            sys.exit(2)
        url = "http://tv.expressen.se/%s/?standAlone=true&output=xml" % quote_plus(match.group(1))
        url = match.group(1)
        data = get_http_data(url)
        xml = ET.XML(data)
        ss = xml.find("vurls")
        if sys.version_info < (2, 7):
            sa = list(ss.getiterator("vurl"))
        else:
            sa = list(ss.iter("vurl"))
        streams = {}

        for i in sa:
            streams[int(i.attrib["bitrate"])] = i.text

        test = select_quality(options, streams)

        filename = test
        match = re.search("rtmp://([0-9a-z\.]+/[0-9]+/)(.*)", filename)

        filename = "rtmp://%s" % match.group(1)
        options.other = "-y %s" % match.group(2)

        download_rtmp(options, filename)
开发者ID:quite,项目名称:svtplay-dl,代码行数:29,代码来源:expressen.py


示例14: find_all_episodes

 def find_all_episodes(self, options):
     format_id = re.search(r'data-format-id="(\d+)"', self.get_urldata())
     if not format_id:
         log.error("Can't find video info for all episodes")
         return
     data = self.http.request("get", "http://playapi.mtgx.tv/v1/sections?sections=videos.one,seasons.videolist&format=%s" % format_id.group(1)).text
     videos = []
     jsondata = json.loads(data)
     jsons = jsondata["_embedded"]["sections"][1]["_embedded"]["seasons"]
     for i in jsons:
         grej = i["_embedded"]["episodelist"]
         if "_links" in grej and "_embedded" not in grej:
             data2 = self.http.request("get", grej["_links"]["self"]["href"]).json()
             for x in data2["_embedded"]["videos"]:
                 videos.append(x)
         if "_embedded" in grej:
             for x in grej["_embedded"]["videos"]:
                 videos.append(x)
     n = 0
     episodes = []
     for i in videos:
         if n == options.all_last:
             break
         episodes.append(i["sharing"]["url"])
         n += 1
     return episodes
开发者ID:chenliang100,项目名称:svtplay-dl,代码行数:26,代码来源:viaplay.py


示例15: find_all_episodes

    def find_all_episodes(self, options):
        program = re.search(".*/program/(\d+)", self.url)
        if not program:
            log.error("Can't find program id in url")
            return None
        baseurl = "http://www.kanal5play.se/content/program/%s" % program.group(1)
        data = self.http.request("get", baseurl).text
        sasong = re.search("/program/\d+/sasong/(\d+)", data)
        if not sasong:
            log.error("Can't find seasong id")
            return None
        seasong = int(sasong.group(1))
        episodes = []
        n = 0
        more = True
        while more:
            url = "%s/sasong/%s" % (baseurl, seasong)
            data = self.http.request("get", url)
            if data.status_code == 404:
                more = False
            else:
                regex = re.compile(r'href="(/play/program/\d+/video/\d+)"')
                for match in regex.finditer(data.text):
                    if n == options.all_last:
                        break
                    url2 = "http://www.kanal5play.se%s" % match.group(1)
                    if url2 not in episodes:
                        episodes.append(url2)
                    n += 1
                seasong -= 1

        return episodes
开发者ID:leakim,项目名称:svtplay-dl,代码行数:32,代码来源:kanal5.py


示例16: remux

 def remux(self):
     if self.detect is None:
         log.error("Cant detect ffmpeg or avconv. Cant mux files without it.")
         return
     if self.stream.finished is False:
         return
     
     if self.stream.options.output.endswith('.mp4') is False:
         orig_filename = self.stream.options.output
         new_name = "{0}.mp4".format(os.path.splitext(self.stream.options.output)[0])
 
         log.info("Muxing %s into %s", orig_filename, new_name)
         tempfile = "{0}.temp".format(self.stream.options.output)
         name, ext = os.path.splitext(orig_filename)
         arguments = ["-c", "copy", "-copyts", "-f", "mp4"]
         if ext == ".ts":
             arguments += ["-bsf:a", "aac_adtstoasc"]
         arguments += ["-y", tempfile]
         cmd = [self.detect, "-i", orig_filename]
         cmd += arguments
         p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
         stdout, stderr = p.communicate()
         if p.returncode != 0:
             stderr = stderr.decode('utf-8', 'replace')
             msg = stderr.strip().split('\n')[-1]
             log.error("Something went wrong: %s", msg)
             return
         log.info("Muxing done, removing the old file.")
         os.remove(self.stream.options.output)
         os.rename(tempfile, new_name)
开发者ID:chenliang100,项目名称:svtplay-dl,代码行数:30,代码来源:__init__.py


示例17: get

    def get(self, options):
        parse = urlparse(self.url)
        try:
            other = parse.fragment
        except KeyError:
            log.error("Something wrong with that url")
            sys.exit(2)
        match = re.search("^/(.*).html", other)
        if not match:
            log.error("Cant find video file")
            sys.exit(2)
        url = "http://www.hbo.com/data/content/%s.xml" % match.group(1)
        data = get_http_data(url)
        xml = ET.XML(data)
        videoid = xml.find("content")[1].find("videoId").text
        url = "http://render.cdn.hbo.com/data/content/global/videos/data/%s.xml" % videoid
        data = get_http_data(url)
        xml = ET.XML(data)
        ss = xml.find("videos")
        if is_py2_old:
            sa = list(ss.getiterator("size"))
        else:
            sa = list(ss.iter("size"))

        for i in sa:
            videourl = i.find("tv14").find("path").text
            match = re.search("/([a-z0-9]+:[a-z0-9]+)/", videourl)
            options.other = "-y %s" % videourl[videourl.index(match.group(1)):]
            yield RTMP(copy.copy(options), videourl[:videourl.index(match.group(1))], i.attrib["width"])
开发者ID:Cybjit,项目名称:svtplay-dl,代码行数:29,代码来源:hbo.py


示例18: merge

    def merge(self):
        if self.detect is None:
            log.error("Cant detect ffmpeg or avconv. Cant mux files without it.")
            return

        if self.stream.finished is False:
            return
        orig_filename = self.stream.options.output
        log.info("Merge audio and video into %s", orig_filename)
        tempfile = "{0}.temp".format(self.stream.options.output)
        audio_filename = "{0}.m4a".format(os.path.splitext(self.stream.options.output)[0])
        arguments = ["-c:v", "copy", "-c:a", "copy", "-f", "mp4", "-y", tempfile]
        cmd = [self.detect, "-i", orig_filename, "-i", audio_filename]
        cmd += arguments
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
        stdout, stderr = p.communicate()
        if p.returncode != 0:
            stderr = stderr.decode('utf-8', 'replace')
            msg = stderr.strip().split('\n')[-1]
            log.error("Something went wrong: %s", msg)
            return
        log.info("Merging done, removing old files.")
        os.remove(self.stream.options.output)
        os.remove(audio_filename)
        os.rename(tempfile, self.stream.options.output)
开发者ID:chenliang100,项目名称:svtplay-dl,代码行数:25,代码来源:__init__.py


示例19: download

    def download(self):
        """ Get the stream from RTMP """
        args = []
        if self.options.live:
            args.append("-v")

        if self.options.resume:
            args.append("-e")

        file_d = output(self.options, "flv", False)
        if file_d is None:
            return
        args += ["-o", self.options.output]
        if self.options.silent or self.options.output == "-":
            args.append("-q")
        if self.options.other:
            if is_py2:
                args += shlex.split(self.options.other.encode("utf-8"))
            else:
                args += shlex.split(self.options.other)

        if self.options.verbose:
            args.append("-V")

        command = ["rtmpdump", "-r", self.url] + args
        log.debug("Running: %s", " ".join(command))
        try:
            subprocess.call(command)
        except OSError as e:
            log.error("Could not execute rtmpdump: " + e.strerror)
            return
        self.finished = True
开发者ID:spaam,项目名称:svtplay-dl,代码行数:32,代码来源:rtmp.py


示例20: get_media

def get_media(url, options):
    stream = service_handler(url)
    if not stream:
        url, stream = Generic().get(url)
        url = url.replace("&amp;", "&")
    if not stream:
        log.error("That site is not supported. Make a ticket or send a message")
        sys.exit(2)

    if not options.output or os.path.isdir(options.output):
        data = get_http_data(url)
        match = re.search("(?i)<title.*>\s*(.*?)\s*</title>", data)
        if match:
            if sys.version_info > (3, 0):
                title = re.sub('[^\w\s-]', '', match.group(1)).strip().lower()
                if options.output:
                    options.output = options.output + re.sub('[-\s]+', '-', title)
                else:
                    options.output = re.sub('[-\s]+', '-', title)
            else:
                title = unicode(re.sub('[^\w\s-]', '', match.group(1)).strip().lower())
                if options.output:
                    options.output = unicode(options.output + re.sub('[-\s]+', '-', title))
                else:
                    options.output = unicode(re.sub('[-\s]+', '-', title))

    stream.get(options, url)
开发者ID:quite,项目名称:svtplay-dl,代码行数:27,代码来源:__init__.py



注:本文中的svtplay_dl.log.log.error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python log.info函数代码示例发布时间:2022-05-27
下一篇:
Python hls.hlsparse函数代码示例发布时间: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