0

I was working on a telegram bot to convert YouTube videos to mp3 using Python. I already know about youtube-dl but I wanted the URL to end with .mp3 particularly because in bot.sendAudio(chat_id,file) file must be a URL that ends with .mp3.

chris
  • 139
  • 1
  • 1
  • 6
  • That's a bit broad. It sounds like grabbing the sound is no problem at all and your only problem is how to serve that file / how to host it? Where is the problem exactly? (of course there are infinite many ways to do that) – sascha Jul 23 '17 at 14:32
  • I want the URL to end with .mp3,I don't want a download link ... That's the problem ...is there a way to convert the url to a url ending with .mp3 or a library to do this? – chris Jul 23 '17 at 14:35
  • It's not clear what you are talking about. So youtube is hosting some video using some web-technology and you want youtube to create an mp3-download link with sound only? Impossible... Why should they allow that? You have to download it and host it yourself! I'm wondering if there is a huge misunderstanding or if you don't know much about this at all (no pun)? (and mentioning youtube-dl is all about downloading, what you do not seem to want after your comment) – sascha Jul 23 '17 at 14:37
  • I admit I'm a noob.. excuse my noobness .. but let me try to make it clear... I have a telegram bot that when you text it a youtube link it replays back with a download link.The problem is that I don't want it to send links instead I want it to send them in audio form in order to do that I'll have to use bot.sendAudio(chat_id,URL) but the URL must be a URL that ends with .mp3 so if I have an mp3 download link is there a way to some how host it or do something to convert the url to .mp3?? clear?? – chris Jul 23 '17 at 14:45
  • Not clear... For starters: it's unclear what bot.sendAudio(chat_id,URL) does... It either sends a link and the receiver plays that link OR it downloads the link and sends a file which is then played. Very different. Next thing is: you got a youtube-video link, but you don't have an mp3 link. So where is this one coming from (if you are not hosting it yourself after dl with youtube-dl). So it's still unclear, but i would expect the solution would be: youtube-dl to download and demux mp3 into some mp3-file, then host it (on some cloud service) and allowing access through some link. – sascha Jul 23 '17 at 14:49
  • And when hosting yourself you can name it how you like to name it. I don't know why it should be .mp3 in your case as i would have expected web-stuff like mime-types to make the receiver to play is as mp3, but well... Youtube-dl could also find out some link to audio-only; so without the .mp3 ending you are done... But i don't know, a simple redirect should not work well... (and it's probably not mp3) – sascha Jul 23 '17 at 14:50
  • bot.sendAudio downloads the URL to telegram servers and allows the bot user to stream it in the telegram app..and I get the download link from different APIs ..Thanks for your time – chris Jul 23 '17 at 14:58
  • https://stackoverflow.com/q/73180212/6013016 – Scott Jul 31 '22 at 02:04

0 Answers0