Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

discord py music bot stops playing

$
0
0

hi im having a problem with my discord music bot

@client.command()async def play(ctx,*,songname):     html = urllib.request.urlopen(f"https://www.youtube.com/results?search_query={songname}")     video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())     FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}     YDL_OPTIONS = {'format':"bestaudio"}     URL =f"https://www.youtube.com/watch?v={video_ids[1]}"     vc = ctx.voice_client     with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:         info = ydl.extract_info("https://www.youtube.com/watch?v=" + video_ids[0],download=False)         url2 = info['formats'][0]['url']         source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)         vc.play(source)         await ctx.send(f'~(0o0*)~ **playing**:\n{URL}')

whenever i play a song after 2 minsit stops playing and goes cilent


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>