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