sigma67/ytmusicapi

Error with queries starting with '-'

Closed this issue · 1 comments

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

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