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

Telegram Bot/ From YouTube link to mp3 file

$
0
0

Hello! I want to create a Telegram Bot, which can convert YouTube link to mp3. I want to do it with aiogram library, but I saw only these bots with telebot library. Could somebody help me?I wrote something like this, but I got nothing

async def convert_audio(message: types.Message): video_url = message.text video_id = video_url.split('=')[1]audio_url = f'https://www.yt-download.org/api/button/mp3/{video_id}'urllib.request.urlretrieve(audio_url, f'{video_id}.mp3')with open(f'{video_id}.mp3', 'rb') as audio_file:    await bot.send_audio(message.chat.id, audio_file)os.remove(f'{video_id}.mp3')

Viewing all articles
Browse latest Browse all 3831

Trending Articles



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