示例#1
0
 def get_lyric(self, song, artist):
     song_en = en(song)
     art_en = en(artist)
     response = urllib2.urlopen(self.address+song+'/'+artist)
     result = json.loads(respons.read())['result']
     if result == []:
         print 'No lyric found for this song'
     else:
         lyric = result[0]['lrc']
         req = urllib2.Request(lyric)
         fd = urllib2.urlopen(req)
         data = fd.read()
         print data
示例#2
0
 def get_lyric(self, song, artist):
     song_en = en(song)
     art_en = en(artist)
     response = urllib2.urlopen(self.address + song + '/' + artist)
     result = json.loads(respons.read())['result']
     if result == []:
         print 'No lyric found for this song'
     else:
         lyric = result[0]['lrc']
         req = urllib2.Request(lyric)
         fd = urllib2.urlopen(req)
         data = fd.read()
         print data
示例#3
0
 def _create_hashcode(self, track_id):
     from base64 import b64encode as en
     import hmac
     key = 'ec9b7c7122ffeed819dc1831af42ea8f'
     hashcode = hmac.new(key, en(track_id)).hexdigest()
     return hashcode