need helpp

Does anyone know what I'm doing wrong? it's a command in python I'm doing for discord please i need help!! cod: @client.command()
async def Youtube(ctx, *, search):
query_string = urllib.parse.urlencode({
'search_query': search
htm_content = urllib.request.urlopen(
''+ query_string
search_results = re.findall('href=\"\?watch\?v=(.{11})',
await ctx.send(f'' + search_results[0])

You are viewing a single comment. View All

what is the error?


@Coder100 Ignoring exception in command Youtube:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "", line 100, in Youtube
await ctx.send(f'' + search_results[0])
IndexError: list index out of range

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: list index out of range


that meant there were no search results, search_results was [] @CAUESPINDOLA