Athlon1600 / youtube-downloader

:tv: PHP based alternative to youtube-dl and yt-dlp. Active and frequently updated! :star:
https://unblockvideos.com/
MIT License
801 stars 315 forks source link

OpenSSL Error messages: error:14095126:SSL #54

Closed birdhouses closed 4 years ago

birdhouses commented 4 years ago

Description

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

returns when:

$file = file_get_contents($url['url'], false, stream_context_create($arrContextOptions));

Steps to Reproduce

https://www.youtube.com/watch?v=r5NzAksjfDI

  1. Extract the video id: $video_id = $yt->extractVideoId(implode($url));
  2. Get the downloadable url $links = $yt->getDownloadLinks($video_id, $selector = 'video');
  3. Get the array key for the specified video quality etc. $arrayindex = array_search('mp4, video, 1080p, audio', array_column($links, 'format'));
  4. Set $url to array $url = $links[$arrayindex];
  5. Disable SSL $arrContextOptions=array( "ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false, ), );
  6. Get the file from the url $video = file_get_contents($url['url'], false, stream_context_create($arrContextOptions));
  7. Send the video back to front end 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.

Athlon1600 commented 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.