R
R
Roman Sergeevich2020-09-02 11:19:40
YouTube
Roman Sergeevich, 2020-09-02 11:19:40

Is it possible to load audio from YouTube using a python script into a variable without writing to the hard disk (in webm)?

I am writing a telegram bot for parsing music from YouTube, I use the youtube_dl library to download tracks, after sending the track to the cart server I delete it from the railway, to optimize and reduce download time I want to skip the step with recording on the railway, send it to the cart right on the fly!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
ValdikSS, 2020-09-02
@roman24hs

youtube-dl has a feature to get a direct link without actually downloading it. Get a link to the audio, and download it already in your script into a variable, without the participation of youtube-dl.

S
Samuel_Leonardo, 2020-09-02
@Samuel_Leonardo

try to get the desired url through the extract_info function,
then through the telegram api (sendAudio or others), you can specify the url, instead of directly transferring the file

V
Viktor T2, 2020-09-02
@Viktor_T2

import io
fileinoperator = io.BytesIO()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question