jeckman / YouTube-Downloader

PHP script for downloading videos from youtube; also parsing youtube feed into RSS enclosures for podcatchers
GNU General Public License v2.0
894 stars 473 forks source link

OpenSSL Error messages: error:14095126 unexpected eof while reading #442

Closed birdhouses closed 4 years ago

birdhouses commented 4 years ago

Description

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.

jeckman commented 4 years ago

If you're running that fork I'd suggest tracking the issue there, unless you've validated it happens with this branch as well