Changed Google-Search to Youtube (fix)

This commit is contained in:
Lukas Blacha
2023-02-08 12:42:49 +01:00
parent bc8b212504
commit 6993fde7d8

View File

@@ -228,9 +228,9 @@ else:
async with client.get("https://www.youtube.com/results", params=p, headers=h) as resp: async with client.get("https://www.youtube.com/results", params=p, headers=h) as resp:
dom = await resp.text() dom = await resp.text()
open("debug.html", "w").write(dom) open("debug.html", "w").write(dom)
print(re.findall(r"watch\?v=(\S{11})", dom))
found = re.findall(r"watch\?v=(\S{11})", dom)[0] found = re.findall(r"watch\?v=(\S{11})", dom)[0]
url = f"https://www.youtube.com/watch?v={found}" url = f"https://www.youtube.com/watch?v={found}"
print(url)
async with ctx.typing(): async with ctx.typing():
await ctx.respond("🤖 Your song is queued for download... please wait ", ephemeral=True) await ctx.respond("🤖 Your song is queued for download... please wait ", ephemeral=True)