From cd3d043d466fcd7045a49df81fc6430b92f8d917 Mon Sep 17 00:00:00 2001 From: codezjx Date: Sat, 12 Aug 2017 21:00:15 +0800 Subject: [PATCH] #7 Bugfix: Replace illegal character with ' '. --- ncm/downloader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ncm/downloader.py b/ncm/downloader.py index 82575b0..c3ea6b4 100644 --- a/ncm/downloader.py +++ b/ncm/downloader.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os +import re import requests from ncm import config @@ -19,7 +20,7 @@ def download_song_by_song(song, download_folder, sub_folder=True): # get song info api = CloudApi() song_id = song['id'] - song_name = song['name'].replace('/', '-') # Replace '/' with '-', open() method not support '/' yet! + song_name = re.sub(r'[\\/:*?"<>|]', ' ', song['name']) # Replace illegal character with ' ' artist_name = song['artists'][0]['name'] album_name = song['album']['name']