[GH-ISSUE #712] Inconsistent Album Retrieval from YouTube Music API #465

Closed
opened 2026-02-27 23:00:56 +03:00 by kerem · 7 comments
Owner

Originally created by @scharc on GitHub (Jan 6, 2025).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/712

Describe the bug
When fetching audiobook content from YouTube Music using the API, there's an inconsistent behavior in album retrieval. While some artists like "Wieso? Weshalb? Warum?" return their complete catalog (~134 albums), other artists like Benjamin Blümchen return only a fraction of their content (10-22 albums out of 160+).

To Reproduce
Steps to reproduce the behavior:

  1. Set up a Python environment with ytmusicapi
  2. Create authentication using browser.json from Firefox cookies
  3. Run a query for the following YouTube Music channels:
    • Benjamin Blümchen (UCorpPhp8NCbXxXQqMLjFNmA)
    • Wieso? Weshalb? Warum? (UCISZHx1LIpYedNC5qvJU9eA)
  4. Observe the inconsistency:
    • Wieso? Weshalb? Warum?: Returns complete catalog (~134 albums)
    • Benjamin Blümchen: Returns only fraction (~10-22 albums out of 160+)

Additional context
Example code showing the inconsistent behavior:

from ytmusicapi import YTMusic
ytmusic = YTMusic("browser.json")

# Test with Wieso? Weshalb? Warum? - Works correctly
artist_data = ytmusic.get_artist("UCISZHx1LIpYedNC5qvJU9eA")
albums_section = artist_data.get('albums', {})
browse_id = albums_section.get('browseId')
params = albums_section.get('params')
www_albums = ytmusic.get_artist_albums(browse_id, params)
# Returns ~134 albums correctly

# Test with Benjamin Blümchen - Incomplete results
artist_data = ytmusic.get_artist("UCorpPhp8NCbXxXQqMLjFNmA")
albums_section = artist_data.get('albums', {})
browse_id = albums_section.get('browseId')
params = albums_section.get('params')
ben_albums = ytmusic.get_artist_albums(browse_id, params)
# Returns only ~10 albums

Attempted workarounds:

  1. Using different search terms including German spelling variations (ü/ue)
  2. Increasing search limit to 500
  3. Using multiple search methods (direct API, search, playlist content)
  4. Trying different content types (albums, singles, shows)
  5. Using ignore_spelling=True to prevent auto-correction

Expected behavior:

  • Wieso? Weshalb? Warum?: ~134 albums (working correctly)
  • Benjamin Blümchen: ~160+ albums
  • Other German audiobook series: Complete catalogs

Actual behavior:

  • Wieso? Weshalb? Warum?: ~134 albums (working correctly)
  • Benjamin Blümchen: 10-22 albums (varies by method)
  • Others: Similarly incomplete results

This inconsistency suggests the issue might be related to:

  • Different channel/content organization on YouTube Music
  • Possible pagination or content grouping differences
  • API limitations for specific content types or channels

Environment:

  • Python 3.12
  • ytmusicapi 1.9.1
  • Platform: Linux/Ubuntu with Wayland
Originally created by @scharc on GitHub (Jan 6, 2025). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/712 **Describe the bug** When fetching audiobook content from YouTube Music using the API, there's an inconsistent behavior in album retrieval. While some artists like "Wieso? Weshalb? Warum?" return their complete catalog (~134 albums), other artists like Benjamin Blümchen return only a fraction of their content (10-22 albums out of 160+). **To Reproduce** Steps to reproduce the behavior: 1. Set up a Python environment with ytmusicapi 2. Create authentication using browser.json from Firefox cookies 3. Run a query for the following YouTube Music channels: - Benjamin Blümchen (UCorpPhp8NCbXxXQqMLjFNmA) - Wieso? Weshalb? Warum? (UCISZHx1LIpYedNC5qvJU9eA) 4. Observe the inconsistency: - Wieso? Weshalb? Warum?: Returns complete catalog (~134 albums) - Benjamin Blümchen: Returns only fraction (~10-22 albums out of 160+) **Additional context** Example code showing the inconsistent behavior: ```python from ytmusicapi import YTMusic ytmusic = YTMusic("browser.json") # Test with Wieso? Weshalb? Warum? - Works correctly artist_data = ytmusic.get_artist("UCISZHx1LIpYedNC5qvJU9eA") albums_section = artist_data.get('albums', {}) browse_id = albums_section.get('browseId') params = albums_section.get('params') www_albums = ytmusic.get_artist_albums(browse_id, params) # Returns ~134 albums correctly # Test with Benjamin Blümchen - Incomplete results artist_data = ytmusic.get_artist("UCorpPhp8NCbXxXQqMLjFNmA") albums_section = artist_data.get('albums', {}) browse_id = albums_section.get('browseId') params = albums_section.get('params') ben_albums = ytmusic.get_artist_albums(browse_id, params) # Returns only ~10 albums ``` Attempted workarounds: 1. Using different search terms including German spelling variations (ü/ue) 2. Increasing search limit to 500 3. Using multiple search methods (direct API, search, playlist content) 4. Trying different content types (albums, singles, shows) 5. Using ignore_spelling=True to prevent auto-correction Expected behavior: - Wieso? Weshalb? Warum?: ~134 albums (working correctly) - Benjamin Blümchen: ~160+ albums - Other German audiobook series: Complete catalogs Actual behavior: - Wieso? Weshalb? Warum?: ~134 albums (working correctly) - Benjamin Blümchen: 10-22 albums (varies by method) - Others: Similarly incomplete results This inconsistency suggests the issue might be related to: - Different channel/content organization on YouTube Music - Possible pagination or content grouping differences - API limitations for specific content types or channels Environment: - Python 3.12 - ytmusicapi 1.9.1 - Platform: Linux/Ubuntu with Wayland
kerem 2026-02-27 23:00:56 +03:00
  • closed this issue
  • added the
    invalid
    label
Author
Owner

@sigma67 commented on GitHub (Jan 7, 2025):

The results are localized. If your (YTMusic instance client) language is English you will see fewer albums.

<!-- gh-comment-id:2574593828 --> @sigma67 commented on GitHub (Jan 7, 2025): The results are localized. If your (YTMusic instance client) language is English you will see fewer albums.
Author
Owner

@scharc commented on GitHub (Jan 7, 2025):

Hi,

Thanks for the suggestion about using the language parameter. I've done extensive testing with different language settings (en, de, it) and found that the results appear to be identical across all languages:

  1. Test setup:
  • Used YTMusic with different language parameters: YTMusic("browser.json", language="de")
  • Modified browser.json with different Accept-Language headers ("de-DE,de;q=0.9" etc.)
  • Tested with multiple artists (Benjamin Blümchen, Wieso? Weshalb? Warum?, etc.)
  • Tried different language codes (en, de, it)
  1. Results:
  • The number of albums/content remains exactly the same across all languages
  • Sample output for one artist (Benjamin Blümchen):
    • en: 10 albums
    • de: 10 albums
    • it: 10 albums
  • Results were identical regardless of browser.json language settings
  1. Testing method:
ytmusic = YTMusic("browser.json", language="de")  # Also tried "en" and "it"
artist_data = ytmusic.get_artist(channel_id)
albums_section = artist_data.get('albums', {})

Is there something else I should try? Or might there be another parameter that affects localization besides just the language setting and Accept-Language header?

I can share more detailed test results if needed.

<!-- gh-comment-id:2574714944 --> @scharc commented on GitHub (Jan 7, 2025): Hi, Thanks for the suggestion about using the language parameter. I've done extensive testing with different language settings (en, de, it) and found that the results appear to be identical across all languages: 1. Test setup: - Used YTMusic with different language parameters: `YTMusic("browser.json", language="de")` - Modified browser.json with different Accept-Language headers ("de-DE,de;q=0.9" etc.) - Tested with multiple artists (Benjamin Blümchen, Wieso? Weshalb? Warum?, etc.) - Tried different language codes (en, de, it) 2. Results: - The number of albums/content remains exactly the same across all languages - Sample output for one artist (Benjamin Blümchen): - en: 10 albums - de: 10 albums - it: 10 albums - Results were identical regardless of browser.json language settings 3. Testing method: ```python ytmusic = YTMusic("browser.json", language="de") # Also tried "en" and "it" artist_data = ytmusic.get_artist(channel_id) albums_section = artist_data.get('albums', {}) ``` Is there something else I should try? Or might there be another parameter that affects localization besides just the language setting and Accept-Language header? I can share more detailed test results if needed.
Author
Owner

@sigma67 commented on GitHub (Jan 7, 2025):

Are your authentication credentials valid? I only get the full list on authenticated accounts

<!-- gh-comment-id:2574826392 --> @sigma67 commented on GitHub (Jan 7, 2025): Are your authentication credentials valid? I only get the full list on authenticated accounts
Author
Owner

@sigma67 commented on GitHub (Jan 7, 2025):

fwiw these types of issues are usually easier to debug by checking what's shown on the web view when using different accounts/settings

<!-- gh-comment-id:2574829066 --> @sigma67 commented on GitHub (Jan 7, 2025): fwiw these types of issues are usually easier to debug by checking what's shown on the web view when using different accounts/settings
Author
Owner

@scharc commented on GitHub (Jan 7, 2025):

Thank you for the quick response! I apologize for causing confusion - you're absolutely right. My issue wasn't with the API at all, but rather with my incorrect browser.json authentication. A simple auth status check would have saved me time and helped me identify the real issue immediately. This would be super helpful for other new developers like me who are just getting started with the library.

Thanks for maintaining such a helpful library and for the fast responses to questions!

<!-- gh-comment-id:2574971916 --> @scharc commented on GitHub (Jan 7, 2025): Thank you for the quick response! I apologize for causing confusion - you're absolutely right. My issue wasn't with the API at all, but rather with my incorrect browser.json authentication. A simple auth status check would have saved me time and helped me identify the real issue immediately. This would be super helpful for other new developers like me who are just getting started with the library. Thanks for maintaining such a helpful library and for the fast responses to questions!
Author
Owner

@scharc commented on GitHub (Jan 7, 2025):

fwiw these types of issues are usually easier to debug by checking what's shown on the web view when using different accounts/settings

I do not understand any of that. Maybe a guide could help others like me that are new to the api?

<!-- gh-comment-id:2574973272 --> @scharc commented on GitHub (Jan 7, 2025): > fwiw these types of issues are usually easier to debug by checking what's shown on the web view when using different accounts/settings I do not understand any of that. Maybe a guide could help others like me that are new to the api?
Author
Owner

@sigma67 commented on GitHub (Jan 7, 2025):

It's no wizardry. Just go to music.youtube.com in your browser and try logged-in, logged-out, different languages etc.

All this project does is send the same requests that are sent in your browser, so the results should always be the same.

<!-- gh-comment-id:2574985359 --> @sigma67 commented on GitHub (Jan 7, 2025): It's no wizardry. Just go to music.youtube.com in your browser and try logged-in, logged-out, different languages etc. All this project does is send the same requests that are sent in your browser, so the results should always be the same.
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#465
No description provided.