Answer the question
In order to leave comments, you need to log in
How to get the original YouTube video link?
How to get the original YouTube video link, similar to many video download services. After a bit of searching, I found several articles:
$config = urldecode(file_get_contents('https://www.youtube.com/get_video_info?video_id='.$id));
$end = array();
echo '<pre>';
foreach ( explode('&', $config) as $key => $value )
{
array_push( $end, explode( '=', $value ) );
}
foreach ( $end as $el )
{
if( $el[0] == 'url' )
echo '<a href="'.urldecode($el[1]).'">'.urldecode($el[1]).'</a><br>';
}
Answer the question
In order to leave comments, you need to log in
Why bother if there is youtube-dl
Actually, you call youtube-dl from php and get an array of links. I immediately warn you that the links to the videos are in quality up to 720p. For higher quality, you will need to merge the video and audio track, because. they go separately. (ffmpeg to the rescue)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question