Closed birdhouses closed 4 years ago
I think this is unrelated to youtube-downloader. You need to enable SSL to work properly on your environment. What's the line number that's being reported for that error?
"file_get_contents(): SSL operation failed with code 1"
gives out 180K search results. This seems to be a common problem.
Description
This error:
returns when:
$file = file_get_contents($url['url'], false, stream_context_create($arrContextOptions));
Steps to Reproduce
https://www.youtube.com/watch?v=r5NzAksjfDI
$video_id = $yt->extractVideoId(implode($url));
$links = $yt->getDownloadLinks($video_id, $selector = 'video');
$arrayindex = array_search('mp4, video, 1080p, audio', array_column($links, 'format'));
$url = $links[$arrayindex];
$arrContextOptions=array( "ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false, ), );
$video = file_get_contents($url['url'], false, stream_context_create($arrContextOptions));
return view('convert', [ 'url' => $url['url'], 'quality' => $url['format'], ]);
Expected behavior: The video gets downloaded on my disk Actual behavior:
I get this error: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14095126:SSL routines:ssl3_read_n:unexpected eof while reading
The code stops executing on that line aswell.
Version
The latest version of: https://github.com/Athlon1600/youtube-downloader
Additional Information
I'm running this on Laravel 7, with php artisan serve.