[GH-ISSUE #683] Error with queries starting with '-' #451

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

Originally created by @tekbreak on GitHub (Dec 6, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/683

Describe the bug
When executing:

yt = ytmusicapi.YTMusic()
search_results = yt.search("-YkyPojasM")
print(json.dumps(search_results))

it returns an empty array as the result due to the dash symbol (-) in the beginning of the query string.

As a workaround, I am doubling the dash when it is the first char in the string, so the youtube id "-YkyPojasM" (sample1) is converted to "--YkyPojasM" (sample2)

To Reproduce
Steps to reproduce the behavior:

  1. Execute the code with the sample1 : fail (empty array)
  2. Execute the code with the sample2 : success (video data)

Additional context
Tested on versions 1.8.1 and 1.8.2

Originally created by @tekbreak on GitHub (Dec 6, 2024). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/683 **Describe the bug** When executing: ``` yt = ytmusicapi.YTMusic() search_results = yt.search("-YkyPojasM") print(json.dumps(search_results)) ``` it returns an empty array as the result due to the dash symbol (-) in the beginning of the query string. As a workaround, I am doubling the dash when it is the first char in the string, so the youtube id "-YkyPojasM" (sample1) is converted to "--YkyPojasM" (sample2) **To Reproduce** Steps to reproduce the behavior: 1. Execute the code with the sample1 : fail (empty array) 2. Execute the code with the sample2 : success (video data) **Additional context** Tested on versions 1.8.1 and 1.8.2
kerem closed this issue 2026-02-27 23:00:52 +03:00
Author
Owner

@sigma67 commented on GitHub (Dec 6, 2024):

this is not a ytmusicapi issue. web search returns the same result

<!-- gh-comment-id:2523195483 --> @sigma67 commented on GitHub (Dec 6, 2024): this is not a ytmusicapi issue. web search returns the same result
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#451
No description provided.