[GH-ISSUE #1] Fail to upload songs #1

Closed
opened 2026-02-27 22:07:28 +03:00 by kerem · 5 comments
Owner

Originally created by @ccyang2019 on GitHub (Apr 3, 2020).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/1

I tried to use this API to upload songs to youtube music. But always fail to do that.

#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
import os
from ytmusicapi import YTMusic
ytmusic = YTMusic('yt_header.json')
file = "test.mp3"
status=ytmusic.upload_song(file)
print(status)

I got return status "STATUS_SUCCEEDED", but I fail to see my uploaded song in youtube music.

200
{'X-GUploader-UploadID': 'AEnB2UpJYZnMeaGnKkJuNPM1Q75X5WaFXkxO8BGfxtUcxjN7tAqhIJysFn3CF5c0zsd2iGteKHcsN87KGhA-qEG-6NMpcnB0i1qEHxyyvOeYh4MSChuPVd4', 'X-Goog-Upload-Status': 'final', 'Content-Length': '0', 'Date': 'Fri, 03 Apr 2020 07:48:50 GMT', 'Server': 'UploadServer', 'Content-Type': 'text/html; charset=UTF-8'}

I tried to do some fail experiments and the return status is always "STATUS_SUCCEEDED"

  • wrong headers_auth.json value in Authorization field
  • upload a mp4 file
  • upload the same song
Originally created by @ccyang2019 on GitHub (Apr 3, 2020). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/1 I tried to use this API to upload songs to youtube music. But always fail to do that. ``` #!/usr/bin/env python3 # -*- coding:UTF-8 -*- import os from ytmusicapi import YTMusic ytmusic = YTMusic('yt_header.json') file = "test.mp3" status=ytmusic.upload_song(file) print(status) ``` I got return status "__STATUS_SUCCEEDED__", but I fail to see my uploaded song in youtube music. ``` 200 {'X-GUploader-UploadID': 'AEnB2UpJYZnMeaGnKkJuNPM1Q75X5WaFXkxO8BGfxtUcxjN7tAqhIJysFn3CF5c0zsd2iGteKHcsN87KGhA-qEG-6NMpcnB0i1qEHxyyvOeYh4MSChuPVd4', 'X-Goog-Upload-Status': 'final', 'Content-Length': '0', 'Date': 'Fri, 03 Apr 2020 07:48:50 GMT', 'Server': 'UploadServer', 'Content-Type': 'text/html; charset=UTF-8'} ``` I tried to do some fail experiments and the return status is always "__STATUS_SUCCEEDED__" - wrong headers_auth.json value in Authorization field - upload a mp4 file - upload the same song
kerem 2026-02-27 22:07:28 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@sigma67 commented on GitHub (Apr 3, 2020):

Hey, please make sure you're using the latest version 0.5.1. There was a bug with uploads in 0.5. In particular, there is now an authentication check when providing auth headers, which should have triggered on the first of your fail tests.

I tested the code you posted and it worked fine for me, so there is no issue with it. There is also a processing delay, so your song should first show up as "processing" in the songs section of your library.

As for mp4 files and same songs, the library currently does not check this. Duplicates can be uploaded without issues. So make sure your file is correct.

<!-- gh-comment-id:608366768 --> @sigma67 commented on GitHub (Apr 3, 2020): Hey, please make sure you're using the latest version 0.5.1. There was a bug with uploads in 0.5. In particular, there is now an authentication check when providing auth headers, which should have triggered on the first of your fail tests. I tested the code you posted and it worked fine for me, so there is no issue with it. There is also a processing delay, so your song should first show up as "processing" in the songs section of your library. As for mp4 files and same songs, the library currently does not check this. Duplicates can be uploaded without issues. So make sure your file is correct.
Author
Owner

@ccyang2019 commented on GitHub (Apr 3, 2020):

yes. thanks for your comment.
It should be working now. Change another account with less uploaded songs to debug this issue. I can see my uploaded mp3 songs now. It takes several minutes to process my uploaded songs.
image
But I still have following issues under debugging:

  1. only mp3 song works. my ".m4a", and ".flac" songs uploaded and show processing, then after several minutes no showed in the uploaded list.
    As attached, the 2 song processing in above picture, which are not showed in the uploaded list after several minutes.
    image

  2. duplicated songs not detected like web upload flow.

  3. mp3 tag like "album", "title" are lost after uploaded. it's ok by web upload .
    image

<!-- gh-comment-id:608434378 --> @ccyang2019 commented on GitHub (Apr 3, 2020): yes. thanks for your comment. It should be working now. Change another account with less uploaded songs to debug this issue. I can see my uploaded mp3 songs now. It takes several minutes to process my uploaded songs. ![image](https://user-images.githubusercontent.com/47751514/78364359-e520ff80-75ef-11ea-96db-96c80611ec27.png) But I still have following issues under debugging: 1. only mp3 song works. my "*.m4a", and "*.flac" songs uploaded and show processing, then after several minutes no showed in the uploaded list. As attached, the 2 song processing in above picture, which are not showed in the uploaded list after several minutes. ![image](https://user-images.githubusercontent.com/47751514/78365580-db000080-75f1-11ea-8cb6-c19fac62c16d.png) 1. duplicated songs not detected like web upload flow. 1. mp3 tag like "album", "title" are lost after uploaded. it's ok by web upload . ![image](https://user-images.githubusercontent.com/47751514/78365432-ac822580-75f1-11ea-8c86-7f995cad513f.png)
Author
Owner

@sigma67 commented on GitHub (Apr 4, 2020):

Hey, thanks for bringing up these issues. They are valid.

  1. I have not tested this with other file formats. Let me know if you're able to figure out the issue. Do m4a and flac work on the web UI?
  2. The web upload flow only detects duplicates after the upload. Not sure why they're not detected when uploading with the library. It might have something to do with the additional 'OPTIONS' calls that the web UI does, which I left out since it worked without them. I'll look into this.
  3. I'm not sure why mp3 tags and album picture are lost when uploading with the library function. Might also be related to the OPTIONS calls.

Let me know if you've done any additional experiments or reverse engineered something successfully.

<!-- gh-comment-id:609049196 --> @sigma67 commented on GitHub (Apr 4, 2020): Hey, thanks for bringing up these issues. They are valid. 1. I have not tested this with other file formats. Let me know if you're able to figure out the issue. Do m4a and flac work on the web UI? 2. The web upload flow only detects duplicates after the upload. Not sure why they're not detected when uploading with the library. It might have something to do with the additional 'OPTIONS' calls that the web UI does, which I left out since it worked without them. I'll look into this. 3. I'm not sure why mp3 tags and album picture are lost when uploading with the library function. Might also be related to the OPTIONS calls. Let me know if you've done any additional experiments or reverse engineered something successfully.
Author
Owner

@sigma67 commented on GitHub (Apr 12, 2020):

Hey, just letting you know that I've found the problem. Files should now be uploaded correctly. All three issues should be fixed in the latest version v0.5.2

<!-- gh-comment-id:612658720 --> @sigma67 commented on GitHub (Apr 12, 2020): Hey, just letting you know that I've found the problem. Files should now be uploaded correctly. All three issues should be fixed in the latest version v0.5.2
Author
Owner

@ccyang2019 commented on GitHub (Apr 13, 2020):

Hi sigma67,

yes. my issue is solved in v.0.5.2. I can upload my *.flac files successfully now.

thank you !

<!-- gh-comment-id:612712931 --> @ccyang2019 commented on GitHub (Apr 13, 2020): Hi sigma67, yes. my issue is solved in v.0.5.2. I can upload my *.flac files successfully now. thank you !
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#1
No description provided.