[GH-ISSUE #588] parsers/browsing.py:parse_album() gives incorrect value for "year" #406

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

Originally created by @ryanopily on GitHub (May 24, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/588

When using a YTMusic object authenticated with browser headers, a call to get_home() incorrectly fills the "year" key in an album with the artist name.

EXAMPLE:

ytmusic = YTMusic("headers.json")
print(json.dumps(ytmusic.get_home()))

RESULT:

[
  ...
  {
    "title": "Alexisonfire",
    "type": "Album",
    "year": "Alexisonfire",
    "artists": [
      {
        "id": "UC9gdUSsa_3TWMYou9nUIJPQ",
        "name": "Alexisonfire"
      }
    ],
    "browseId": "MPREb_TmfcXr7KaYu",
    "audioPlaylistId": null,
    "thumbnails": [
      {
        "url": "https://lh3.googleusercontent.com/TKcFRAFiGVfydrImrgdpZa_c_YqldAJFAU9OgxWrHublr7lV7tLpB-hDvmjKZuNngMgFDo675gSc2ePz-g=w226-h226-l90-rj",
        "width": 226,
        "height": 226
      },
      {
        "url": "https://lh3.googleusercontent.com/TKcFRAFiGVfydrImrgdpZa_c_YqldAJFAU9OgxWrHublr7lV7tLpB-hDvmjKZuNngMgFDo675gSc2ePz-g=w544-h544-l90-rj",
        "width": 544,
        "height": 544
      }
    ],
    "isExplicit": true
  },
  ...
]

As you can see above; "year": "Alexisonfire". This happens with every album included in the result.
I couldn't find the actual field for album's year in the raw json returned from youtube. Maybe it's not included in the response.

Originally created by @ryanopily on GitHub (May 24, 2024). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/588 When using a YTMusic object authenticated with browser headers, a call to get_home() incorrectly fills the "year" key in an album with the artist name. EXAMPLE: ``` ytmusic = YTMusic("headers.json") print(json.dumps(ytmusic.get_home())) ``` RESULT: ``` [ ... { "title": "Alexisonfire", "type": "Album", "year": "Alexisonfire", "artists": [ { "id": "UC9gdUSsa_3TWMYou9nUIJPQ", "name": "Alexisonfire" } ], "browseId": "MPREb_TmfcXr7KaYu", "audioPlaylistId": null, "thumbnails": [ { "url": "https://lh3.googleusercontent.com/TKcFRAFiGVfydrImrgdpZa_c_YqldAJFAU9OgxWrHublr7lV7tLpB-hDvmjKZuNngMgFDo675gSc2ePz-g=w226-h226-l90-rj", "width": 226, "height": 226 }, { "url": "https://lh3.googleusercontent.com/TKcFRAFiGVfydrImrgdpZa_c_YqldAJFAU9OgxWrHublr7lV7tLpB-hDvmjKZuNngMgFDo675gSc2ePz-g=w544-h544-l90-rj", "width": 544, "height": 544 } ], "isExplicit": true }, ... ] ``` As you can see above; **"year": "Alexisonfire"**. This happens with every album included in the result. I couldn't find the actual field for album's year in the raw json returned from youtube. Maybe it's not included in the response.
kerem closed this issue 2026-02-27 23:00:38 +03:00
Author
Owner

@sigma67 commented on GitHub (May 25, 2024):

Cannot reproduce home page issues without response data

<!-- gh-comment-id:2131099898 --> @sigma67 commented on GitHub (May 25, 2024): Cannot reproduce home page issues without response data
Author
Owner

@ryanopily commented on GitHub (May 25, 2024):

I included a partial result of the parsed response data returned by YTMusic.get_home() showcasing the issue. I just couldn't find the correct value ("2002") in the raw, unparsed JSON returned by the website. Not sure what else I should include.

<!-- gh-comment-id:2131229976 --> @ryanopily commented on GitHub (May 25, 2024): I included a partial result of the parsed response data returned by YTMusic.get_home() showcasing the issue. I just couldn't find the correct value ("2002") in the raw, unparsed JSON returned by the website. Not sure what else I should include.
Author
Owner

@sigma67 commented on GitHub (May 25, 2024):

Yes, you included a partial result. I'm asking for the full response data returned from the server.

You can get it by navigating there in the browser and grabbing it from the network request

image

A screenshot of your home page containing the problematic record would also be helpful

<!-- gh-comment-id:2131236909 --> @sigma67 commented on GitHub (May 25, 2024): Yes, you included a partial result. I'm asking for the full response data returned from the server. You can get it by navigating there in the browser and grabbing it from the network request ![image](https://github.com/sigma67/ytmusicapi/assets/16363825/6c5781a5-a0e0-472d-8ef8-0d4ce5bbc234) A screenshot of your home page containing the problematic record would also be helpful
Author
Owner

@ryanopily commented on GitHub (May 25, 2024):

music.youtube-home.json
music youtube-home

<!-- gh-comment-id:2131284708 --> @ryanopily commented on GitHub (May 25, 2024): [music.youtube-home.json](https://github.com/sigma67/ytmusicapi/files/15443801/music.youtube-home.json) ![music youtube-home](https://github.com/sigma67/ytmusicapi/assets/35015177/82b90f9d-0266-4885-a008-da23ee7526d8)
Author
Owner

@sigma67 commented on GitHub (May 27, 2024):

Thanks for the report and details!

<!-- gh-comment-id:2133946494 --> @sigma67 commented on GitHub (May 27, 2024): Thanks for the report and details!
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#406
No description provided.