If song_url is none, just return.
This commit is contained in:
parent
e492deb771
commit
f5bc763ab3
|
@ -71,10 +71,7 @@ class CloudApi(object):
|
|||
params = {'ids': [song_id], 'br': bit_rate, 'csrf_token': csrf}
|
||||
result = self.post_request(url, params)
|
||||
song_url = result['data'][0]['url']
|
||||
if song_url is None:
|
||||
print('Song {} is not available due to copyright issue. => {}'.format(song_id, result))
|
||||
else:
|
||||
return song_url
|
||||
return song_url
|
||||
|
||||
def get_hot_songs(self, artist_id):
|
||||
"""
|
||||
|
|
|
@ -45,6 +45,9 @@ def download_song_by_song(song, download_folder, sub_folder=True):
|
|||
|
||||
# download song
|
||||
song_url = api.get_song_url(song_id)
|
||||
if song_url is None:
|
||||
print('Song <<{}>> is not available due to copyright issue!'.format(song_name))
|
||||
return
|
||||
is_already_download = download_file(song_url, song_file_name, song_download_folder)
|
||||
if is_already_download:
|
||||
print('Mp3 file already download:', song_file_name)
|
||||
|
|
Loading…
Reference in New Issue