From 9b1e473ec1e6e23832003adb2a053e04fdc097da Mon Sep 17 00:00:00 2001 From: Lukas Blacha Date: Wed, 8 Feb 2023 12:15:03 +0100 Subject: [PATCH] Changed Google-Search to Youtube (fix) --- Music-Bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Music-Bot.py b/Music-Bot.py index c75f66d..eb76d6f 100644 --- a/Music-Bot.py +++ b/Music-Bot.py @@ -97,8 +97,8 @@ else: p = {"search_query": query} # Spoof a user agent header or the request will immediately fail h = {"User-Agent": "Mozilla/5.0"} - async with aiohttp.ClientSession() as client: - async with client.get("https://www.youtube.com/results", params=p, headers=h) as resp: + with aiohttp.ClientSession() as client: + with client.get("https://www.youtube.com/results", params=p, headers=h) as resp: dom = await resp.text() # open("debug.html", "w").write(dom) found = re.findall(r'href"\/watch\?v=([a-zA-Z0-9_-]{11})', dom)