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
895 stars 474 forks source link

no file extension in direct download #255

Closed chadul closed 7 years ago

chadul commented 7 years ago

videos downloaded as "videoplayback" with no extension

Art4 commented 7 years ago

We have no control over the response from the youtube servers. The direct link serves the video content that isn't meant for downloading directly through a browser. Thats why Youtube don't add a disposition header in their responses.

If you want a filename, than use the Proxy download instead, it will set a disposition header. See https://github.com/jeckman/YouTube-Downloader/blob/0.4/src/Application/DownloadController.php#L110

chadul commented 7 years ago

in youtibe-dl direct download links are successfully downloaded through file name, also on this site http://video.genyoutube.net/3tmd-ClpJxA

Art4 commented 7 years ago

If you open the direct link in your browser then the browser allows you to save the response. You can choose a path where the video should be saved and you can choose a filename. If the response contains a content-disposition header like Content-Disposition: attachment; filename="Castle-of-Glass-Official-Video-Linkin-Park.mp4" then the browser would recommend you to save the file as Castle-of-Glass-Official-Video-Linkin-Park.mp4. But if the header is not present the browser recommend you the name of the script that serves the video. In the URL https://r5---sn-5hnedn7z.googlevideo.com/videoplayback?requiressl=yes... that would be videoplayback. Thats what your issue is.

But in this whole process is Youtube-Downloader not involved. Only the youtube server and you with your browser. So there is no way for us to do something about this issue with the direct download.

Youtube-dl is a script that has access to your filesystem and the response from the youtube server. It can recommend you a better filename. Youtube-Downloder can do the same if it handles the whole response. Thats what the Proxy does. It reads the file and handles it to your browser or filesystem. This way it can also recommend you a better filename.

So to solve your problem if you don't want to write a filename by yourself: Use the proxy download.