[PR #580] [MERGED] Gracefully retrieve uploaded songs with a blank duration (#578) #660

Closed
opened 2026-02-27 23:01:53 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/sigma67/ytmusicapi/pull/580
Author: @apastel
Created: 5/9/2024
Status: Merged
Merged: 5/11/2024
Merged by: @sigma67

Base: mainHead: 578-error-when-duration-blank


📝 Commits (6)

  • 65ed89b add unit test that attempts to retrieve a song after its been uploaded
  • c17924b prevent parsing errors when an uploaded song lacks a duration
  • 343bc04 update unit test to delete/re-upload song if it already is uploaded
  • 0e0c7b4 format
  • 04b44f1 fix test
  • 80129a5 add another sleep to end2end playlist

📊 Changes

4 files changed (+41 additions, -2 deletions)

View changed files

📝 tests/mixins/test_playlists.py (+1 -0)
📝 tests/mixins/test_uploads.py (+35 -0)
📝 ytmusicapi/parsers/_utils.py (+2 -1)
📝 ytmusicapi/parsers/uploads.py (+3 -1)

📄 Description

Fixes #578

This prevents a possible KeyError or a int-parsing error when an uploaded song has a duration that is not a valid value like "3:31".

Per-recent changes by Google, an uploaded song can have a duration of ' ' or simply not have a fixedColumns object at all. This is most commonly seen immediately after uploading a song but can be seen in other cases as well.

I added a unit test that exercises this. It uploads a song and then starts calling get_library_upload_songs() in a loop, waiting for the song to be available. Without my duration fix, this encounters a parsing error. With the fix, it succeeds.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/sigma67/ytmusicapi/pull/580 **Author:** [@apastel](https://github.com/apastel) **Created:** 5/9/2024 **Status:** ✅ Merged **Merged:** 5/11/2024 **Merged by:** [@sigma67](https://github.com/sigma67) **Base:** `main` ← **Head:** `578-error-when-duration-blank` --- ### 📝 Commits (6) - [`65ed89b`](https://github.com/sigma67/ytmusicapi/commit/65ed89bed45401c23a39635454608b56aacde3ae) add unit test that attempts to retrieve a song after its been uploaded - [`c17924b`](https://github.com/sigma67/ytmusicapi/commit/c17924bf086ae478a993cbd19a800a2f16390774) prevent parsing errors when an uploaded song lacks a duration - [`343bc04`](https://github.com/sigma67/ytmusicapi/commit/343bc045f02339e95d818de9a2b35cf1339eb381) update unit test to delete/re-upload song if it already is uploaded - [`0e0c7b4`](https://github.com/sigma67/ytmusicapi/commit/0e0c7b467726aae6486ceab98f000f5d840e4e0e) format - [`04b44f1`](https://github.com/sigma67/ytmusicapi/commit/04b44f1e47e25c4ea5d40f2affee3195b820a215) fix test - [`80129a5`](https://github.com/sigma67/ytmusicapi/commit/80129a5605b3b96c052e34b21204e1df7cf8a6b7) add another sleep to end2end playlist ### 📊 Changes **4 files changed** (+41 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/mixins/test_playlists.py` (+1 -0) 📝 `tests/mixins/test_uploads.py` (+35 -0) 📝 `ytmusicapi/parsers/_utils.py` (+2 -1) 📝 `ytmusicapi/parsers/uploads.py` (+3 -1) </details> ### 📄 Description Fixes #578 This prevents a possible KeyError or a int-parsing error when an uploaded song has a duration that is not a valid value like "3:31". Per-recent changes by Google, an uploaded song can have a duration of `' '` or simply not have a `fixedColumns` object at all. This is most commonly seen immediately after uploading a song but can be seen in other cases as well. I added a unit test that exercises this. It uploads a song and then starts calling `get_library_upload_songs()` in a loop, waiting for the song to be available. Without my duration fix, this encounters a parsing error. With the fix, it succeeds. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 23:01:53 +03:00
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#660
No description provided.