def get_artist_info(artistid, artist=None): '''Get artist info, if cached, just return it. Artist pic is also retrieved and saved to info['pic'] ''' if artistid == 0: url = ''.join([ SEARCH, 'stype=artistinfo&artist=', Utils.encode_uri(artist), ]) else: url = ''.join([ SEARCH, 'stype=artistinfo&artistid=', str(artistid), ]) #print('Net.get_artist_info, url:', url) req_content = urlopen(url) if not req_content: return None try: info = Utils.json_loads_single(req_content.decode()) except ValueError as e: print('Error: Net.get_artist_info:', e, 'with url:', url) return None # set logo size to 100x100 pic_path = info['pic'] url = get_artist_pic_url(pic_path) if url: info['pic'] = get_image(url) else: info['pic'] = None return info
def get_artist_info(artistid, artist=None): '''Get artist info, if cached, just return it. Artist pic is also retrieved and saved to info['pic'] ''' if artistid == 0: url = ''.join([ SEARCH, 'stype=artistinfo&artist=', Utils.encode_uri(artist), ]) else: url = ''.join([ SEARCH, 'stype=artistinfo&artistid=', str(artistid), ]) req_content = urlopen(url) if not req_content: return None info = Utils.json_loads_single(req_content.decode()) if not info: return None # set logo size to 100x100 pic_path = info['pic'] url = get_artist_pic_url(pic_path) if url: info['pic'] = get_image(url) else: info['pic'] = None return info
def get_artist_info(artistid, artist=None): ''' Get artist info, if cached, just return it. Artist pic is also retrieved and saved to info['pic'] ''' if artistid == 0: url = ''.join([ SEARCH, 'stype=artistinfo&artist=', Utils.encode_uri(artist), ]) else: url = ''.join([ SEARCH, 'stype=artistinfo&artistid=', str(artistid), ]) #print('Net.get_artist_info, url:', url) req_content = urlopen(url) if req_content is None: return None try: info = Utils.json_loads_single(req_content.decode()) except Exception as e: print('Error: Net.get_artist_info:', e, 'with url:', url) return None # set logo size to 100x100 pic_path = info['pic'] url = get_artist_pic_url(pic_path) if url: info['pic'] = get_image(url) else: info['pic'] = None return info
def get_recommend_lists(artist): url = ''.join([ 'http://artistpicserver.kuwo.cn/pic.web?', 'type=big_artist_pic&pictype=url&content=list&&id=0&from=pc', '&name=', Utils.encode_uri(artist), ]) req_content = urlopen(url) if not req_content: return None return req_content.decode()