Changed Google-Search to Youtube (fix)
This commit is contained in:
@@ -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]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user