From 9decd6552b640367a9301d0e550b6794aabc2f6c Mon Sep 17 00:00:00 2001 From: a Date: Mon, 21 Oct 2024 21:40:57 +0000 Subject: [PATCH] Fix: actually import YoutubeSearch and fix self-variable access doesn't actually fix the issue where youtube is blocking requests behind a signin requirement but eh --- cogs/music.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cogs/music.py b/cogs/music.py index fd09e61..a01e9bc 100644 --- a/cogs/music.py +++ b/cogs/music.py @@ -9,6 +9,7 @@ import random # for shuffling the queue import math # for ceiling function in queue pages from functools import partial import logging +from youtube_search import YoutubeSearch if not path.exists('.logs'): makedirs('.logs') @@ -339,7 +340,7 @@ class Music(Cog): logger.debug(f"search_youtube() called for query: {query}") try: self.query = query - self.search_results = YoutubeSearch(query, max_results=MAX_RESULTS).to_dict() + self.search_results = YoutubeSearch(query, max_results=self.MAX_RESULTS).to_dict() # this returns a list, funnily enough except Exception as e: logger.error("Exception thrown!") logger.error(f"{e=}") @@ -366,12 +367,12 @@ class Music(Cog): embeds = [] formatted_results = ( - f"Performed a search for `{self.search_results['id']}`.\n" + f"Performed a search for `{self.query}`.\n" "Which track would you like to play?\n" "Make your choice using the `play` command, e.g. `.play 1`.\n\n" ) - for i, result in enumerate(self.search_results['entries']): + for i, result in enumerate(self.search_results): result: dict