Youtube video download php

Hello guys i can’t download music videos using this script but other videos like dance tutorial are download please tell me what is the problem in this script

$video_id = $_GET['d']; $title = $_GET['t'];

        $data = file_get_contents("https://www.youtube.com/get_video_info?video_id=$video_id&asv=3&el=detailpage&hl=en_US");
        parse_str($data);
        
        $arr = explode(",", $url_encoded_fmt_stream_map);
       
        foreach ($arr as $item) {
            parse_str($item);
            
            echo '<a href="'.$url.'?title='.$title.'">Download</a>
                    
            ';

Working : https://www.youtube.com/watch?v=-i0InwW0V9k
Not Working : https://www.youtube.com/watch?v=D--rQj49heE

provide working/not working examples.

Working : https://www.youtube.com/watch?v=-i0InwW0V9k
Not Working : https://www.youtube.com/watch?v=D--rQj49heE

Perhaps it’s to do with copyright? As YouTube’s ToS make clear, you do not have permission to download copyrighted material (which is everything, unless permission is explicitly granted for it to be downloaded).

9.1 With the exception of Content submitted to the Service by you, all other Content on the Service is either owned by or licensed to YouTube, and is subject to copyright, trade mark rights, and other intellectual property rights of YouTube or YouTube’s licensors. Any third party trade or service marks present on Content not uploaded or posted by you are trade or service marks of their respective owners. Such Content may not be downloaded, copied, reproduced, distributed, transmitted, broadcast, displayed, sold, licensed, or otherwise exploited for any other purpose whatsoever without the prior written consent of YouTube or, where applicable, YouTube’s licensors. YouTube and its licensors reserve all rights not expressly granted in and to their Content.

https://www.youtube.com/static?gl=GB&template=terms

But there i many sites
using this sites we download any files how thay do it please explain

for example http://savefrom.net/

Just because lots of people go burgling doesn’t make it legal or OK to do.

if it is possible so please tell me how they do it

Hopefully nobody here will tell you how to download copyrighted videos for which no permission to download has been granted.

3 Likes

The only ones who will likely be able to do that, are the ones doing it already, and there is little reason for them to help you figure it out.

As for your script, you should try debugging it. Look into the parse_data method, chances are it isn’t handling something very well. And that is the key to your problem.

However, you shouldn’t overlook the legality of your application. It very well could lend you into a really bad time.

hmm that mean i need to hire a more educated programmer

I’d say it’s the opposite.

You need to hire a less intelligent programmer.

One that is incapable of comprehending the ramifications of illegal activity.

1 Like

oh come on every one knows that IDM and sites like that easily download YouTube videos its just a joke of this policy’s

No, I think you missed the point of WebMachine’s post entirely.
It would be interpreted more accurately as “you need to hire a less ethical programmer.”

What ever I will create this site Born this policy

if youtube so care about copyright so why thay provide link to download

Because some people who upload their videos to YouTube give express permission for users to share or download their video.

They don’t. They only allow you to download your own videos.
Anything that allows you to download others is a hack.

hahahaha hacks well so i just west my time to lean youtube api
BUT NOT QUITE YET

I think that is likely the key difference between the working and not working URLs in the OP

The working - Veritasium - is a “science, educational” video channel.

The not working - T-Series - is a “music, movie” channel.

The first is much more likely to be agreeable with freely sharing knowledge.
The second is much more likely to not want to freely share copyrighted content.

2 Likes

Please explain one more think if we try to download video from this site download will start but when i copy paste download in in browser download show me permission error how its done