Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Filter Selected Error #156

Open
axiinyaa opened this issue Apr 21, 2023 · 1 comment
Open

No Filter Selected Error #156

axiinyaa opened this issue Apr 21, 2023 · 1 comment

Comments

@axiinyaa
Copy link

Code:

        search_ : pyyoutube.SearchListResponse = youtube.search_by_keywords(q = content)
        tracks = []
        
        for result in list(search_.items):

            video : pyyoutube.VideoListResponse = youtube.get_video_by_id(video_id=result.id.videoId).items[0].snippet
            
            song_name = video.title
            artists = video.channelTitle
            url = video.thumbnails.standard.url

Traceback:

Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\interactions\client\models\command.py", line 907, in wrapper
    return await coro(self.extension, ctx, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Axolp\OneDrive\Documents\GitHub\JimBit\Commands\music.py", line 882, in autocomplete
    items = await self.load_spotify_search(text)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Axolp\OneDrive\Documents\GitHub\JimBit\Commands\music.py", line 337, in load_spotify_search
    video : pyyoutube.VideoListResponse = youtube.get_video_by_id(video_id=result.id.videoId).items[0].snippet
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pyyoutube\api.py", line 2338, in get_video_by_id
    data = self._parse_response(resp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pyyoutube\api.py", line 327, in _parse_response
    raise PyYouTubeException(response)
pyyoutube.error.PyYouTubeException: YouTubeException(status_code=400,message=No filter selected. Expected one of: id, myRating, chart)
Invalid Form Body

I don't know what i'm doing wrong here.

@MerleLiuKun
Copy link
Member

May be the result.id.videoId give the None.

You can print the result to check this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants