How do I successfully get audio-only streams from youtube using ytdl-core on google firebase functions

71 views Asked by At

I have been using ytdl-core on Google cloud functions.

I am extracting the audio-only from YouTube videos to get audio summaries, particularly of developer conferences, news reports, etc.

It mostly works, but sometimes I do get odd behavior, so I have thought to reduce risks by using the agent proxy option.

However, I have yet to get it to work despite working with two paid proxies.

Here is what I do in condensed format:

// Create an agent with the proxy URL
const agent = new HttpsProxyAgent(proxyURL);
...

const audioStream = ytdl(videoUrl, { quality: lowestQualityFormat.itag, requestOptions: { agent: agent } });

The primary error I seem to be has been:

Error: C0D72206573E0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:358

Haven't gotten this error when not using proxies.

The second is a timeout error.

  1. Is using proxies the way to reduce the risks of ytdl-core sometimes not working? (A recent error has been the file is 94 minutes long no matter which video....and the audio is empty every time)
  2. Is there an alternative way to extract the audio?
  • I tried different proxies -- same error
  • I looked at the ytdl-core and miniget libraries...but couldn't figure out what to do about this error
0

There are 0 answers