Encode filename with UTF-8 before upload (fixes #5)
This commit is contained in:
parent
10b2232165
commit
6cdfb39055
2 changed files with 2 additions and 2 deletions
|
|
@ -34,7 +34,7 @@ class TestYTMusic(unittest.TestCase):
|
|||
self.assertEqual(len(results), 50)
|
||||
|
||||
def test_upload_song(self):
|
||||
response = youtube_auth.upload_song('../Madeon.mp3')
|
||||
response = youtube_auth.upload_song('../12 - Turning Point 자.mp3')
|
||||
self.assertEqual(response, 'STATUS_SUCCEEDED')
|
||||
|
||||
def test_delete_uploaded_song(self):
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ class YTMusic:
|
|||
headers = self.headers
|
||||
upload_url = "https://upload.youtube.com/upload/usermusic/http?authuser=0"
|
||||
filesize = os.path.getsize(filepath)
|
||||
body = "filename=" + ntpath.basename(filepath)
|
||||
body = ("filename=" + ntpath.basename(filepath)).encode('utf-8')
|
||||
headers['content-type'] = 'application/x-www-form-urlencoded;charset=utf-8'
|
||||
headers['X-Goog-Upload-Command'] = 'start'
|
||||
headers['X-Goog-Upload-Header-Content-Length'] = str(filesize)
|
||||
|
|
|
|||
Loading…
Reference in a new issue