tombulled / python-youtube-music

Python 3 YouTube Music Web API Client
GNU General Public License v3.0
64 stars 13 forks source link

Method - Search Songs doesn't work #7

Closed Julienhug closed 4 years ago

Julienhug commented 4 years ago

Hi, I tried to use your great work. But I have some trouble with search songs function.

import ytm api = ytm.YouTubeMusic() songs = api.search_songs('cry') Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/ytm/decorators/_enforce.py", line 132, in wrapper resp = func(*args, kwargs) File "/usr/local/lib/python3.7/site-packages/ytm/decorators/enforce_return_value.py", line 52, in wrapper return func(*args, *kwargs) File "/usr/local/lib/python3.7/site-packages/ytm/decorators/parse.py", line 53, in wrapper return parser(func(args, kwargs)) File "/usr/local/lib/python3.7/site-packages/ytm/apis/AbstractYouTubeMusic/decorators/catch.py", line 62, in wrapper f'{func.name}() encountered an error: {error_message}' MethodError: search_songs() encountered an error: tuple index out of range

Thank you so much for your help.

katmai1 commented 4 years ago

I have same issue. the methods 'search' and 'search_suggestion' works fine but 'search_albums', 'search_songs' and 'search_artists' always return this error how I can solve it? thanks

katmai1 commented 4 years ago

using a method called '_search_filter' can do it.

to search artists: api._search_filter(filter='artists', query='artist name', continuation=None)

tombulled commented 4 years ago

Hi, sorry for the late reply to this issue.

I traced the error back to an issue in one of the low-level decorators used to enforce parameter values. The issue should now be fixed as of this commit: #90082e2

If one of you can please test that this resolves this issue, I will mark this as closed.

Here's the code I tested it with, based on the traceback provided:

import ytm
from pprint import pprint

api = ytm.YouTubeMusic()

songs = api.search_songs('cry')

pprint(songs)

Thanks for reporting this issue!

katmai1 commented 4 years ago

works fine now thanks!