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


Python NetEase.songs_detail方法代码示例

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


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

示例1: search_music

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import songs_detail [as 别名]
def search_music(q, limit):
	netease = NetEase()
	r = netease.search(q, limit=limit)
	if r['code'] != 200:
		return jsonify({
			"error"		:	True
			})
	else:
		ids = []
		for song in r['result']['songs']:
			ids.append(song['id'])
		musics = netease.songs_detail(ids)
		outputs = []
		for music in musics:
			outputs.append({
				"error"	:	False,
				"name"	:	music['name'],
				"cover"	:	music['album']['blurPicUrl'],
				"album_name":	music['album']['name'],
				"author": 	music['artists'][0]['name'],
				"url"	:	music['mp3Url']
				})
		outputs = {
			"error"		:	False,
			"type"		:	"music",
			"musics"	:	outputs
		}
		return jsonify(outputs)
开发者ID:343829084,项目名称:NetEase-MusicBox,代码行数:30,代码来源:index.py

示例2: __init__

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import songs_detail [as 别名]
    def __init__(self, song_name):
        self.mp3_date = None
        netease = NetEase()
        data = netease.search(song_name, stype=1, offset=0, total='true', limit=60)
#        print data
        song_ids = []
        if 'songs' in data['result']:
            if 'mp3Url' in data['result']['songs']:
                songs = data['result']['songs']

            else:
                for i in range(0, len(data['result']['songs']) ):
                    song_ids.append( data['result']['songs'][i]['id'] )
                songs = netease.songs_detail(song_ids)
        self.mp3_data = netease.dig_info(songs, 'songs')   #歌曲信息,album, artist, song_name, mp3_url
开发者ID:frank-dkvan,项目名称:RasWxMusicbox,代码行数:17,代码来源:netease.py

示例3: NetEase

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import songs_detail [as 别名]
#import player
from api import NetEase
import mp3play
import time

netease = NetEase()
data = netease.search(u'南山南', stype=1, offset=0, total='true', limit=60)
print data
song_ids = []
if 'songs' in data['result']:
    if 'mp3Url' in data['result']['songs']:
        songs = data['result']['songs']
        print songs
        
    else:
        for i in range(0, len(data['result']['songs']) ):
            song_ids.append( data['result']['songs'][i]['id'] )
        songs = netease.songs_detail(song_ids)
mp3_url_data = netease.dig_info(songs, 'songs') 
print mp3_url_data

for mp3_url  in mp3_url_data:
    print mp3_url['album_name']
    print mp3_url['artist']
    print mp3_url['song_name']
    print mp3_url['mp3_url']
    print '---------------------------'
#{'mp3_url': u'http://m2.music.126.net/GkFXC6qt6rEU2q9KYU-6yQ==/1373290025677371.mp3', 'song_id': 41462137, 'album_name': u'\u6587\u6b66\u8d1d\u94a2\u7434\u6539\u7f16\u4f5c\u54c1\u96c6\uff082015\u5e74\u5168\u96c6\uff09', 'song_name': u'\u5357\u5c71\u5357-\u6587\u6b66\u8d1d\u94a2\u7434\u7248', 'artist': u'\u6587\u6b66\u8d1d'}


开发者ID:yaphone,项目名称:NetEase-MusicBox,代码行数:30,代码来源:test.py


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