• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Tutsplanet

Tutsplanet

Free Technical and Blogging Resources

  • Home
  • Web Hosting
  • Programming
  • Plugins
  • Twitter Trends
  • Tools
  • About Us

Programming

A Simple YouTube Video Downloader Script in PHP

Sep 5, 2019 Editorial Staff 90 Comments

Share
Tweet
Share
1170 Shares

YouTube is the most popular video-sharing platform in the world. It helps users to upload, view, and share videos that keeps community guidelines. Tons of people selected YouTube video making as a full-time job, as they create and upload videos and getting revenue from YouTube Adsense( Google Adsense). But, YouTube lacks one important feature, direct download of videos to users’ computers or mobiles. That’s why we created this tutorial,   and we will show how to download YouTube videos using PHP. This YouTube downloader PHP script 2021 helps you to download 90% of Youtube videos from Youtube.

Main Features of this YouTube Videos downloader

  • Easy to Install
  • Easy to Customize (This is a very basic PHP script, and easily customizable)
  • Fast Loading without cache mechanism
  • No Database Required.
  • No installation required, just copy-paste the script to your web server that runs PHP

First things first, we have the below scripts to work YouTube downloader.

  1. index.php
  2. class.youtube.php
  3. downloader.php

First, we will examine the class.youtube.php as this is the core file that executes important features for downloading a video from YouTube.

  • getYouTubeCode – Get the YouTube code from a video URL
  • processVideo – Process the video url and return details of the video
<?php
/**
 * Tutsplanet
 *
 * This class narrates the functions to support download a video from YouTube
 * @class YouTubeDownloader
 * @author Tutsplanet
 *
 */

Class YouTubeDownloader {

    /**
     * Get the YouTube code from a video URL
     * @param $url
     * @return mixed
     */
    public function getYouTubeCode($url) {
        parse_str( parse_url( $url, PHP_URL_QUERY ), $vars );
        return $vars['v'];
    }

    /**
     * Process the video url and return details of the video
     * @param $vid
     * @return array|void
     */

    public function processVideo($vid) {
        parse_str(file_get_contents("https://youtube.com/get_video_info?video_id=".$vid),$info);


        $playabilityJson = json_decode($info['player_response']);
        $formats = $playabilityJson->streamingData->formats;
        $adaptiveFormats = $playabilityJson->streamingData->adaptiveFormats;

        //Checking playable or not
        $IsPlayable = $playabilityJson->playabilityStatus->status;

        //writing to log file
        if(strtolower($IsPlayable) != 'ok') {
            $log = date("c")." ".$info['player_response']."\n";
            file_put_contents('./video.log', $log, FILE_APPEND);
        }

        $result = array();

        if(!empty($info) && $info['status'] == 'ok' && strtolower($IsPlayable) == 'ok') {
            $i=0;
            foreach($adaptiveFormats as $stream) {

                $streamUrl = $stream->url;
                $type = explode(";", $stream->mimeType);

                $qualityLabel='';
                if(!empty($stream->qualityLabel)) {
                    $qualityLabel = $stream->qualityLabel;
                }

                $videoOptions[$i]['link'] = $streamUrl;
                $videoOptions[$i]['type'] = $type[0];
                $videoOptions[$i]['quality'] = $qualityLabel;
                $i++;
            }
            $j=0;
            foreach($formats as $stream) {

                $streamUrl = $stream->url;
                $type = explode(";", $stream->mimeType);

                $qualityLabel='';
                if(!empty($stream->qualityLabel)) {
                    $qualityLabel = $stream->qualityLabel;
                }

                $videoOptionsOrg[$j]['link'] = $streamUrl;
                $videoOptionsOrg[$j]['type'] = $type[0];
                $videoOptionsOrg[$j]['quality'] = $qualityLabel;
                $j++;
            }
            $result['videos'] = array(
                'info'=>$info,
                'adapativeFormats'=>$videoOptions,
                'formats'=>$videoOptionsOrg
            );
            
            
            return $result;
        }
        else {
            return;
        }
    }

}

In processVideo() function, first we parse the outputs from the YouTube video info page. It is important to note that, chunks of data returning from this line of code, but we will not use all of this. Next, we check the status to see if it’s ok, then move to the next steps of parsing the different streams by using this code $playabilityJson->streamingData->adaptiveFormats.

It returns different versions of  YouTube video such as mp4, mp3, and most importantly various qualities(720p,360p). Finally, we push all these to an array and set the value in return.

Download the YouTube video by using a simple form in PHP

We use the below form to take users input ie. YouTube video url. This comes in the index.php.

<form method="post" action="" class="formSmall">
	<div class="row">
		<div class="col-lg-12">
			<h7 class="text-align"> Download YouTube Video</h7>
		</div>
		<div class="col-lg-12">
			<div class="input-group">
				<input type="text" class="form-control" name="video_link" placeholder="Paste link.. e.g. https://www.youtube.com/watch?v=OK_JCtrrv-c">
				<span class="input-group-btn">
				<button type="submit" name="submit" id="submit" class="btn btn-primary">Go!</button>
			  </span>
			</div><!-- /input-group -->
		</div>
	</div><!-- .row -->
</form>

Next, we have to write our PHP code that inputs the video ID and return the different video URLs for download.

<?php
require_once "class.youtube.php";
$yt  = new YouTubeDownloader();
$downloadLinks ='';
$error='';
if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $videoLink = $_POST['video_link'];
    if(!empty($videoLink)) {
        $vid = $yt->getYouTubeCode($videoLink);
        if($vid) {
            $result = $yt->processVideo($vid);
            
            if($result) {
                //print_r($result);
                $info = $result['videos']['info'];
                $formats = $result['videos']['formats'];
                $adapativeFormats = $result['videos']['adapativeFormats'];

                

                $videoInfo = json_decode($info['player_response']);

                $title = $videoInfo->videoDetails->title;
                $thumbnail = $videoInfo->videoDetails->thumbnail->thumbnails{0}->url;
            }
            else {
                $error = "Something went wrong";
            }

        }
    }
    else {
        $error = "Please enter a YouTube video URL";
    }
}
?>

Above script, we include the class fileclass.youtube.php, which is the core of this application. Finally, we confirm the POST method and fetch the results from the class methods.

The below code will show you how to display the YouTube download links in a tabular format, with quality and type.

<?php if($formats):?>
        <div class="row formSmall">
            <div class="col-lg-3">
                <img src="<?php print $thumbnail?>">
            </div>
            <div class="col-lg-9">
                <?php print $title?>
            </div>
        </div>

        <div class="card formSmall">
            <div class="card-header">
                <strong>With Video & Sound</strong>
            </div>
            <div class="card-body">
                <table class="table ">
                    <tr>
                        <td>Type</td>
                        <td>Quality</td>
                        <td>Download</td>
                    </tr>
                    <?php foreach ($formats as $video) :?>
                        <tr>
                            <td><?php print $video['type']?></td>
                            <td><?php print $video['quality']?></td>
                            <td><a href="downloader.php?link=<?php print urlencode($video['link'])?>&title=<?php print urlencode($title)?>&type=<?php print urlencode($video['type'])?>">Download</a> </td>
                        </tr>
                    <?php endforeach;?>
                </table>
            </div>
        </div>

        <div class="card formSmall">
            <div class="card-header">
                <strong>Videos video only/ Audios audio only</strong>
            </div>
            <div class="card-body">
                <table class="table ">
                    <tr>
                        <td>Type</td>
                        <td>Quality</td>
                        <td>Download</td>
                    </tr>
                    <?php foreach ($adapativeFormats as $video) :?>
                        <tr>
                            <td><?php print $video['type']?></td>
                            <td><?php print $video['quality']?></td>
                            <td><a href="downloader.php?link=<?php print urlencode($video['link'])?>&title=<?php print urlencode($title)?>&type=<?php print urlencode($video['type'])?>">Download</a> </td>
                        </tr>
                    <?php endforeach;?>
                </table>
            </div>
        </div>
        <?php endif;?>

How to download the video using the link?

You may have noticed there is a page called downloader.php in the above script. This script is responsible for the force download of the file to your computer or mobile. This is the standard force download process in PHP.

<?php
$downloadURL = urldecode($_GET['link']);
//print  $downloadURL;exit;
$type = urldecode($_GET['type']);
$title = urldecode($_GET['title']);

//Finding file extension from the mime type
$typeArr = explode("/",$type);
$extension = $typeArr[1];

$fileName = $title.'.'.$extension;


if (!empty($downloadURL)) {
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment;filename=\"$fileName\"");
    header("Content-Transfer-Encoding: binary");

    readfile($downloadURL);

}

I hope everyone enjoyed this article, don’t forget to share this article with your peers.

You can download this source code from GitHub Repo

 

UPDATE(20 Aug 2020)

The adaptive formats in YouTube provide videos with video only and audios with audio-only options. But we have updated the script with two other formats that are available with both audio and video.  The only solution to work with different quality is to merge audio and video from adaptive formats.  We are not going very deep with ffmpg, but you may install and play with this cross-platform solution to record, convert and stream audio and video.

A sample command would be

ffmpeg -i videoplayback.mp4 -i videoplayback.m4a -c:v copy -c:a copy output.mp4

Relates Articles

  • Show Thumbnail Image from YouTube Video URL using PHP
  • Get YouTube Video Thumbnail URL using PHP
  • Get a YouTube video thumbnail from the YouTube API

Editorial Staff

Editorial Staff at Tutsplanet is a dedicated team to write various tutorials about subjects like Programming, Technology and Operating Systems.

View all posts by Editorial Staff

Reader Interactions

Comments

  1. Abram Juarbe says

    Sep 20, 2019 at 5:29 am

    Don’t work, it download a file that is not a video.

    Reply
    • Editorial Staff says

      Sep 20, 2019 at 6:29 am

      Some videos will not work as it is restricted. I have added a log in the class file, please update your files and check again. Now you can see the status writing to log file. And also please try with this url and update me. https://www.youtube.com/watch?v=OK_JCtrrv-c

      Reply
      • Sajjad Hosen says

        Jan 21, 2021 at 2:09 am

        Hey, this works pretty well but a simple problem when I want to download the full playlist but the script won’t work, and got some errors. Update script for download playlist.

        Reply
        • Editorial Staff says

          Jan 23, 2021 at 4:53 pm

          At the moment, this script will work only for an individual video.

          Reply
          • mydo says

            Apr 17, 2021 at 6:16 pm

            hi pleassssssssssss ansower me i have sever and domin its not working its working onely on localhost!!

          • Editorial Staff says

            Apr 20, 2021 at 7:01 am

            What is the config of the server ?

    • Speed Faster says

      Oct 24, 2020 at 2:40 pm

      bhai its unbeliveable. working properly
      thanks a lot
      thanks thanks thanks thanks

      Reply
  2. Roberto says

    Dec 17, 2019 at 2:55 pm

    Thanks for helpful Tutorial Guys.
    If you guys need fully functional and up-to-date Youtube Downloader along with other sources as well you should take a look on https://xlscripts.com/php-scripts/video-downloader-script-all-in-one-video-downloader/
    Just my two cents

    Cheers

    Reply
    • Michael says

      Apr 15, 2020 at 11:45 pm

      Doesnt work and cant get tech support to answer me.

      Reply
  3. Fran says

    Dec 21, 2019 at 11:03 pm

    Very good. It works perfectly.

    Reply
  4. Akash Rahman says

    Apr 21, 2020 at 1:43 pm

    This script is run with localhost?

    Reply
    • Editorial Staff says

      Apr 23, 2020 at 6:09 am

      Yes

      Reply
  5. Asep Marzuki says

    May 24, 2020 at 6:26 am

    i Got This Error

    Notice: Undefined index: url_encoded_fmt_stream_map in D:\xampp\htdocs\simple-down\class.youtube.php on line 45

    Notice: Undefined index: type in D:\xampp\htdocs\simple-down\class.youtube.php on line 52

    Notice: Undefined index: url in D:\xampp\htdocs\simple-down\class.youtube.php on line 55

    Notice: Undefined offset: 1 in D:\xampp\htdocs\simple-down\class.youtube.php on line 56

    Notice: Undefined index: quality in D:\xampp\htdocs\simple-down\class.youtube.php on line 57

    how to fix it ?

    Reply
    • Editorial Staff says

      Jun 1, 2020 at 6:12 am

      Updated the code with latest YouTube changes. Download from GitHub repo. Let us know if it’s works

      Reply
      • Onkar jha says

        Mar 5, 2021 at 11:21 am

        Link to new code please

        Reply
        • Editorial Staff says

          Mar 6, 2021 at 2:15 pm

          You can download it from the linked github url

          Reply
  6. Macueco says

    May 31, 2020 at 6:24 pm

    Don’t work.

    link: https://www.youtube.com/watch?v=X5Tn0IhgMEk

    NOTICE:
    Undefined index: url_encoded_fmt_stream_map in C:\wamp\www\Simple-YouTube-Downloader-master\class.youtube.php on line 45

    Undefined index: type in C:\wamp\www\Simple-YouTube-Downloader-master\class.youtube.php on line 52

    Undefined index: url in C:\wamp\www\Simple-YouTube-Downloader-master\class.youtube.php on line 55

    Undefined offset: 1 in C:\wamp\www\Simple-YouTube-Downloader-master\class.youtube.php on line 56

    Undefined index: quality in C:\wamp\www\Simple-YouTube-Downloader-master\class.youtube.php on line 57

    Reply
    • Editorial Staff says

      Jun 1, 2020 at 6:12 am

      Updated the code with latest YouTube changes. Download from GitHub repo. Let us know if it’s works

      Reply
      • Daniel Wills says

        Aug 28, 2020 at 3:46 pm

        It’s still not working

        Reply
        • Editorial Staff says

          Aug 28, 2020 at 3:52 pm

          Please share the video url?

          Reply
        • Shafqat says

          Aug 29, 2020 at 4:05 am

          it is working for me

          Reply
  7. Macueco says

    Jun 1, 2020 at 10:23 pm

    Thanks dude, congratulations.

    Reply
  8. Futanari says

    Jun 6, 2020 at 2:12 am

    https://www.youtube.com/watch?v=DUBkmULoBhA
    Notice: Undefined property: stdClass::$adaptiveFormats in C:\xampp\htdocs\ytd2\class.youtube.php on line 34

    Your code only works with some of the yt video. Please fix it

    Reply
    • Editorial Staff says

      Jun 21, 2020 at 10:37 am

      In this simple script, we are using publicly available YouTube API (https://youtube.com/get_video_info?video_id=ID and it’s restricted to show licensed content’s download links. You are not supposed download a licensed material unless you pay for it.

      Not sure how those other apis works, I should invest some time to dig in to that..

      Reply
      • Maisum says

        Jul 30, 2020 at 6:29 am

        Is there any other YouTube API through which we can download other youtube videos as well?

        Reply
  9. Video Downloader says

    Jun 8, 2020 at 10:49 am

    Why this code not working on live server?

    Reply
    • Editorial Staff says

      Jun 21, 2020 at 10:40 am

      It’s working in live servers- https://tools.tutsplanet.com/test/

      Reply
    • Aman Rawat says

      Mar 27, 2021 at 8:37 am

      It’s downloading a file in html format and definately that’s not a video

      Reply
  10. Ravi says

    Jun 25, 2020 at 2:53 am

    Notice: Undefined property: stdClass::$adaptiveFormats in G:\xampp\htdocs\youtube\class.youtube.php on line 34

    Reply
    • Maisum says

      Jul 30, 2020 at 6:12 am

      Same. The code works but not every video. Try this link which they provided: https://www.youtube.com/watch?v=OK_JCtrrv-c

      This link works for me. Don;t know which videos this code accepts for download though.

      Do share if you have found something else please.

      Reply
  11. vlive Apk says

    Jul 11, 2020 at 8:30 pm

    It will take Huge Bandwidth Because you are using Readfile

    Reply
  12. Mike says

    Jul 11, 2020 at 11:54 pm

    First of all congratulations.

    What about .mp3 download ?

    Thank you

    Reply
  13. JAC says

    Jul 28, 2020 at 2:07 pm

    Notice: Undefined property: stdClass::$url in C:\xampp\htdocs\class.youtube.php on line 51

    Reply
    • kashif says

      Nov 25, 2020 at 5:15 am

      bro i have same problem

      Notice: Undefined property: stdClass::$url in E:\xampp\htdocs\youtube\second\class.youtube.php on line 52

      could you solved it if yes than please send me the updated file at [email protected]

      thank you

      Reply
    • Hieki says

      Jan 2, 2021 at 11:56 pm

      https://www.tutsplanet.com/a-simple-youtube-video-downloader-script-in-php/#comment-4607

      Reply
  14. Ajk Khan Academy says

    Aug 12, 2020 at 12:17 pm

    YouTube Thumbnail Downloader HD If you want to download the thumbnail of any YouTube video, with HD quality and absolutely free.whenever you download YouTube video thumbnails you have different qualities of picture whenever you download a YouTube thumbnail you have many qualities and your wish is that you download in your favorite quality you have been provided in many qualities providing you HD quality quality 720P HD and Full HD and 1080 and many other pixels

    Reply
    • kashif says

      Nov 25, 2020 at 5:14 am

      sir i have also same problem

      Notice: Undefined property: stdClass::$url in E:\xampp\htdocs\youtube\second\class.youtube.php on line 52

      Reply
  15. ahmed says

    Aug 14, 2020 at 6:04 pm

    no sound

    Reply
  16. Hafiz Ameer Hamza says

    Aug 15, 2020 at 7:52 am

    Its working fine and can download the videos in any avaiable quality using this code.

    Thanks

    Reply
  17. hermit1771 says

    Aug 16, 2020 at 1:11 pm

    Hello.
    Could you give some advice or even write what to do so that the script does not pump the video to pk, but saves it to the server?

    Reply
  18. Muhammad Shehroz says

    Aug 18, 2020 at 12:48 pm

    No sound on videos? please help

    Reply
    • Editorial Staff says

      Aug 20, 2020 at 8:44 pm

      Just read the update at the post bottom. And please try with the updated version of code from Git

      Reply
  19. Farhan says

    Aug 18, 2020 at 7:38 pm

    Hello

    Am getting this error on some videos

    Notice: Undefined property: stdClass::$url

    How to resolve this?

    Also github Url?

    Reply
  20. Farhan says

    Aug 19, 2020 at 7:40 am

    Hello

    Am getting this error on some videos

    Notice: Undefined index: url

    How to resolve this?

    also your github link?

    Reply
  21. kuttynews says

    Aug 20, 2020 at 11:41 am

    Hey, the script is working thankyou man.!

    kuttynews

    Reply
  22. Hafiz Ameer Hamza says

    Aug 20, 2020 at 6:48 pm

    Hello admin,
    Script is working. But the videos don’t have any sound. Can you please help in this matter why videos don’t have sound ?? I would really appreciate if you help in this. You already did a great job by sharing this code.

    Thanks

    Reply
    • Editorial Staff says

      Aug 20, 2020 at 8:44 pm

      We have updated the post, please read the update section added at the bottom of the post and try to pull the git repo again.

      Reply
  23. Nbrooksbittle.Com says

    Aug 29, 2020 at 12:12 am

    woah this weblog is excellent i like reading your posts.

    Keep up the great work! You know, many peersons are searching around for
    this information, you could help them greatly.

    Reply
  24. shar ali says

    Sep 1, 2020 at 3:59 am

    thank you so much

    Reply
  25. Rudolf says

    Sep 2, 2020 at 9:54 pm

    Nicely written and done my friend!
    I’ve only just begun writing myself in the last few days and noticed manjy writers simply
    rehash olld content but add ery littloe of worth. It’s
    fantastic to read a helpful article of some true valuie to myself and your other followers.

    It’s going down onn the lisst of things I need to replicate as a new
    blogger. Reader engagement and content quality aree king.
    Many terrific thoughts; you have definitely made it on my list
    of sites to follow!

    Keep up the excellent work!
    All the best,
    Lem

    Reply
  26. vsezaymy.su says

    Sep 3, 2020 at 4:32 am

    It’s a shame you don’t have a donate button! I’d definitely donate to this outstanding blog!
    I guess for now i’ll settle for bookmarking and adding your RSS feed to
    my Google account. I look forward to fresh updates and will talk about this site with my Facebook group.
    Talk soon!

    Reply
  27. JAC says

    Sep 7, 2020 at 10:41 pm

    Notice: Undefined variable: formats in C:\xampp\htdocs\index.php on line 80

    Notice: Undefined property: stdClass::$url in C:\xampp\htdocs\class.youtube.php on line 52

    Reply
    • Max says

      Sep 11, 2020 at 7:33 am

      This is not just you, it happens on all my Apache2 servers. Luckily I’m using Nginx, which doesn’t show any errors by default. The script is working fine on both, if you look past the loads of errors on Apache.

      Reply
    • Khaeroni . says

      Dec 20, 2020 at 12:33 am

      change the line 80 like this this will remove undefinied variable

      Reply
      • Khaeroni . says

        Dec 20, 2020 at 12:34 am

        if(isset($formats))

        Reply
  28. Max says

    Sep 11, 2020 at 7:39 am

    Why is it that various other download sites and youtube-dl have no trouble finding the googlevideo.com URLs for videos with music, but this script doesn’t find anything for almost every video with music? Normal videos seem to work fine, official audio or music videos give an error. I get that there are restricted videos, but what are the other parties mentioned doing different? Thanks for the script anyway, this is just out of curiosity!

    Reply
  29. mesterperfect says

    Sep 17, 2020 at 7:46 am

    I have a problem
    Notice: Undefined variable: formats in E:\xampp\htdocs\Simple-YouTube-Downloader-master\index.php on line 80

    Reply
  30. Bogdan says

    Sep 26, 2020 at 1:00 pm

    Why can’t I download from my phone

    Reply
  31. "nullité relative" says

    Nov 2, 2020 at 9:47 am

    This page certainly has all of the info I needed about this subject and didn’t know who
    to ask.

    Reply
  32. YTMP3CONVERTER says

    Nov 12, 2020 at 10:03 am

    Hi there,
    Thanks for this great script, its working fine on my live server on pc/laptop but on mobile phones when i try to download its shows ” server problem” during downloading and not able to download.

    Reply
  33. ayman says

    Nov 27, 2020 at 9:45 pm

    Can I fetch a video size package !

    Reply
  34. ayman says

    Nov 27, 2020 at 9:55 pm

    Is there a possibility to bring more information about the video?

    Reply
  35. Orenjus says

    Nov 28, 2020 at 7:47 am

    hi! thanks for script & tutorial, let me ask how to format as audio?

    Reply
  36. How Long Does Dr Marty's Dog Food Last says

    Dec 1, 2020 at 8:26 pm

    Hey There. I found your blog the usage of msn. That is a very
    well written article. I will make sure to bookmark it and return to learn extra of your helpful info.
    Thank you for the post. I’ll definitely return.

    Reply
  37. location vacances cagnes sur mer says

    Dec 5, 2020 at 9:06 am

    What’s up it’s me, I am also visiting this web site daily, this web page is truly nice and the visitors are in fact sharing nice thoughts.

    Reply
  38. Khaeroni . says

    Dec 20, 2020 at 12:38 am

    bruh i dont want to fetch all size video on table Videos . i want video only with size 720p and 480p. any idea how to do this? or which line code to change this?

    Reply
  39. techbuddies says

    Jan 3, 2021 at 5:01 am

    Thanks bro it’s working properly great information keep sharing with us more information.Techbuddies popular tools

    Reply
  40. deeepak sharma says

    Jan 4, 2021 at 5:49 pm

    Notice: Undefined index: v in C:\xampp\htdocs\api\api1\class.youtube.php on line 20

    Reply
    • Editorial Staff says

      Jan 9, 2021 at 6:16 pm

      Check if you have supplied a valid youtube url. Please note that this script is just a demo, so you need tweak the validations and other parts etc?

      Reply
  41. damian28102000 says

    Jan 7, 2021 at 2:53 am

    Warning: failed loading cafile stream: `C:\xampp\apache\bin\curl-ca-bundle.crt’ in C:\dev\class.youtube.php on line 30

    Warning: file_get_contents(): Failed to enable crypto in C:\dev\class.youtube.php on line 30

    Warning: file_get_contents(https://youtube.com/get_video_info?video_id=bCiSELRb1oQ): failed to open stream: operation failed in C:\dev\class.youtube.php on line 30

    Notice: Undefined index: player_response in C:\dev\class.youtube.php on line 33

    Notice: Trying to get property ‘streamingData’ of non-object in C:\dev\class.youtube.php on line 34

    Notice: Trying to get property ‘formats’ of non-object in C:\dev\class.youtube.php on line 34

    Notice: Trying to get property ‘streamingData’ of non-object in C:\dev\class.youtube.php on line 35

    Notice: Trying to get property ‘adaptiveFormats’ of non-object in C:\dev\class.youtube.php on line 35

    Notice: Trying to get property ‘playabilityStatus’ of non-object in C:\dev\class.youtube.php on line 38

    Notice: Trying to get property ‘status’ of non-object in C:\dev\class.youtube.php on line 38

    Notice: Undefined index: player_response in C:\dev\class.youtube.php on line 42

    Reply
    • Editorial Staff says

      Jan 9, 2021 at 6:12 pm

      This is something because of the .crt file in your localhost installation. Could you please read the below and try to fix that.
      https://stackoverflow.com/questions/55526568/failed-loading-cafile-stream-in-file-get-contents

      Reply
    • Editorial Staff says

      Feb 7, 2021 at 7:05 pm

      It seems that the video you are trying to download is a licensed one. This is not a replacement for the websites like ytmate and all.

      Reply
  42. punjabi song says

    Jan 23, 2021 at 5:05 pm

    working …… Thanks for share

    Reply
  43. owen says

    Jan 29, 2021 at 7:20 pm

    script works great except that the script gives an error on random videos.
    I have a series of videos in a you tube channel, they have all similar information and format.
    The first video in the chain won’t download, the rest will.
    the error log is a jumble and I can’t really make out what the error is as to why it won’t come up with the file formats when we go to download. I tried this with the default script in the zip file as well, withouth any of my html modifications.

    any suggestions?

    Reply
    • Editorial Staff says

      Jan 31, 2021 at 6:00 am

      Could you please share the video urls that you tried to download?

      Reply
      • owen says

        Feb 1, 2021 at 7:45 pm

        sure… tx!
        https://www.youtube.com/watch?v=rIbnVuKRGuY

        and now this one too

        https://www.youtube.com/watch?v=zr-bmfmwunc

        this one below works fine along with the rest of ours. Just the two above won’t work.
        https://www.youtube.com/watch?v=9n8IofTINCE

        appreciate your insight!

        Reply
        • Editorial Staff says

          Feb 7, 2021 at 7:00 pm

          We have spent sometime on this, and realized that Youtube is using cipher signature for some of the videos.
          [code][signatureCipher] => s=IAM0ig1ZbIk_OBiVeFrdHJA5pPPBTpWCT68jTmDE2AFIC4DMWj8tsBKUpCvrgkae0x2OaiCrVgTYMqHgRRhUEJCXg[/code]

          Please use the below link to understand more about this from the below SO link. At the moment, we have handful stuff, but we will do research on this when we get time.
          https://stackoverflow.com/questions/21510857/best-approach-to-decode-youtube-cipher-signature-using-php-or-js

          Reply
          • owen says

            Feb 9, 2021 at 10:36 pm

            okay, thanks. would like to know if/when you get a work around for this.

  44. Durval says

    Feb 4, 2021 at 3:17 pm

    Well, it works well in some videos but in others it doesn’t … example: https://www.youtube.com/watch?v=GO9cAsNu3nw, it doesn’t work you know why?

    Reply
  45. Orlaz says

    Feb 18, 2021 at 6:39 pm

    hello, thanks for the script it works perfecctly but i will like to customized my url like http;//mydomain.com/youtube/videoid or any other way round.

    so i can send for someone to download a particular video without having to enter the video url again

    Reply
    • Editorial Staff says

      Feb 21, 2021 at 8:10 am

      This is just basic setup, you can enhance your own.

      Reply
  46. Fattain Naime says

    Feb 26, 2021 at 7:53 am

    YouTube sort link not working.

    Reply
  47. raj says

    Feb 28, 2021 at 12:38 pm

    not work – Notice: Undefined index: v in C:\xampp\htdocs\Simple-YouTube-Downloader-master\class.youtube.php on line 20

    help

    Reply
  48. Smadent says

    Mar 3, 2021 at 6:46 pm

    Bro it’s unbeliveable. working properly
    thanks a lot.
    Thanks a million!

    Reply
  49. Sukerjc says

    Mar 31, 2021 at 12:05 am

    Its working, doesnt work in localhost but working in my hosting. thanks

    Reply
  50. Rigo says

    Apr 10, 2021 at 9:46 pm

    I like the script and it works just as simple as it is.

    Is there a way to get a shorter download link?
    So the link can be shared after creating the download link.

    Thank You!

    Reply
  51. mic210 says

    Apr 10, 2021 at 10:41 pm

    Funktioniert leider bei mir nicht weder local noch gehostet!

    Reply
  52. Eddy says

    Jun 8, 2021 at 5:06 am

    Its not working on my localhost..

    Reply
  53. west boy says

    Jul 26, 2021 at 4:26 pm

    Please who has got solution? It is not working

    Reply
  54. Zohaib Wahab says

    Aug 3, 2021 at 4:53 am

    Warning: file_get_contents(https://youtube.com/get_video_info?video_id=OK_JCtrrv-c): failed to open stream: HTTP request failed! HTTP/1.0 410 Gone in C:\xampp\htdocs\youtube\class.youtube.php on line 30

    Notice: Undefined index: player_response in C:\xampp\htdocs\youtube\class.youtube.php on line 33

    Notice: Trying to get property ‘streamingData’ of non-object in C:\xampp\htdocs\youtube\class.youtube.php on line 34

    Notice: Trying to get property ‘formats’ of non-object in C:\xampp\htdocs\youtube\class.youtube.php on line 34

    Notice: Trying to get property ‘streamingData’ of non-object in C:\xampp\htdocs\youtube\class.youtube.php on line 35

    Notice: Trying to get property ‘adaptiveFormats’ of non-object in C:\xampp\htdocs\youtube\class.youtube.php on line 35

    Notice: Trying to get property ‘playabilityStatus’ of non-object in C:\xampp\htdocs\youtube\class.youtube.php on line 38

    Notice: Trying to get property ‘status’ of non-object in C:\xampp\htdocs\youtube\class.youtube.php on line 38

    Notice: Undefined index: player_response in C:\xampp\htdocs\youtube\class.youtube.php on line 42

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Quick Links

  • Top 21 Website Ideas To Make Money Online in 2021
  • A Simple YouTube Video Downloader Script in PHP
  • The 50 Most Useful jQuery Plugins for Frontend Development
  • Replace “\n” with new line characters, using Notepad++
  • Using Third-Party Libraries in Codeigniter
  • Upload Multiple Images and Store in Database using PHP and MySQL.
  • Hierarchical Tree view Category Example in Laravel
  • Laravel Image Intervention Tutorial With Example
  • How to import sql file in MySQL database using PHP?
  • Free VAT Calculator Online

Subscribe

* indicates required



Search Here

Share

   



Hot topics

  • Replace “\n” with new line characters, using Notepad++ 37 views
  • How to enter new line in Microsoft Teams? 34 views
  • Simple PHP Shopping Cart 18 views
  • Add FTP/SFTP in Visual Studio Code 15 views
  • Open a URL in a new tab using JavaScript 13 views
  • Laravel: Download files to storage from SFTP 12 views
  • Solution: windows photo viewer opens each time save a pic file 12 views
  • A Simple YouTube Video Downloader Script in PHP 11 views
  • Laravel Eloquent Select Column as Alias 11 views
  • Get Uploads Directory Path in WordPress 9 views

Categories

  • Design & Development
  • Drupal
  • Facebook
  • General
  • How To
  • ios
  • Javascript
  • Linux
  • Magento
  • Marketing
  • News
  • PHP
  • Plugins
  • Programming
  • Snippets List
  • Social Media
  • Softwares
  • Themes
  • Tips
  • Wordpress
  • YouTube























Copyright © 2023 · Planet on Genesis Framework · Powered By BunnyCDN . Network wallpapernoon.com