Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the YouTube stream url [Need help] #4

Closed
RaghuMudem opened this issue Dec 16, 2021 · 3 comments
Closed

How to get the YouTube stream url [Need help] #4

RaghuMudem opened this issue Dec 16, 2021 · 3 comments

Comments

@RaghuMudem
Copy link

RaghuMudem commented Dec 16, 2021

Hi, This library is able to fetch and download the youtube video. I would like to get the youtube stream available url's from the given youtube url. Can you please help me the changes for this.

If i give the url simlar to the following https://www.youtube.com/watch?v=_xLgXIhebxA and expecting a stream url which i can play in my application.

Appriciates you positive response.

@RaghuMudem RaghuMudem changed the title How to get the YouTube stream url How to get the YouTube stream url [Need help] Dec 16, 2021
@alpacamybags118
Copy link
Owner

Hi @RaghuMudem thanks for taking an interest in the project and posting here!

I think the approach you would want to take depends on your application. If this is a website and you want to show the stream on the site, I think the easiest solution would be to embed the stream using something like an iframe. e.g.

<iframe width="560" height="315" src="https://www.youtube.com/embed/5qap5aO4i9A" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

If you need to programmatically work with the stream with something like yt-dlp, I think it will just be a matter of providing the right flags to get the data you are expecting. I would recommend taking a look here as it lists all the available options for yt-dlp. When you invoke yt-dlp with this library, you can pass any of the supported flags as part of the 2nd argument of createYtDlpAsProcess. For example:

const result = yt.createYtDlpAsProcess('https://some.url', {
  f: 'bestaudio',
  preferFreeFormats: true,
  audioMultistreams: true,
});

I'll take some time this weekend to see if I can provide a more concrete example of what I think you are trying to accomplish, but I would start with those recommendations and see where that gets you.

@alpacamybags118
Copy link
Owner

@RaghuMudem wanted to follow up and see if those suggestions help. let me know. if I don't hear back, I'll assume you figured something out and will close the issue for now.

@alpacamybags118
Copy link
Owner

@RaghuMudem I'm going to close this for now, but feel free to open another issue if you need additional help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants