Changed Google-Search to Youtube (fix)

This commit is contained in:
Lukas Blacha committed 2023-02-08 12:15:27 +01:00
1 parent 9b1e473ec1
commit 93fdfb1f77
1 file changed
+1 -1
+1 -1
View File
@@ -99,7 +99,7 @@ else:
h = {"User-Agent": "Mozilla/5.0"} h = {"User-Agent": "Mozilla/5.0"}
with aiohttp.ClientSession() as client: with aiohttp.ClientSession() as client:
with client.get("https://www.youtube.com/results", params=p, headers=h) as resp: with client.get("https://www.youtube.com/results", params=p, headers=h) as resp:
dom = await resp.text() dom = resp.text()
# open("debug.html", "w").write(dom) # open("debug.html", "w").write(dom)
found = re.findall(r'href"\/watch\?v=([a-zA-Z0-9_-]{11})', dom) found = re.findall(r'href"\/watch\?v=([a-zA-Z0-9_-]{11})', dom)
url = f"https://youtu.be/{found[0]}" url = f"https://youtu.be/{found[0]}"