当前位置: 首页>>代码示例>>Python>>正文


Python VideoInfo.artist方法代码示例

本文整理汇总了Python中ykdl.videoinfo.VideoInfo.artist方法的典型用法代码示例。如果您正苦于以下问题:Python VideoInfo.artist方法的具体用法?Python VideoInfo.artist怎么用?Python VideoInfo.artist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ykdl.videoinfo.VideoInfo的用法示例。


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

示例1: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name, True)
        html = get_content(self.url)
        t_a = match1(html, '"keywords" content="([^"]+)')
        info.title = t_a.split(',')[0]
        info.artist = t_a.split(',')[1]

        replay_url = match1(html, '"m3u8":"([^"]+)')
        if replay_url:
            replay_url = replay_url.replace('\/','/')
            info.live = False
            info.stream_types.append('current')
            info.streams['current'] = {'container': 'm3u8', 'video_profile': 'current', 'src' : [replay_url], 'size': float('inf')}
            return info

        self.vid = match1(html, '"sn":"([^"]+)')
        channel = match1(html, '"channel":"([^"]+)')
        api_url = 'http://g2.live.360.cn/liveplay?stype=flv&channel={}&bid=huajiao&sn={}&sid={}&_rate=xd&ts={}&r={}&_ostype=flash&_delay=0&_sign=null&_ver=13'.format(channel, self.vid, SID, time.time(),random.random())
        encoded_json = get_content(api_url)
        decoded_json = base64.decodestring(compact_bytes(encoded_json[0:3]+ encoded_json[6:], 'utf-8')).decode('utf-8')
        video_data = json.loads(decoded_json)
        live_url = video_data['main']
        info.live = True
        info.stream_types.append('current')
        info.streams['current'] = {'container': 'flv', 'video_profile': 'current', 'src' : [live_url], 'size': float('inf')}
        return info
开发者ID:PureTV,项目名称:ykdl,代码行数:28,代码来源:huajiao.py

示例2: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name, True)
        if not self.vid:
            self.vid = match1(self.url, '/(\d+)')
        if not self.vid:
            html = get_content(self.url)
            self.vid = match1(html, '"room_id":(\d+)')

        #from upstream!!
        api_url = 'http://www.qie.tv/api/v1/room/{}'.format(self.vid)

        metadata = json.loads(get_content(api_url))
        assert metadata['error'] == 0, 'error {}: {}'.format(metadata['error'], metadata['data'])

        livedata = metadata['data']
        assert livedata['show_status'] == '1', 'error: live show is not on line!!'

        info.title = livedata['room_name']
        info.artist = livedata['nickname']

        base_url = livedata['rtmp_url']

        if 'hls_url' in livedata:
            info.stream_types.append('BD')
            info.streams['BD'] = {'container': 'm3u8', 'video_profile': u'原画', 'src' : [livedata['hls_url']], 'size': float('inf')}

        mutli_stream = livedata['rtmp_multi_bitrate']
        for i in self.mutli_bitrate:
            if i in mutli_stream:
                info.stream_types.append(self.bitrate_2_type[i])
                info.streams[self.bitrate_2_type[i]] = {'container': 'flv', 'video_profile': self.bitrate_2_profile[i], 'src' : [base_url + '/' + mutli_stream[i]], 'size': float('inf')}
        return info
开发者ID:PureTV,项目名称:ykdl,代码行数:34,代码来源:live.py

示例3: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name, True)
        if not self.vid:
            self.vid = match1(self.url, '/(\d+)')
        if not self.vid:
            html = get_content(self.url)
            self.vid = match1(html, '"liveAddr":"([0-9\_]+)"')
        self.pid = self.vid

        # from upstream!!
        serverDataTxt = match1(html, 'serverData = {([\S\ ]+)};')
        serverDataTxt = '{%s}' % (serverDataTxt)
        self.logger.debug("serverDataTxt => %s" % (serverDataTxt))

        serverData = json.loads(serverDataTxt)
        self.logger.debug(serverData)

        assert serverData["liveInfo"]["data"]["profileInfo"]["isLive"] == 1, 'error: live show is not on line!!'

        info.title = serverData["liveInfo"]["data"]["videoInfo"]["title"]
        info.artist = serverData["liveInfo"]["data"]["profileInfo"]["nickName"]

        for data in serverData["liveInfo"]["data"]["videoInfo"]["streamInfos"]:
            info.stream_types.append(self.bitrate_2_type[data["bitrate"]])
            info.streams[self.bitrate_2_type[data["bitrate"]]] = {'container': 'flv', 'video_profile': data["desc"], 'src': ["%s&_t=%s000"%(unescape(data["playUrl"]),int(time.time()))], 'size': float('inf')}

        return info
开发者ID:wwqgtxx,项目名称:ykdl,代码行数:29,代码来源:egame.py

示例4: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name)
        add_header("Referer", "http://music.163.com/")
        if not self.vid:
            self.vid =  match1(self.url, 'song/(\d+)', '\?id=(.*)')
        api_url = self.api_url.format(self.vid, self.vid)
        music = self.get_music(json.loads(get_content(api_url)))
        self.logger.debug("music info >" + str(music))
        info.title = music['name']
        info.artist = music['artists'][0]['name']

        real_id = music["id"]

        snd_key = random_string()
        if sys.version_info[0] == 3:
            encSecKey = RSA_string(snd_key)
        else:
            encSecKey = RSA_string(snd_key)[:-1]
        payload = netease_req(real_id, snd_key, encSecKey)

        mp3_info = json.loads(get_content(self.mp3_api, data=compact_bytes(urlencode(payload), 'utf-8')))['data'][0]
        self.logger.debug("mp3 > " + str(mp3_info))
        info.stream_types.append('current')
        info.streams['current'] =  {'container': mp3_info['type'], 'video_profile': 'current', 'src' : [mp3_info['url']], 'size': mp3_info['size']}
        return info
开发者ID:wwqgtxx,项目名称:ykdl,代码行数:27,代码来源:musicbase.py

示例5: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name, True)

        if not self.vid:
            html = get_content(self.url)
            room = match1(html, 'var $ROOM = ([^;]+)')
            self.vid = match1(html, '"room_id.?":(\d+)')
            info.title = json.loads("{\"room_name\" : \"" + match1(html, '"room_name.?":"([^"]+)') + "\"}")['room_name']
            info.artist = json.loads("{\"name\" : \"" + match1(html, '"owner_name.?":"([^"]+)') + "\"}")['name']
        api_url = 'https://www.douyu.com/lapi/live/getPlay/{}'.format(self.vid)
        tt = str(int(time.time() / 60))
        rnd_md5 = hashlib.md5(str(random.random()).encode('utf8'))
        did = rnd_md5.hexdigest().upper()
        to_sign = ''.join([self.vid, did, API_KEY, tt])
        sign = stupidMD5(to_sign)
        for stream in self.stream_ids:
            rate = self.stream_id_2_rate[stream]
            params = {"ver" : VER, "sign" : sign, "did" : did, "rate" : rate, "tt" : tt, "cdn" : "ws"}
            form = urlencode(params)
            html_content = get_content(api_url, data=compact_bytes(form, 'utf-8'))
            live_data = json.loads(html_content)
            assert live_data["error"] == 0, "live show is offline"
            live_data = live_data["data"]
            real_url = '/'.join([live_data['rtmp_url'], live_data['rtmp_live']])

            info.stream_types.append(stream)
            info.streams[stream] = {'container': 'flv', 'video_profile': self.id_2_profile[stream], 'src' : [real_url], 'size': float('inf')}

        return info
开发者ID:flfq,项目名称:ykdl,代码行数:31,代码来源:live.py

示例6: parser_list

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def parser_list(self, url):
        add_header("Referer", "http://music.163.com/")
        vid =  match1(url, 'id=(.*)')
        if "album" in url:
           api_url = "http://music.163.com/api/album/{}?id={}&csrf_token=".format(vid, vid)
           listdata = json.loads(get_content(api_url))
           playlist = listdata['album']['songs']
        elif "playlist" in url:
           api_url = "http://music.163.com/api/playlist/detail?id={}&csrf_token=".format(vid)
           listdata = json.loads(get_content(api_url))
           playlist = listdata['result']['tracks']
        elif "toplist" in url:
           api_url = "http://music.163.com/api/playlist/detail?id={}&csrf_token=".format(vid)
           listdata = json.loads(get_content(api_url))
           playlist = listdata['result']['tracks']
        elif "artist" in url:
           api_url = "http://music.163.com/api/artist/{}?id={}&csrf_token=".format(vid, vid)
           listdata = json.loads(get_content(api_url))
           playlist = listdata['hotSongs']

        info_list = []
        for music in playlist:
            info = VideoInfo(self.name)
            info.title = music['name']
            info.artist = music['artists'][0]['name']
            self.mp3_host = music['mp3Url'][8]
            for st in self.supported_stream_types:
                if st in music and music[st]:
                    info.stream_types.append(st)
                    self.song_date[st] = music[st]
            self.extract_song(info)
            info_list.append(info)
        return info_list
开发者ID:PureTV,项目名称:ykdl,代码行数:35,代码来源:music.py

示例7: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name, True)
        html = get_content(self.url)
        self.vid = match1(html, '"user_id":"([^"]+)",')
        title = json.loads(match1(html, '"room_name":("[^"]*"),'))
        artist = json.loads(match1(html, '"nick_name":("[^"]+"),'))
        info.title = u'{} - {}'.format(title, artist)
        info.artist = artist

        def get_live_info(rate='source'):
            data = getlive(self.vid, rate)
            self.logger.debug('data:\n' + str(data))
            if data['code'] != 'A00000':
                return data.get('msg')

            data = data['data']
            url = data.get('https_flv') or data.get('flv') or data.get('rtmp')
            if url:
                url = url.replace('rtmp://', 'http://')
                ran = random.randrange(1e4)
                if '?' in url:
                    url = '{}&ran={}'.format(url, ran)
                else:
                    url = '{}?ran={}'.format(url, ran)
                stream_profile = self.rate_2_profile[rate]
                stream_id = self.rate_2_id[rate]
                info.stream_types.append(stream_id)
                info.streams[stream_id] = {
                    'video_profile': stream_profile,
                    'container': 'flv',
                    'src' : [url],
                    'size': float('inf')
                }

            error_msges = []
            if rate == 'source':
                rate_list = data['rate_list']
                if 'source' in rate_list:
                    rate_list.remove('source')
                    for rate in rate_list:
                        error_msg = get_live_info(rate)
                        if error_msg:
                            error_msges.append(error_msg)
            if error_msges:
                return ', '.join(error_msges)

        error_msg = get_live_info()
        if error_msg:
            self.logger.debug('error_msg:\n' + error_msg)
        assert len(info.stream_types), error_msg or 'can\'t play this live video!!'
        info.stream_types = sorted(info.stream_types, key=self.ids.index)

        return info
开发者ID:zhangn1985,项目名称:ykdl,代码行数:55,代码来源:pps.py

示例8: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
 def prepare(self):
     info = VideoInfo(self.name)
     info.live = True
     self.vid = self.url[self.url.rfind('/')+1:].split(".")[0]
     json_request_url = 'http://www.yizhibo.com/live/h5api/get_basic_live_info?scid={}'.format(self.vid)
     content = json.loads(get_content(json_request_url))
     assert content['result'] == 1, "Error : {}".format(content['result'])
     info.title = content['data']['live_title']
     info.artist = content['data']['nickname']
     info.streams['current'] = {'container': 'm3u8', 'video_profile': 'current', 'src' : [content['data']['play_url']], 'size': float('inf')}
     info.stream_types.append('current')
     return info
开发者ID:PureTV,项目名称:ykdl,代码行数:14,代码来源:yizhibo.py

示例9: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name)
        if not self.vid:
            self.vid = match1(self.url, 'yinyue/(\d+)')

        html = get_content("http://player.kuwo.cn/webmusic/st/getNewMuiseByRid?rid=MUSIC_{}".format(self.vid))
        info.title = match1(html, "<name>(.*)</name>")
        info.artist = match1(html, "<artist>(.*)</artist>")
        for t in self.supported_stream_types:
            url=get_content("http://antiserver.kuwo.cn/anti.s?format={}&rid=MUSIC_{}&type=convert_url&response=url".format(t, self.vid))

            info.stream_types.append(t)
            info.streams[t] = {'container': t, 'video_profile': 'current', 'src' : [url], 'size': 0}
        return info
开发者ID:PureTV,项目名称:ykdl,代码行数:16,代码来源:kuwo.py

示例10: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name, True)
        if not self.vid:
            self.vid = match1(self.url, 'quanmin.tv/(\w+)')

        content = get_content(self.api_url.format(self.vid))
        stream_data = json.loads(content)
        assert stream_data['status'], u"error: (⊙o⊙)主播暂时不在家,看看其他精彩直播吧!"
        info.title = stream_data["title"]
        info.artist = stream_data['nick']


        info.stream_types.append('current')
        info.streams['current'] = {'container': 'flv', 'video_profile': 'current', 'src' : [self.live_base.format(self.vid)], 'size': float('inf')}
        return info
开发者ID:PureTV,项目名称:ykdl,代码行数:17,代码来源:quanmin.py

示例11: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name)
        if not self.vid:
            self.vid = match1(self.url, 'http://music.baidu.com/song/([\d]+)')

        param = urlencode({'songIds': self.vid})

        song_data = json.loads(get_content('http://play.baidu.com/data/music/songlink', data=compact_bytes(param, 'utf-8')))['data']['songList'][0]

        info.title = song_data['songName']
        info.artist = song_data['artistName']

        info.stream_types.append('current')
        info.streams['current'] = {'container': song_data['format'], 'video_profile': 'current', 'src' : [song_data['songLink']], 'size': song_data['size']}
        return info
开发者ID:wwqgtxx,项目名称:ykdl,代码行数:17,代码来源:music.py

示例12: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        handlers = [HTTPCookieProcessor()]
        if default_proxy_handler:
            handlers += default_proxy_handler
        install_opener(build_opener(*handlers))

        info = VideoInfo(self.name, True)
        html = get_content(self.url)
        self.vid = match1(html, '"userNum":(\d+)')
        live_id = match1(html, '"liveId":\s*(\d+)')
        assert live_id, u"主播正在休息"
        info.stream_types.append('current')
        info.streams['current'] = {'container': 'mp4', 'src': ['http://extapi.live.netease.com/redirect/video/{}'.format(self.vid)], 'size' : float('inf')}
        info.artist = match1(html, '"nick":"([^"]+)')
        info.title = match1(html, '<title>([^<]+)').split('-')[0]
        return info
开发者ID:wwqgtxx,项目名称:ykdl,代码行数:18,代码来源:bobo.py

示例13: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name)

        self.vid = match1(self.url, 'video/(\d+)')

        api_url = 'https://api.vc.bilibili.com/clip/v1/video/detail?video_id={}'.format(self.vid)

        video_data = json.loads(get_content(api_url))

        info.title = video_data['data']['item']['description']
        info.artist = video_data['data']['user']['name']

        info.stream_types.append('current')
        info.streams['current'] = {'container': 'mp4', 'src' : [video_data['data']['item']['video_playurl']], 'size': int(video_data['data']['item']['video_size'])}

        return info
开发者ID:wwqgtxx,项目名称:ykdl,代码行数:18,代码来源:vc.py

示例14: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        info = VideoInfo(self.name, True)
        if not self.vid:
            html = get_content(self.url)
            self.vid = match1(html, 'cid=([^&]+)')
            t = match1(html, '<title>([^<]+)').split('-')
            info.title = t[0]
            info.artist = t[1]

        data = get_content('http://live.bilibili.com/api/playurl?cid={}'.format(self.vid))
        urls = [matchall(data, ['CDATA\[([^\]]+)'])[1]]
        size = float('inf')
        ext = 'flv'

        info.stream_types.append('current')
        info.streams['current'] = {'container': ext, 'video_profile': 'current', 'src' : urls, 'size': size}
        return info
开发者ID:gitter-badger,项目名称:ykdl,代码行数:19,代码来源:live.py

示例15: prepare

# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import artist [as 别名]
    def prepare(self):
        add_header("Referer", "http://music.163.com/")
        video = VideoInfo(self.name)
        if not self.vid:
            self.vid =  match1(self.url, '\?id=(.*)', 'mv/(\d+)')

        api_url = "http://music.163.com/api/mv/detail/?id={}&ids=[{}]&csrf_token=".format(self.vid, self.vid)
        mv = json.loads(get_content(api_url))['data']
        video.title = mv['name']
        video.artist = mv['artistName']
        for code in self.supported_stream_code:
            if code in mv['brs']:
                stream_id = self.code_2_id[code]
                stream_profile = self.code_2_profile[code]
                video.stream_types.append(stream_id)
                video.streams[stream_id] = {'container': 'mp4', 'video_profile': stream_profile, 'src' : [mv['brs'][code]], 'size': 0}
        return video
开发者ID:PureTV,项目名称:ykdl,代码行数:19,代码来源:mv.py


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