[GH-ISSUE #483] Search has weird albums #359

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

Originally created by @polvallverdu on GitHub (Dec 7, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/483

Originally assigned to: @polvallverdu on GitHub.

Describe the bug
I've been running an automated application with this library (my async version), and the only flagging that I get is a report that some albums are considered songs (ytmusic doesn't even recognize these as albums, as I mentioned in a past issue), but from the app I can access the album, so there should be a way to get the album id. This occurs when searching without any filter.

Here's what I'm talking about:

{"category": "Albums", "resultType": "song", "title": "Supernova", "album": null, "inLibrary": false, "feedbackTokens": {"add": null, "remove": null}, "videoId": "1d_R6LqadWQ", "videoType": "MUSIC_VIDEO_TYPE_ATV", "duration": null, "year": "2023", "artists": [{"name": "Saiko", "id": "UCN7aCXjfOVY-YOj_OWD-hSQ"}], "isExplicit": false, "thumbnails": [{"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w60-h60-l90-rj", "width": 60, "height": 60}, {"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w120-h120-l90-rj", "width": 120, "height": 120}, {"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w226-h226-l90-rj", "width": 226, "height": 226}, {"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w544-h544-l90-rj", "width": 544, "height": 544}]}

When searching for "supernova saiko", this album appears without album id, but a track also appears containing the actual albumid. That's why I call it weird album.

To Reproduce
Steps to reproduce the behavior:

  1. Search for "supernova saiko"
  2. Check the returned dictionary.
Originally created by @polvallverdu on GitHub (Dec 7, 2023). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/483 Originally assigned to: @polvallverdu on GitHub. **Describe the bug** I've been running an automated application with this library (my async version), and the only flagging that I get is a report that some albums are considered songs (ytmusic doesn't even recognize these as albums, as I mentioned in a past issue), but from the app I can access the album, so there should be a way to get the album id. This occurs when searching without any filter. Here's what I'm talking about: ```json {"category": "Albums", "resultType": "song", "title": "Supernova", "album": null, "inLibrary": false, "feedbackTokens": {"add": null, "remove": null}, "videoId": "1d_R6LqadWQ", "videoType": "MUSIC_VIDEO_TYPE_ATV", "duration": null, "year": "2023", "artists": [{"name": "Saiko", "id": "UCN7aCXjfOVY-YOj_OWD-hSQ"}], "isExplicit": false, "thumbnails": [{"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w60-h60-l90-rj", "width": 60, "height": 60}, {"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w120-h120-l90-rj", "width": 120, "height": 120}, {"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w226-h226-l90-rj", "width": 226, "height": 226}, {"url": "https://lh3.googleusercontent.com/R2d9H4Uyx91YfDTLAC-Vl7mGwXc0ZH5QQ4pV-OE9SbqpznDTT1IgT1dvkW9MhpBMPcBi_yC9mxYwfD4=w544-h544-l90-rj", "width": 544, "height": 544}]} ``` When searching for "supernova saiko", this album appears without album id, but a track also appears containing the actual albumid. That's why I call it weird album. **To Reproduce** Steps to reproduce the behavior: 1. Search for "supernova saiko" 2. Check the returned dictionary.
kerem 2026-02-27 23:00:22 +03:00
Author
Owner

@theyak commented on GitHub (Dec 8, 2023):

Agreed. I think the issue lies in the search parser.

    if not result_type and video_type:
        result_type = 'song' if video_type == 'MUSIC_VIDEO_TYPE_ATV' else 'video'

    result_type = get_search_result_type(get_item_text(data, 1),
                                         search_result_types) if not result_type else result_type

What is happening is that it's looking to see if it has a video type, and if it does, it assumes song or video. I think checking get_item_text(data, 1) for a value of single or album (might need some language processing) before checking the video type would fix this issue.

<!-- gh-comment-id:1846599595 --> @theyak commented on GitHub (Dec 8, 2023): Agreed. I think the issue lies in the search parser. ```python if not result_type and video_type: result_type = 'song' if video_type == 'MUSIC_VIDEO_TYPE_ATV' else 'video' result_type = get_search_result_type(get_item_text(data, 1), search_result_types) if not result_type else result_type ``` What is happening is that it's looking to see if it has a video type, and if it does, it assumes song or video. I think checking `get_item_text(data, 1)` for a value of `single` or `album` (might need some language processing) before checking the video type would fix this issue.
Author
Owner

@sigma67 commented on GitHub (Dec 13, 2023):

PR welcome

<!-- gh-comment-id:1853742308 --> @sigma67 commented on GitHub (Dec 13, 2023): PR welcome
Author
Owner

@polvallverdu commented on GitHub (Dec 13, 2023):

I'm looking to test it and PR of Friday

<!-- gh-comment-id:1853849502 --> @polvallverdu commented on GitHub (Dec 13, 2023): I'm looking to test it and PR of Friday
Author
Owner

@polvallverdu commented on GitHub (Dec 15, 2023):

Thank you @theyak for the comment. I just made that result_type can be also album if being None.

<!-- gh-comment-id:1858015069 --> @polvallverdu commented on GitHub (Dec 15, 2023): Thank you @theyak for the comment. I just made that result_type can be also album if being None.
Author
Owner

@sigma67 commented on GitHub (Dec 31, 2023):

I'm failing to reproduce this, please provide better instructions. There are no category="Albums" results for me on the provided search term.

<!-- gh-comment-id:1872952311 --> @sigma67 commented on GitHub (Dec 31, 2023): I'm failing to reproduce this, please provide better instructions. There are no `category="Albums"` results for me on the provided search term.
Author
Owner

@polvallverdu commented on GitHub (Jan 6, 2024):

I'm failing to reproduce this, please provide better instructions. There are no category="Albums" results for me on the provided search term.

Can it be because I'm using an account with Youtube Premium?

<!-- gh-comment-id:1879650910 --> @polvallverdu commented on GitHub (Jan 6, 2024): > I'm failing to reproduce this, please provide better instructions. There are no `category="Albums"` results for me on the provided search term. Can it be because I'm using an account with Youtube Premium?
Author
Owner

@sigma67 commented on GitHub (Jan 12, 2024):

I pushed a fix for album top results in 16c9cbe, but I'm not sure it addresses your issue

Can you provide a good search term to reproduce again? "supernova saiko" is not reproducing for me

<!-- gh-comment-id:1889785125 --> @sigma67 commented on GitHub (Jan 12, 2024): I pushed a fix for album top results in 16c9cbe, but I'm not sure it addresses your issue Can you provide a good search term to reproduce again? "supernova saiko" is not reproducing for me
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#359
No description provided.