@bot.command()
async def buscayt(ctx, *, search):
query_string = parse.urlencode({'search_query': search})
html_content = request.urlopen('http://www.youtube.com/results?' + query_string)
search_results = re.findall(href = ("/watch/?v=(.{11})", html_content.read().decode())
print(search_results)
query_string
is used so I can search for what I want.
html_content
is used so it opens up yt and what searches what I have written.
search_results
should return the video results as codes but that's where I get an error.
This code is for my discord bot, but when a use the command it appears a error as href as undefined, so I really don't know how to solve it.