Web Analytics Made Easy -
StatCounter YouTube-to-MP3 conversion - PHP class and script - CodingForum

Announcement

Collapse
No announcement yet.

YouTube-to-MP3 conversion - PHP class and script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Youtube changed the way the video file URLs are displayed in the source code.

    For those of you with the free version, do me a favor and test this new code out in the PHP converter class (this replaces the current SetFlvUrls method):

    PHP Code:
            private function SetFlvUrls($file_contents)
            {
                
    $vidUrls = array();
                
    $vidSrcTypes $this->GetVidSrcTypes();
                if (
    preg_match('/(yt\.playerConfig =)([^\r\n]+)/'$file_contents$matches) == 1)
                {
                    
    $jsonObj json_decode(trim($matches[2], ';'));
                    if (isset(
    $jsonObj->args->url_encoded_fmt_stream_map))
                    {
                        
    $urls urldecode(urldecode($jsonObj->args->url_encoded_fmt_stream_map));
                        
    //die($urls);
                        
    if (preg_match('/^((.+?)(=))/'$urls$matches) == 1)
                        {
                            
    $urlsArr preg_split('/,'.preg_quote($matches[0], '/').'/'$urls, -1PREG_SPLIT_NO_EMPTY);
                            foreach (
    $urlsArr as $url)
                            {
                                if (
    $matches[0] != 'url=')
                                {
                                    
    $url = ($url != $urlsArr[0]) ? $matches[0].$url $url;
                                    
    $urlBase preg_replace('/(.+?)(url=)(.+?)(\?)(.+)/'"$3$4"$url);
                                    
    $urlParams preg_replace('/(.+?)(url=)(.+?)(\?)(.+)/'"$1$5"$url);
                                    
    $url $urlBase "&" $urlParams;
                                }
                                else
                                {
                                    
    $url preg_replace('/^(url=)/'""$url);
                                }
                                
    $url preg_replace('/(.*)(itag=\d+&)(.*?)/''$1$3'$url1);
                                if (
    preg_match('/quality=small/',$url) != 1)
                                {
                                    
    $url preg_replace('/sig=/'"signature="$url);
                                    
    $url trim($url',');
                                    
    $url .= '&title=' urlencode($this->ExtractSongTrackName($file_contents$vidSrcTypes[0]));
                                    
    $url preg_replace_callback('/(&type=)(.+?)(&)/', function($match){return $match[1].urlencode($match[2]).$match[3];}, $url);
                                    
    $vidUrls[] = $url;
                                }
                            }
                            
    $vidUrls array_reverse($vidUrls);
                            
    //die(print_r($vidUrls));
                        
    }
                    }
                }
                
    $this->_flvUrls $vidUrls;
            } 
    The same basic logic should be applicable to the paid-for version as well...but I have yet to work on the code for that version...don't worry, It's coming soon!

    For now, please let me know if the above code works, and thanks again for your continued patience.
    Last edited by chump2877; Dec 19th, 2012, 12:00 PM.
    Regards, R.J.

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

    Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
    Explore all products and services, view demos, review documentation, check prices, and more!
    ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

    Comment


    • yup working

      Comment


      • The new (updated and hopefully stable) distribution of files is located at the bottom of this post.

        PLEASE SEE THIS POST FOR IMPORTANT INFO REGARDING THE USE AND INSTALLATION OF THIS SCRIPT.

        DO NOT USE THE ZIP DISTRIBUTION LOCATED AT THE ABOVE LINKED PAGE. USE ONLY THE ZIP FILE ATTACHED TO THE BOTTOM OF THIS POST.
        New in this release:

        1) YouTube changed the format of video file URLs in the video page source code. This fix addresses this change.

        I will soon be updating the paid-for version of the app as well, and I will email an updated (free) copy to all those who have already purchased the script. (Updates will be sent to your Tradebit email addresses only.)

        As always, please let me know if you have any questions/concerns regarding the above and/or the code.
        Attached Files
        Regards, R.J.

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

        Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
        [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
        Explore all products and services, view demos, review documentation, check prices, and more!
        ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

        Comment


        • Hello everyone,

          As promised, I have just finished updating the paid-for version of my software. New in this version:

          1) YouTube changed the format of video file URLs in the video page source code. This fix addresses this change.

          All previous customers who have purchased the paid-for version of my app are receiving this new, updated version via the e-mail addresses that you provided at Tradebit.com.

          Please report any issues with either the paid-for version or the free version in this forum thread.

          Thanks!
          Regards, R.J.

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

          Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
          [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
          Explore all products and services, view demos, review documentation, check prices, and more!
          ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

          Comment


          • I have paid version of your script. Can you tell me what exactly should I change because I have custom design and some custom code in those files?

            Thanks.

            Comment


            • Originally posted by chump2877 View Post
              Hello everyone,

              As promised, I have just finished updating the paid-for version of my software. New in this version:

              1) YouTube changed the format of video file URLs in the video page source code. This fix addresses this change.

              All previous customers who have purchased the paid-for version of my app are receiving this new, updated version via the e-mail addresses that you provided at Tradebit.com.

              Please report any issues with either the paid-for version or the free version in this forum thread.

              Thanks!

              Hello Randall,

              I have paid version of your script as well. Can you please tell us what exact code needs to be changed because I have custom designed site and I dont want to mess up everything..

              kind regards.

              Jay

              Thanks.

              Comment


              • To those of you that may have "customized" the code in the PHP converter class (regardless of which version of my code you're using):

                The point of putting all of the functionality related to video conversion into a PHP class is to take advantage of one of the fundamental advantages of an object-oriented programming (OOP) design: code abstraction. So you put all of your fundamental logic in a "base" PHP class, and then any customization of those classes can be achieved in inherited classes (via overriding class members). Subsequently, the base class doesn't need to be edited.

                In the context of my code, the base PHP class is YouTubeToMp3Converter.class.php or VideoConverter.class.php (depending on what version you have). In relation to the recent fix, if you need to customize this class, you can extend it with your own class that overrides the SetFlvUrls() or SetVidSourceUrls() methods (again, depending on what version you have). And you don't have to edit the base class.

                The moral of the story here is that you can customize my code without editing the core class code. And if you edit the core class code, then you make it harder for yourself to embrace newer versions of the software.

                Regarding the recent fix, the only code that changes is in the SetFlvUrls() or SetVidSourceUrls() methods. The sole purpose of these methods is to retrieve an array of video URLs that can be used for conversion. So forgive me if I am having a hard time understanding why you would want to "customize" that functionality? And if you did need to customize something there, please don't change the code directly in the conversion class. Extend the class with your own class and make your changes in your custom class.

                All of this taken into consideration, if you need any further help (from me) applying the fix to your custom/modified code, then I will have to charge you for the work and time spent.
                Regards, R.J.

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

                Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
                [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
                Explore all products and services, view demos, review documentation, check prices, and more!
                ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

                Comment


                • Which files need to be changed in the paid version?
                  Regards, Andre
                  Support for YouTube Media Converter and Server Management.
                  Emailt: support [{AT}] mp3youtu [{DOT}] be

                  Comment


                  • Originally posted by Luckyplaya View Post
                    Which files need to be changed in the paid version?
                    the base PHP class is YouTubeToMp3Converter.class.php or VideoConverter.class.php
                    the only code that changes is in the SetFlvUrls() or SetVidSourceUrls() methods
                    SetVidSourceUrls() method in VideoConverter.class.php. That is the only code to change in paid-for version.
                    Regards, R.J.

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

                    Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
                    [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
                    Explore all products and services, view demos, review documentation, check prices, and more!
                    ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

                    Comment


                    • Originally posted by OujdaCoder
                      hi bro i need VideoConverter.class.php update Please
                      Please send me your Tradebit.com email address -- the one you supplied when purchasing my software. Then I will send you the update. FYI - You should have already been emailed this update.
                      Regards, R.J.

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

                      Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
                      [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
                      Explore all products and services, view demos, review documentation, check prices, and more!
                      ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

                      Comment


                      • Originally posted by OujdaCoder
                        can You Give Me The Link Of Product and How a can Pay
                        http://www.codingforum.net/showpost....&postcount=321

                        Payment by PayPal or credit card via Tradebit.com
                        Regards, R.J.

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

                        Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
                        [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
                        Explore all products and services, view demos, review documentation, check prices, and more!
                        ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

                        Comment


                        • Originally posted by OujdaCoder
                          a Payed Bro send Me the Update File at
                          [email protected]
                          You purchased the software, so you now have the most updated version.

                          bro all can You add Xvideos and tube8 and xhamster
                          This may be a mistake on my part, but I'm going to assume that this is a serious question. You can add additional video hosting sites to the software with a little customization of the code.

                          If the mentioned sites have APIs for accessing their video content, then that would be ideal. Otherwise, you may have to scrape the HTML source code of their pages to retrieve video file URLs.
                          Regards, R.J.

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

                          Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
                          [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
                          Explore all products and services, view demos, review documentation, check prices, and more!
                          ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

                          Comment


                          • Hey, been having trouble downloading videos again is it just my side or did youtube change stuff up again?

                            Comment


                            • Originally posted by bbrog View Post
                              Hey, been having trouble downloading videos again is it just my side or did youtube change stuff up again?
                              Still working for me...Can you provide URLs of specific videos?
                              Regards, R.J.

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

                              Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
                              [Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
                              Explore all products and services, view demos, review documentation, check prices, and more!
                              ♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

                              Comment


                              • Hi, been mostly getting problems with http://www.youtube.com/watch?v=MNvvzOpgOdo from this artist and this song.

                                Comment

                                Working...
                                X