Closed inglesuniversal closed 2 years ago
just loop through all available formats until you find the one that's mp4:
$downloadOptions = $youtube->getDownloadLinks("https://www.youtube.com/watch?v=aqz-KE-bpKQ");
foreach ($downloadOptions->getCombinedFormats() as $format) {
if (strpos($format->mimeType, 'video/mp4') !== false) {
echo $format->url;
break;
}
}
Is it possible to get the file in mp3?
I don't believe YouTube ever returns links to mp3 files... you would have to download audio-only version of whatever format they provide, and then convert it yourself using ffmpeg or something.
Got it!!!
I tried with two videos and got them in 3gp
How can I force to always get the mp4 version of it.
and
Is it possible to get the file in mp3?
Regards