Question: I used <http://www.youtube.com/get_video?video_id=ID&t=SIGNATURE&fmt=18> replaced

ID and SIGNATURE with the proper values. But I don't get see any save or download window, 

instead A blank window.

I am in Macintosh platform with Safari browser. Help Appreciated.

Answer: 
The internet is full of not working examples so here's a script for anyone who needs. Something is wrong with the flv files. Their links deliver .txt files but it's good with webm and mp4. I need that for the pr0n sites too hehehe

```
<?php

//$debug = true;

if(empty($debug))
    $debug = false;

if(empty($_GET['id']))
    die('no id');
if(!preg_match('/^[A-Z0-9-_]+$/i', $_GET['id']))
    die('invalid character in id');
else
    $id = $_GET['id'];

if(empty($_GET['type']))
    $type = 'mp4';
else
if(!preg_match('/^[A-Z]+$/i', $_GET['type']))
    die('invalid character in type');
else
    $type = strtolower($_GET['type']);

$url = 'http://youtube.com/get_video_info?video_id=';
$key = 'url_encoded_fmt_stream_map';
$content = file_get_contents($url.$id);
parse_str($content, $result);

if($debug)
    {
    echo $url.$id.'<br/>';
    echo $key.'<br/>';
    echo $type.'<br/>';
    echo '<pre>';
    print_r($result);
    echo '</pre>';
    }
else
    {
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="videofile.'.$type.'"');
    }

$type = 'type=video/'.$type;
$files = explode(',url=', $result[$key]);
$files[0] = substr($files[0], 4);

for($i=0; $i<count($files); $i++)
    {
    $file = urldecode($files[$i]);
    $found = strpos($file, $type) > -1;

    if ($debug)
        {
        if ($found) 
            echo '[THIS]';
        echo '<a href="'.$file.'">'.$file.'</a><br/><br/>';
        }
    else
        {
        if ($found) 
            {
            $file = explode('; codecs=', $file);
            @readfile($file[0]);
            break;
            }
        }   
    }
?>  

```
you try:

```
$id = "111_fGEdIvs"; //the youtube video ID
//$id = $_GET['id'];

//$format = $_GET['fmt']; //the MIME type of the video. e.g. video/mp4, video/webm, etc.
parse_str(file_get_contents("http://youtube.com/get_video_info?video_id=".$id),$info);     //decode the data
$streams = $info['url_encoded_fmt_stream_map']; //the video's location info
$streams = explode(',',$streams);
parse_str(urldecode($streams[0]),$data);  //In this example I am downloading only the first video

$url=$data['url'];
$sig=$data['signature'];
unset($data['type']);
unset($data['url']);
unset($data['sig']);
$urlPlay= str_replace('%2C', ',' ,$url.'&'.http_build_query($data).'&signature='.$sig); 

echo '<iframe class="youtube-player" type="text/html" width="640" height="385" src="'.$urlPlay.'" allowfullscreen frameborder="0" ></iframe>';

```