[PR #53] [MERGED] Fix for incomplete get_library_songs request #547

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

📋 Pull Request Information

Original PR: https://github.com/sigma67/ytmusicapi/pull/53
Author: @czifumasa
Created: 8/1/2020
Status: Merged
Merged: 9/1/2020
Merged by: @sigma67

Base: masterHead: master


📝 Commits (2)

  • e432593 Resend request when ytm returns invalid per_page count for get_library_songs
  • 6d8bbc0 Added optional validate_reponses param to get_library_songs

📊 Changes

3 files changed (+95 additions, -14 deletions)

View changed files

📝 ytmusicapi/mixins/library.py (+30 -14)
📝 ytmusicapi/parsers/library.py (+11 -0)
📝 ytmusicapi/parsers/utils.py (+54 -0)

📄 Description

This is my attempt to fix #52.
When YTMusic sends incomplete response with less then per_page (25 songs), then request is retried till valid response or till max_retries number is reached. Usually after single retry, the response is valid. I know it's not the perfect solution, it costs performance to retry these request and complicates code a bit, but I think that more accurate results are better than fast ones.

resend_request_until_parsed_response_is_valid() is generic method and can be used to validate any request. Currently I fixed only get_library_songs call. Let me know, what you think about it. If you approve the solution, I will prepare another fix for get_playlist.


🔄 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/53 **Author:** [@czifumasa](https://github.com/czifumasa) **Created:** 8/1/2020 **Status:** ✅ Merged **Merged:** 9/1/2020 **Merged by:** [@sigma67](https://github.com/sigma67) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (2) - [`e432593`](https://github.com/sigma67/ytmusicapi/commit/e4325938a26ff804668c54773baa6ccfd00dfa2f) Resend request when ytm returns invalid per_page count for get_library_songs - [`6d8bbc0`](https://github.com/sigma67/ytmusicapi/commit/6d8bbc006d11f9871bce8e2bf96d8c4ddc2ca296) Added optional validate_reponses param to get_library_songs ### 📊 Changes **3 files changed** (+95 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `ytmusicapi/mixins/library.py` (+30 -14) 📝 `ytmusicapi/parsers/library.py` (+11 -0) 📝 `ytmusicapi/parsers/utils.py` (+54 -0) </details> ### 📄 Description This is my attempt to fix #52. When YTMusic sends incomplete response with less then per_page (25 songs), then request is retried till valid response or till max_retries number is reached. Usually after single retry, the response is valid. I know it's not the perfect solution, it costs performance to retry these request and complicates code a bit, but I think that more accurate results are better than fast ones. `resend_request_until_parsed_response_is_valid()` is generic method and can be used to validate any request. Currently I fixed only `get_library_songs call`. Let me know, what you think about it. If you approve the solution, I will prepare another fix for `get_playlist`. --- <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:26 +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#547
No description provided.