[GH-ISSUE #370] Implementation of get_search_suggestions endpoint #293

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

Originally created by @omgupta15 on GitHub (Apr 4, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/370

Is your feature request related to a problem? Please describe.
The get_search_suggestions endpoint is not implemented yet.

Describe the solution you'd like
I created this endpoint for a project recently and would like to contribute it to the library.

Describe alternatives you've considered
NA

Additional context
The commit for endpoint: github.com/omgupta15/ytmusicapi@c20728029d
Unittest: github.com/omgupta15/ytmusicapi@ef844f4ad0

I've tested the feature and it seems to be working fine.

Here's a demo of its implementation:

https://user-images.githubusercontent.com/36772158/229929357-42f09c66-df18-4535-a90e-3f0f44a65c5b.mov

Should I raise a PR?

Originally created by @omgupta15 on GitHub (Apr 4, 2023). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/370 **Is your feature request related to a problem? Please describe.** The `get_search_suggestions` endpoint is not implemented yet. **Describe the solution you'd like** I created this endpoint for a project recently and would like to contribute it to the library. **Describe alternatives you've considered** NA **Additional context** The commit for endpoint: https://github.com/omgupta15/ytmusicapi/commit/c20728029d2736f4f796d90676f42a3e201295c3 Unittest: https://github.com/omgupta15/ytmusicapi/commit/ef844f4ad0b2b55c9ffc31a8af2dacfb849ae9c0 I've tested the feature and it seems to be working fine. Here's a demo of its implementation: https://user-images.githubusercontent.com/36772158/229929357-42f09c66-df18-4535-a90e-3f0f44a65c5b.mov Should I raise a PR?
kerem 2026-02-27 22:09:02 +03:00
Author
Owner

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

Hello @omgupta15, gladly submit a PR! This has already been requested in #342 and was still missing.

For the PR I have a few things in mind:

  • move to mixins/search.py and parsers/search.py respectively - the browsing mixin is already pretty large and unwieldy
  • I don't really see a use for detailed_runs, as the bolded text is always what the user typed and thus what's known to user of your library function (equal to query param). Feel free to let me know if I missed something
  • add to reference
  • add to readme (* search (including all filters) and suggestions)

With those out of the way it should be good to merge.

<!-- gh-comment-id:1496671351 --> @sigma67 commented on GitHub (Apr 4, 2023): Hello @omgupta15, gladly submit a PR! This has already been requested in #342 and was still missing. For the PR I have a few things in mind: - move to `mixins/search.py` and `parsers/search.py` respectively - the browsing mixin is already pretty large and unwieldy - I don't really see a use for `detailed_runs`, as the bolded text is always what the user typed and thus what's known to user of your library function (equal to ``query`` param). Feel free to let me know if I missed something - add to reference - add to readme (* search (including all filters) and suggestions) With those out of the way it should be good to merge.
Author
Owner

@omgupta15 commented on GitHub (Apr 5, 2023):

Hey @sigma67, thanks for the suggestions.

  • Move from browsing mixin to search.
  • detailed_runs can actually be useful in cases when the search term is broken down into parts. For example:
    When we search for a query like to moon, we get the following suggestions:
    to moon, talking to moon, go to moon, to the moon
    In the last suggestion, to & moon are not together and are bolded separately.
    Detailed runs can help in this case:
    'runs': [{'text': 'to', 'bold': True}, {'text': ' the '}, {'text': 'moon', 'bold': True}]
  • Add to reference.
  • Add to readme.

I've raised the PR. Here's the link: #372

Let me know if any changes are required.

<!-- gh-comment-id:1496965627 --> @omgupta15 commented on GitHub (Apr 5, 2023): Hey @sigma67, thanks for the suggestions. - [x] Move from `browsing` mixin to `search`. - [x] `detailed_runs` can actually be useful in cases when the search term is broken down into parts. For example: When we search for a query like `to moon`, we get the following suggestions: **to moon**, talking **to moon**, go **to moon**, **to** the **moon** In the last suggestion, `to` & `moon` are not together and are bolded separately. Detailed runs can help in this case: `'runs': [{'text': 'to', 'bold': True}, {'text': ' the '}, {'text': 'moon', 'bold': True}]` - [x] Add to reference. - [x] Add to readme. I've raised the PR. Here's the link: #372 Let me know if any changes are required.
Author
Owner

@sigma67 commented on GitHub (Apr 5, 2023):

Thanks, that explanation is acceptable to me. I'll review the PR

<!-- gh-comment-id:1497040921 --> @sigma67 commented on GitHub (Apr 5, 2023): Thanks, that explanation is acceptable to me. I'll review the PR
Author
Owner

@sigma67 commented on GitHub (Mar 26, 2024):

Hi @omgupta15 , are you actually using detailed_runs arg? From a typing perspective it's not ideal that it changes the return type

CC @TheOnlyWayUp

<!-- gh-comment-id:2019479154 --> @sigma67 commented on GitHub (Mar 26, 2024): Hi @omgupta15 , are you actually using `detailed_runs` arg? From a typing perspective it's not ideal that it changes the return type CC @TheOnlyWayUp
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#293
No description provided.