How can I quickly download audio from YouTube by URL or ID and send it to Telegram bot? I've been using youtube-dl to download audio, save it on hosting and after that send it to user. It takes 1-2 minutes to do that. But other bots (like this one #LyBot) do this with the speed of light. How do they do this?
As it says in their documentation "I send audio instantly if it has already been downloaded through me earlier. Otherwise, the download usually takes no more than 10 seconds."
They probably store a file the first time its downloaded by any user so that it can be served instantly for subsequent requests.
Related
I am making a discord bot in python which would ping me whenever the YouTubers I wish to keep track of upload any video.
So at first, I thought of using the Youtube Api but I couldn't find anything for this specific topic. Then I found RSS feeds.
So my main question is, what are the rate limits on calling the URL (https://www.youtube.com/feeds/videos.xml?channel_id=xxx)?
As the plan, I have in my mind is that I will make an HTTP request to the URL every x seconds, and if it sees any update, it pings me in my server.
I want to create a web application(Flask- A Flashcard AI), a part of which is a bot which needs to directly interact with the human through speech recognition and text-to-speech. I have pyttsx3 and speech_recognition installed for that, where I am confused is how am I supposed to get the user's audio as input and then send it to the backend. I have tried to look up YouTube tutorials and asked other people about the same, the only success I've had is learning about Navigator.MediaDevices.getUserMedia. I want to make the communication fluent, and I will have to send the data to the back-end as well. I am not sure how to send it to the back-end and get the user media fluently, I could use Navigator.MediaDevices.getUserMedia and convert it into an audio file(not sure how to do that yet but I think I'll figure it out eventually, and having the user upload a audio recording won't be nice at all), but then that'll take up a lot of space on the database.
If you just want to process some action based on voice you can use speech API.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API
This API will be able to give you text based captions which you can easily store in the database.
If you need to store audio on server side you would convert that to some loassy format like mp3 or aac to save space.
I am working on a project, where I want to be able to retrieve real-time updates if users upload a picture on Instagram with a specific tag (a custom action should be executed when a user uploads a picture with a specific tag). The whole thing should be written in Python and should be running on a stand-alone Raspberry Pi.
As far as I have understood the Python Instagram API sends a GET request to the specified callback url which needs to respond with the hub.challenge parameter and so on. This means that the Python Script needs to run on the Server that is also hosting the callback url right? Which would mean that I can not do this on a Raspberry Pi.
Am I missing something here? I also built a similar thing with the Twitter Streaming API and it was not a problem at all!
Thanks in advance!
If you successfully used twitter on raspberry (I did it also, with Twython, which was fun), you can just use ifttt to send a tweet automatically each time there's a new photo on instagram. With the raspberry, you can check for new tweets regularly.
How can I stream a live movie or video for my clients to connect to a webpage and watch? I would prefer that it's in a SWF form, so maybe I could load a file into the SWF. This isn't a webcam type of thing, like maybe if I want to stream a video I made a while ago and allow my users to watch it all at once, and not have it restart every time they refresh. Could this be done in Python, PHP, etc? Or does it involve a program? I am using Ubuntu for my dedicated server. I also need the audio to be live too.
Thanks
"stream a live movie or video" and "stream a video I made a while ago" are contradictory, what do you really mean by "live"? Are you referring to a "broadcasted video" (i.e. may be prerecorded, but everyone will be viewing from the same stream) or "live video" (i.e. viewing events as it happens, being live implies broadcast).
There are services like Justin.TV or Ustream.TV that allows you to broadcast vieo stream from either live cameras, live screen capture, and/or prerecorded videos. They have their own (flash-based or HTML5-based) web players that can handle live streams and you will need to use their broadcasting software to manage the live stream. There is also Youtube Live if you are a Youtube partner.
I have a flash video upload that is going from the browser directly to S3. It works.
However, if the connection is interrupted, it will time out after about three seconds. On the other hand, if you upload a video to YouTube, even if you disconnect the internet, it will hang and then re-sume when the internet connection is working again. To test this, I uploaded a video, stopped my connection for five minutes (timed), and then started my internet connection again. After about thirty seconds the video continued uploading again. This is especially important, since the videos being uploaded are quite large (1GB+) and it may take several hours to upload.
How does YouTube do this? What do I need to change or examine in my own uploader in order for it to work as YouTube's does? Thank you.