Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 8 of 79 FirstFirst ... 6789101858 ... LastLast
Results 106 to 120 of 1174
Like Tree5Likes

Thread: YouTube-to-MP3 conversion - PHP class and script

  1. #106
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ffmpeg

    hello,

    i use ffmpeg and ffmpeg-php , to convert i use normaly ffmpeg without php support.

    I have linux can you say me a way in your script that works with linux and not with an .exe (windows). I have debian (linux).

    thank you

  2. #107
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    I have not tried to run this application in anything other than XAMPP for Windows (because I only use it for my own personal use). The script is provided as is. If you need the script to run on a Linux server, there are ways to install FFmpeg on Linux / Debian. Once installed, you may also have to modify the relevant script code (as I indicated earlier).
    Last edited by chump2877; 09-17-2011 at 06:46 PM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  3. Users who have thanked chump2877 for this post:

    eyestrain (10-11-2011)

  4. #108
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi chump2877,

    Is your script still working. I have tried debugging your code and it seems to be failing at;

    eregi('fmt_url_map',$file_contents);

    fmt_url_map does not even exist in the page.

    Any suggestions?

  5. #109
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Quote Originally Posted by missenlinx View Post
    Hi chump2877,

    Is your script still working. I have tried debugging your code and it seems to be failing at;

    eregi('fmt_url_map',$file_contents);

    fmt_url_map does not even exist in the page.

    Any suggestions?
    Please use the latest version of the code. You are using an older version.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  6. #110
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @chump2877: First of all thanks for the code, it works like a charm. You really are the PHP master =D

    I have one question about youtube video size. Can you get/read flv size before you download the video on your computer? Is there any way to do that?

    Thank you,
    Tony

  7. #111
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    YouTube recently changed the front end of their site again. The following fix to my code is required:

    PHP Code:
            private function SetFlvUrl($file_contents)
            {
                
    $vidUrl '';
                if (
    eregi('"url_encoded_fmt_stream_map": "url=',$file_contents))
                {
                    
    $vidUrl end(explode('"url_encoded_fmt_stream_map": "url=',$file_contents));
                    
    $vidUrl urldecode(urldecode(current(explode('\u0026',$vidUrl))));
                }
                
    $this->_flvUrl $vidUrl;
            } 
    Download the revised YouTubeToMp3Converter.class.php below! ...And please let me know if you experience any issues with the code....
    Attached Files Attached Files
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  8. #112
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Quote Originally Posted by itsmeanthony View Post
    @chump2877: First of all thanks for the code, it works like a charm. You really are the PHP master =D

    I have one question about youtube video size. Can you get/read flv size before you download the video on your computer? Is there any way to do that?

    Thank you,
    Tony
    Hi Tony,

    My first inclination would be to try and acquire that kind of information via the YouTube API. For example, here is the API-way to grab a variety of data pertaining to a particular video. Further exploration reveals all of the possible data that can be retrieved for a given video "entry" object. Unfortunately, the API does not appear to provide individual video file size information (I think that's what you are after?). But you might try digging around a little more and see if I missed something.

    Apart from the API you might try the following link. This solution looks promising because it involves cURL (which my script already uses to download videos), so you might incorporate this technique into the SaveVideo method, just prior to actually downloading the video. There you could institute a check for file size, and if the size was either too big (or too small?), then you could cancel the video save operation and make the method return false.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  9. #113
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    didnt work.

    it didnt work.help me.

  10. #114
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    it didnt work.help me.
    Just tried it here again, and it works fine.

    And please: If you are going to request help, kindly describe the specific issue(s) that you are having. I almost didn't bother replying to your post because of the lack of effort that went into it. Thanks!
    Last edited by chump2877; 12-10-2011 at 08:23 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  11. #115
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hey chump, This is a great script but i'm having a problem, i'm not amazing at php and the conversion works perfectly its just i can't seem to get it to make a download.
    I saw some posts about making a link to it, and then you replyed with a link to some php forum and how to do it but i just don't understand it.

    Basicly i need a link after the conversion finished like "DOWNLOAD NOW" that is linked to the mp3 that they just converted, If this helps i'm hosting the website on a shared host.

    Please help as soon as possible Thankyou

  12. #116
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Quote Originally Posted by jibreel View Post
    Basicly i need a link after the conversion finished like "DOWNLOAD NOW" that is linked to the mp3 that they just converted, If this helps i'm hosting the website on a shared host.
    I've gotten several requests for this feature, so I have modified the code as follows:

    1) Added download link after successful conversion
    2) Added conversion process progress bar
    3) Some general refactoring of code

    Download the revised files below. ...And please let me know if you experience any issues with the code....

    Happy Holidays!

    Edit: The progress bar feature will only work for PHP versions 5.3 and above. To disable the progress bar, you need only comment out the following lines of code in YouTubeToMp3Converter.class.php:

    PHP Code:
            private function SaveVideo($url)
            {
                
    $this->_percentVidDownloaded 0;
                
    $this->SetTempVidFileName(time());
                
    $file fopen($this->GetTempVidFileName(), 'w');
                
    $ch curl_init();
                
    curl_setopt($chCURLOPT_FILE$file);
                
    curl_setopt($chCURLOPT_HEADER0);
                
    curl_setopt($chCURLOPT_URL$url);
                
    curl_setopt($chCURLOPT_FOLLOWLOCATION1);
                
    //curl_setopt($ch, CURLOPT_NOPROGRESS, false);
                //curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, array($this, 'UpdateVideoDownloadProgress'));
                //curl_setopt($ch, CURLOPT_BUFFERSIZE, 4096000);
                
    curl_exec($ch);
                
    curl_close($ch);
                
    fclose($file);
                return 
    is_file($this->GetTempVidFileName());
            } 
    ...and change the following line of code in index.php:
    PHP Code:
    echo '<div id="progress-bar"><div id="progress">0%</div></div></div>'
    ...to:
    PHP Code:
    echo '</div>'
    Attached Files Attached Files
    Last edited by chump2877; 12-26-2011 at 06:05 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  13. Users who have thanked chump2877 for this post:

    jibreel (12-25-2011)

  14. #117
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thankyou chump, But im afraid that has not fixed my problem.
    My website is www.free-youtube-mp3.org

    My website folder consists of the index.php and the youtubetomp3converter.class.php that you sent me, aswell as Mp3 and videos folder that have full writes.

    When i press convert it takes time, then a page full of codes comes up :/ please help


    - After attempting to convert the video and apart from what i said up above an error log appeared in my files on my shared server and i saw this when i was using filezilla. I'm giving the mp3 file full permission (777) but i don't think it saves the permission?.
    Error Log-
    [25-Dec-2011 06:29:13] PHP Warning: fopen(videos/1324816153.flv) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /home/freeyou1/public_html/YouTubeToMp3Converter.class.php on line 101
    [25-Dec-2011 06:29:13] PHP Warning: curl_setopt(): supplied argument is not a valid File-Handle resource in /home/freeyou1/public_html/YouTubeToMp3Converter.class.php on line 103
    [25-Dec-2011 06:29:16] PHP Warning: fclose(): supplied argument is not a valid stream resource in /home/freeyou1/public_html/YouTubeToMp3Converter.class.php on line 111
    Last edited by jibreel; 12-25-2011 at 12:37 PM. Reason: more information.

  15. #118
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    It looks like something is going wrong with cURL when the FLV file is being downloaded from YouTube. The likely offending code is in the SaveVideo() method:

    PHP Code:
                $file fopen($this->GetTempVidFileName(), 'w');
                
    $ch curl_init();
                
    curl_setopt($chCURLOPT_FILE$file);
                
    curl_setopt($chCURLOPT_HEADER0);
                
    curl_setopt($chCURLOPT_URL$url);
                
    curl_setopt($chCURLOPT_FOLLOWLOCATION1);
                
    curl_setopt($chCURLOPT_NOPROGRESSfalse);
                
    curl_setopt($chCURLOPT_PROGRESSFUNCTION, array($this'UpdateVideoDownloadProgress'));
                
    curl_setopt($chCURLOPT_BUFFERSIZE256);
                
    curl_exec($ch); 
    Are you sure you have cURL enabled, or running correctly, for your server's PHP installation?

    Can you use cURL to read from and write to any other files?

    Can you use fopen() to open and create other files?

    That's all I have off the top of my head. I run the code here with no issues.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  16. #119
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Sorry for making you waste your time by assisting me but i'm not good at these type of things, And yes Curl is enabled.

    I think i'v just mixed the wrong files up, Sorry for asking but would it be tomuch to ask if you uploaded the full website folder with all the files in it needed to work, Please

    If not it's fine i'll just keep trying :/

  17. #120
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Are your 'videos' and 'mp3' folders directly in '/home/freeyou1/public_html/' (your web root)? They should be. Your errors indicate that perhaps these directories are elsewhere...

    The required directory structure for all files/directories involved is outlined in the the first post of this thread.

    BTW - I just added a progress bar to 12-25-11.zip distribution, so you may want to download the zip again to get the updated files with progress bar included.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!


 
Page 8 of 79 FirstFirst ... 6789101858 ... LastLast

LinkBacks (?)

  1. 07-21-2014, 05:32 PM
  2. 07-12-2014, 05:59 PM
  3. 06-26-2014, 03:39 PM
  4. 05-31-2014, 09:13 PM
  5. 04-24-2014, 07:53 PM
  6. 04-19-2014, 10:22 AM
  7. 04-04-2014, 08:33 PM
  8. 04-04-2014, 01:58 AM
  9. 03-28-2014, 06:03 AM
  10. 03-20-2014, 06:11 PM
  11. 03-16-2014, 01:22 AM
  12. 03-08-2014, 04:56 PM
  13. 03-07-2014, 06:21 PM
  14. 03-01-2014, 12:48 PM
  15. 02-22-2014, 08:40 PM
  16. 02-22-2014, 12:02 AM
  17. 02-21-2014, 08:15 PM
  18. 02-21-2014, 12:00 AM
  19. 02-20-2014, 08:37 PM
  20. 02-20-2014, 06:53 PM
  21. 02-20-2014, 03:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •