本文整理汇总了Python中api.NetEase.dig_info方法的典型用法代码示例。如果您正苦于以下问题:Python NetEase.dig_info方法的具体用法?Python NetEase.dig_info怎么用?Python NetEase.dig_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.NetEase
的用法示例。
在下文中一共展示了NetEase.dig_info方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import dig_info [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
示例2: __init__
# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import dig_info [as 别名]
#.........这里部分代码省略.........
webbrowser.open_new_tab('http://music.163.com/#/song?id=' + str(self.player.playing_id))
self.ui.build_process_bar(self.player.process_location, self.player.process_length,
self.player.playing_flag,
self.player.pause_flag, self.storage.database['player_info']['playing_mode'])
self.ui.build_menu(self.datatype, self.title, self.datalist, self.offset, self.index, self.step, self.START)
self.player.stop()
self.cache.quit()
self.storage.save()
curses.endwin()
def dispatch_enter(self, idx):
# The end of stack
netease = self.netease
datatype = self.datatype
title = self.title
datalist = self.datalist
offset = self.offset
index = self.index
self.stack.append([datatype, title, datalist, offset, index])
if idx > len(self.datalist):
return False
if datatype == 'main':
self.choice_channel(idx)
# 该艺术家的热门歌曲
elif datatype == 'artists':
artist_id = datalist[idx]['artist_id']
songs = netease.artists(artist_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['artists_name']
# 该专辑包含的歌曲
elif datatype == 'albums':
album_id = datalist[idx]['album_id']
songs = netease.album(album_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['albums_name']
# 精选歌单选项
elif datatype == 'playlists':
data = self.datalist[idx]
self.datatype = data['datatype']
self.datalist = netease.dig_info(data['callback'](), self.datatype)
self.title += ' > ' + data['title']
# 全站置顶歌单包含的歌曲
elif datatype == 'top_playlists':
log.debug(datalist)
playlist_id = datalist[idx]['playlist_id']
songs = netease.playlist_detail(playlist_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['playlists_name']
# 分类精选
elif datatype == 'playlist_classes':
# 分类名称
data = self.datalist[idx]
self.datatype = 'playlist_class_detail'
self.datalist = netease.dig_info(data, self.datatype)
示例3: __init__
# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import dig_info [as 别名]
#.........这里部分代码省略.........
self.ui.build_process_bar(
self.player.process_location,
self.player.process_length,
self.player.playing_flag,
self.player.pause_flag,
self.storage.database["player_info"]["playing_mode"],
)
self.ui.build_menu(self.datatype, self.title, self.datalist, self.offset, self.index, self.step, self.START)
self.player.stop()
self.cache.quit()
self.storage.save()
curses.endwin()
def dispatch_enter(self, idx):
# The end of stack
netease = self.netease
datatype = self.datatype
title = self.title
datalist = self.datalist
offset = self.offset
index = self.index
self.stack.append([datatype, title, datalist, offset, index])
if datatype == "main":
self.choice_channel(idx)
# 该艺术家的热门歌曲
elif datatype == "artists":
artist_id = datalist[idx]["artist_id"]
songs = netease.artists(artist_id)
self.datatype = "songs"
self.datalist = netease.dig_info(songs, "songs")
self.title += " > " + datalist[idx]["artists_name"]
# 该专辑包含的歌曲
elif datatype == "albums":
album_id = datalist[idx]["album_id"]
songs = netease.album(album_id)
self.datatype = "songs"
self.datalist = netease.dig_info(songs, "songs")
self.title += " > " + datalist[idx]["albums_name"]
# 精选歌单选项
elif datatype == "playlists":
data = self.datalist[idx]
self.datatype = data["datatype"]
self.datalist = netease.dig_info(data["callback"](), self.datatype)
self.title += " > " + data["title"]
# 全站置顶歌单包含的歌曲
elif datatype == "top_playlists":
log.debug(datalist)
playlist_id = datalist[idx]["playlist_id"]
songs = netease.playlist_detail(playlist_id)
self.datatype = "songs"
self.datalist = netease.dig_info(songs, "songs")
self.title += " > " + datalist[idx]["playlists_name"]
# 分类精选
elif datatype == "playlist_classes":
# 分类名称
data = self.datalist[idx]
self.datatype = "playlist_class_detail"
self.datalist = netease.dig_info(data, self.datatype)
示例4: __init__
# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import dig_info [as 别名]
#.........这里部分代码省略.........
elif key == ord('g'):
if datatype == 'help':
webbrowser.open_new_tab('https://github.com/darknessomi/musicbox')
self.ui.build_process_bar(self.player.process_location, self.player.process_length,
self.player.playing_flag,
self.player.pause_flag, self.storage.database['player_info']['playing_mode'])
self.ui.build_menu(self.datatype, self.title, self.datalist, self.offset, self.index, self.step, self.START)
self.player.stop()
self.cache.quit()
self.storage.save()
curses.endwin()
def dispatch_enter(self, idx):
# The end of stack
netease = self.netease
datatype = self.datatype
title = self.title
datalist = self.datalist
offset = self.offset
index = self.index
self.stack.append([datatype, title, datalist, offset, index])
if datatype == 'main':
self.choice_channel(idx)
# 该艺术家的热门歌曲
elif datatype == 'artists':
artist_id = datalist[idx]['artist_id']
songs = netease.artists(artist_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['artists_name']
# 该专辑包含的歌曲
elif datatype == 'albums':
album_id = datalist[idx]['album_id']
songs = netease.album(album_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['albums_name']
# 精选歌单选项
elif datatype == 'playlists':
data = self.datalist[idx]
self.datatype = data['datatype']
self.datalist = netease.dig_info(data['callback'](), self.datatype)
self.title += ' > ' + data['title']
# 全站置顶歌单包含的歌曲
elif datatype == 'top_playlists':
log.debug(datalist)
playlist_id = datalist[idx]['playlist_id']
songs = netease.playlist_detail(playlist_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['playlists_name']
# 分类精选
elif datatype == 'playlist_classes':
# 分类名称
data = self.datalist[idx]
self.datatype = 'playlist_class_detail'
self.datalist = netease.dig_info(data, self.datatype)
示例5: Menu
# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import dig_info [as 别名]
#.........这里部分代码省略.........
self.ui.build_process_bar(
self.player.process_location, self.player.process_length,
self.player.playing_flag, self.player.pause_flag,
self.storage.database['player_info']['playing_mode'])
self.ui.build_menu(self.datatype, self.title, self.datalist,
self.offset, self.index, self.step, self.START)
self.player.stop()
self.cache.quit()
self.storage.save()
curses.endwin()
def dispatch_enter(self, idx):
# The end of stack
netease = self.netease
datatype = self.datatype
title = self.title
datalist = self.datalist
offset = self.offset
index = self.index
self.stack.append([datatype, title, datalist, offset, index])
if idx > len(self.datalist):
return False
if datatype == 'main':
self.choice_channel(idx)
# 该艺术家的热门歌曲
elif datatype == 'artists':
artist_id = datalist[idx]['artist_id']
songs = netease.artists(artist_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['artists_name']
# 该专辑包含的歌曲
elif datatype == 'albums':
album_id = datalist[idx]['album_id']
songs = netease.album(album_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['albums_name']
# 精选歌单选项
elif datatype == 'playlists':
data = self.datalist[idx]
self.datatype = data['datatype']
self.datalist = netease.dig_info(data['callback'](), self.datatype)
self.title += ' > ' + data['title']
# 全站置顶歌单包含的歌曲
elif datatype == 'top_playlists':
playlist_id = datalist[idx]['playlist_id']
songs = netease.playlist_detail(playlist_id)
self.datatype = 'songs'
self.datalist = netease.dig_info(songs, 'songs')
self.title += ' > ' + datalist[idx]['playlists_name']
# 分类精选
elif datatype == 'playlist_classes':
# 分类名称
data = self.datalist[idx]
self.datatype = 'playlist_class_detail'
self.datalist = netease.dig_info(data, self.datatype)
self.title += ' > ' + data
示例6: NetEase
# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import dig_info [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'}