sigma67/ytmusicapi

parsers/browsing.py:parse_album() gives incorrect value for "year"

Closed this issue · 5 comments

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.

Cannot reproduce home page issues without response data

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.

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

Thanks for the report and details!