[GH-ISSUE #448] When searching without filter, no ids appear #332

Closed
opened 2026-02-27 23:00:14 +03:00 by kerem · 1 comment
Owner

Originally created by @polvallverdu on GitHub (Oct 3, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/448

I was just trying to search, and came across that browseId was not appearing for the top result (an album). When searching with album filter, it appears, which is kinda weird. I don't believe this happens because of youtube's API.

[
  {
    "category": "Top result",
    "resultType": "album",
    "title": "DONDE QUIERO ESTAR",
    "artists": [
      {
        "name": "Quevedo",
        "id": "UC7PL9aor5qNRhvhWWVXyOqA"
      }
    ],
    "thumbnails": [
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w60-h60-l90-rj",
        "width": 60,
        "height": 60
      },
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w120-h120-l90-rj",
        "width": 120,
        "height": 120
      },
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w226-h226-l90-rj",
        "width": 226,
        "height": 226
      },
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w544-h544-l90-rj",
        "width": 544,
        "height": 544
      }
    ]
  },
  {
    "category": "Songs",
    "resultType": "song",
    "title": "DONDE QUIERO ESTAR",
    "album": {
      "name": "DONDE QUIERO ESTAR",
      "id": "MPREb_rqH94Zr3NN0"
    },
    "feedbackTokens": {
      "add": "AB9zfpIWhfviZNhsRagHvyIXL3nA-bLTk-V0regyV21GdNAabpBSz1Y4Lp7fhtCe2yoQuZh5GTvsoU3WOdVethVY94rI0xkYOA",
      "remove": "AB9zfpIr7I31l1rbmUQnzemH8z37Xpg1S7OHIrIk-w1c6-IkbhpeZN5_RYXS3wyMVhFPgBrQCRGl7rXpz3UrF_hNtObnwVDVBg"
    },
    "videoId": "agq6yRN0KEE",
    "videoType": "MUSIC_VIDEO_TYPE_ATV",
    "duration": "3:21",
    "year": None,
    "artists": [
      {
        "name": "Quevedo",
        "id": "UC7PL9aor5qNRhvhWWVXyOqA"
      }
    ],
    "duration_seconds": 201,
    "isExplicit": False,
    "thumbnails": [
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w60-h60-l90-rj",
        "width": 60,
        "height": 60
      },
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w120-h120-l90-rj",
        "width": 120,
        "height": 120
      }
    ]
  },
  {
    "category": "Songs",
    "resultType": "song",
    "title": "PLAYA DEL INGLÉS",
    "album": {
      "name": "DONDE QUIERO ESTAR",
      "id": "MPREb_rqH94Zr3NN0"
    },
    "feedbackTokens": {
      "add": "AB9zfpKbB0XhX1TwUtWboYrbagwORRVLdQGKn8YtAGP9CLTK94XkpOV9dwf6hHkdn_7vcczzcfxOfT5jFGg4xITunVB3FDQ0mA",
      "remove": "AB9zfpIT9nbWrq7xKYrpGaXR6SmrQhW4gLtcVrNLxQSrs3E6DEGe326HpnwjfmmTU0xs7NeMPldptbeAhHCoZQ_cZRE9H1F48Q"
    },
    "videoId": "ongGXq5O6GY",
    "videoType": "MUSIC_VIDEO_TYPE_ATV",
    "duration": "3:58",
    "year": None,
    "artists": [
      {
        "name": "Quevedo",
        "id": "UC7PL9aor5qNRhvhWWVXyOqA"
      },
      {
        "name": "Myke Towers",
        "id": "UCYPsIfSIEwWcoynHBP5k1dg"
      }
    ],
    "duration_seconds": 238,
    "isExplicit": False,
    "thumbnails": [
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w60-h60-l90-rj",
        "width": 60,
        "height": 60
      },
      {
        "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w120-h120-l90-rj",
        "width": 120,
        "height": 120
      }
    ]
  }
]

Code I'm currently using:

async def search(query: str, filter: SearchFilter = None, limit: int = 20):
  authorized_ytmusic = get_ytmusic()
  return authorized_ytmusic.search(query, filter=filter.value if filter else None, limit=limit)
Originally created by @polvallverdu on GitHub (Oct 3, 2023). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/448 I was just trying to search, and came across that browseId was not appearing for the top result (an album). When searching with album filter, it appears, which is kinda weird. I don't believe this happens because of youtube's API. ```json [ { "category": "Top result", "resultType": "album", "title": "DONDE QUIERO ESTAR", "artists": [ { "name": "Quevedo", "id": "UC7PL9aor5qNRhvhWWVXyOqA" } ], "thumbnails": [ { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w60-h60-l90-rj", "width": 60, "height": 60 }, { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w120-h120-l90-rj", "width": 120, "height": 120 }, { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w226-h226-l90-rj", "width": 226, "height": 226 }, { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w544-h544-l90-rj", "width": 544, "height": 544 } ] }, { "category": "Songs", "resultType": "song", "title": "DONDE QUIERO ESTAR", "album": { "name": "DONDE QUIERO ESTAR", "id": "MPREb_rqH94Zr3NN0" }, "feedbackTokens": { "add": "AB9zfpIWhfviZNhsRagHvyIXL3nA-bLTk-V0regyV21GdNAabpBSz1Y4Lp7fhtCe2yoQuZh5GTvsoU3WOdVethVY94rI0xkYOA", "remove": "AB9zfpIr7I31l1rbmUQnzemH8z37Xpg1S7OHIrIk-w1c6-IkbhpeZN5_RYXS3wyMVhFPgBrQCRGl7rXpz3UrF_hNtObnwVDVBg" }, "videoId": "agq6yRN0KEE", "videoType": "MUSIC_VIDEO_TYPE_ATV", "duration": "3:21", "year": None, "artists": [ { "name": "Quevedo", "id": "UC7PL9aor5qNRhvhWWVXyOqA" } ], "duration_seconds": 201, "isExplicit": False, "thumbnails": [ { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w60-h60-l90-rj", "width": 60, "height": 60 }, { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w120-h120-l90-rj", "width": 120, "height": 120 } ] }, { "category": "Songs", "resultType": "song", "title": "PLAYA DEL INGLÉS", "album": { "name": "DONDE QUIERO ESTAR", "id": "MPREb_rqH94Zr3NN0" }, "feedbackTokens": { "add": "AB9zfpKbB0XhX1TwUtWboYrbagwORRVLdQGKn8YtAGP9CLTK94XkpOV9dwf6hHkdn_7vcczzcfxOfT5jFGg4xITunVB3FDQ0mA", "remove": "AB9zfpIT9nbWrq7xKYrpGaXR6SmrQhW4gLtcVrNLxQSrs3E6DEGe326HpnwjfmmTU0xs7NeMPldptbeAhHCoZQ_cZRE9H1F48Q" }, "videoId": "ongGXq5O6GY", "videoType": "MUSIC_VIDEO_TYPE_ATV", "duration": "3:58", "year": None, "artists": [ { "name": "Quevedo", "id": "UC7PL9aor5qNRhvhWWVXyOqA" }, { "name": "Myke Towers", "id": "UCYPsIfSIEwWcoynHBP5k1dg" } ], "duration_seconds": 238, "isExplicit": False, "thumbnails": [ { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w60-h60-l90-rj", "width": 60, "height": 60 }, { "url": "https://lh3.googleusercontent.com/hzdd5VEdCJC9gfcTimpjiZO2KZAo2_dVdU_cS4enWqkfvaHQVAsRI9bbFMbQMsTKD-PXoJbQOSZo-g=w120-h120-l90-rj", "width": 120, "height": 120 } ] } ] ``` Code I'm currently using: ```python async def search(query: str, filter: SearchFilter = None, limit: int = 20): authorized_ytmusic = get_ytmusic() return authorized_ytmusic.search(query, filter=filter.value if filter else None, limit=limit) ```
kerem closed this issue 2026-02-27 23:00:14 +03:00
Author
Owner

@sigma67 commented on GitHub (Oct 4, 2023):

Yeah, the top results are parsed differently (since they are a different layout), so there might be some keys missing. See here:

github.com/sigma67/ytmusicapi@40e5650de3/ytmusicapi/parsers/search.py (L19-L43)

<!-- gh-comment-id:1746227392 --> @sigma67 commented on GitHub (Oct 4, 2023): Yeah, the top results are parsed differently (since they are a different layout), so there might be some keys missing. See here: https://github.com/sigma67/ytmusicapi/blob/40e5650de3bfcb7d78b15175c82ee112cef9c87d/ytmusicapi/parsers/search.py#L19-L43
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#332
No description provided.