lip9000 Posted January 31, 2009 Share Posted January 31, 2009 I have a script that downloads youtube videos, but at the moment it currently downloads it as "video", with no extension. People then have to rename the file to .mp4 so that they can play it. I can't find this anywhere on google, or perhaps I am using the wrong words. I have seen this being done on keepvid, they use a script to change the extension of the download to .mp4 http://keepvid.com/save-video.mp4?http%3A%2F%2Fwww.youtube.com%2Fget_video%3Fvideo_id%3DiTBIo1c9xw0%26t%3DOEgsToPDskJd5Ezgva4cxwC76D1fDFOy%26fmt%3D18 How would I go about changing the extension like they do, but also rename the actual file as well, so from "video" to "some video name.mp4". Thanks heaps in advance! Quote Link to comment Share on other sites More sharing options...
redarrow Posted January 31, 2009 Share Posted January 31, 2009 show us the code first then where see if we can use the rename() command Quote Link to comment Share on other sites More sharing options...
lip9000 Posted January 31, 2009 Author Share Posted January 31, 2009 show us the code first then where see if we can use the rename() command My script only gets the youtube URL, and puts it after http://keepvid.com/save-video.mp4? So my script gets http%3A%2F%2Fwww.youtube.com%2Fget_video%3Fvideo_id%3DiTBIo1c9xw0%26t%3DOEgsToPDskJd5Ezgva4cxwC76D1fDFOy%26fmt%3D18 Thats all. But I would like to create a script like the one that keepvid uses to rename the download link. I don't think rename() would work because you have to download the file first and then use that function yeh? Quote Link to comment Share on other sites More sharing options...
lip9000 Posted February 2, 2009 Author Share Posted February 2, 2009 Anyone got any ideas???? Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 2, 2009 Share Posted February 2, 2009 When you download the video, is it going to a server directory, or is the user getting the file on there desktop. you will have to download the file to a sever directory then rename the file with rename() then let the user have it. the only way i can think off. let the users select playing videos to download, if the user wants to have that playing video hit download button, when the user hits download, Your code downloads the file to a server directory, then rename it, and you show the user a link button to confirm, they wanted the file, when button pressed they get the new named, playing video. Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 2, 2009 Share Posted February 2, 2009 You need to understand, that there hundreds off web sites, that also run 3rd party applications with php, and use the exec() command to get there installed application to work. because they got a 3rd party application running with php it looks like there just using php, but there not all them, downloads are coming from a 3rd party application to let users get the download and renamed to what ever. but becouse you or i, havent got the 3rd party application the only way i can think off php doing it alone explained below. Quote Link to comment Share on other sites More sharing options...
lip9000 Posted February 2, 2009 Author Share Posted February 2, 2009 You need to understand, that there hundreds off web sites, that also run 3rd party applications with php, and use the exec() command to get there installed application to work. because they got a 3rd party application running with php it looks like there just using php, but there not all them, downloads are coming from a 3rd party application to let users get the download and renamed to what ever. but becouse you or i, havent got the 3rd party application the only way i can think off php doing it alone explained below. Explained below where? Did you miss some code? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.