Well my site is a music lyrics site, and included an option to embed youtube videos with each lyric added. It came with one lyrics, which you can see here.

On the left of this page, the youtube video fits in a box.
http://music-and-lyrics.info/index.php?lyric_id=1

Now I added a new lyric and the video doesnt fit in the box
http://music-and-lyrics.info/index.php?lyric_id=494374

The strange thing is, that the embed code shows the same height and width attributes, so it has nothing to do with that.

This is the youtube.php file

<?php
/************************************************************************************

	Script Name	: Youtube Downloader 0.1
	Function	: To show path into FLV files located at Youtube.com
	Creator	: Yeni Setiawan (yeni.setiawan@yahoo.com, http://sandalian.com)
	Created date	: April 5, 2007
	Requirement	: PHP with CURL

	Note:
	This is a basic functions used to show real URI of FLV files at youtube.com so we can
	download the file and play it offline. 

	Disclaimer:
	You use it at your own risk. You can ask me question about this script but you shouldn't  
	ask me about any damaged computer caused by this script.

	To do:
	- Build AJAX interface.
	- Put it in my homepage as public service

************************************************************************************/


// ------------------------------------ START SCRIPT --------------------------//
function get_content_of_url($url){
	$ohyeah = curl_init();
	curl_setopt($ohyeah, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ohyeah, CURLOPT_URL, $url);
	$data = curl_exec($ohyeah);
	curl_close($ohyeah);
	return $data;
}

/*
OLD FUNCTION, NO LONGER WORKING
function get_flv_link($string) {
        if (preg_match('/\/player2\.swf\?(.*)", "movie_player"/', $string, $match)) {
            $url = $match[1];
            return 'http://youtube.com/get_video.php?'.$url;
        }
}
*/

function get_flv_link($string) {  
	if (eregi("watch_fullscreen\?(.*)title=\" +", $string, $out)) {  
		$outdata = $out[1];
	}  
	return 'http://youtube.com/get_video.php?'.$outdata;  
} 

function get_http_header($url){
	$uh = curl_init();
	curl_setopt($uh, CURLOPT_URL, $url);
	curl_setopt($uh, CURLOPT_HEADER, 1);
	curl_setopt($uh, CURLOPT_RETURNTRANSFER, 1);
	$res = curl_exec($uh);
	curl_close($uh);
	return $res;
}

function show_url($http_header){
	$arai = explode("\n",$http_header);
	foreach($arai as $ini){
		if(eregi("location",$ini)) $url = $ini;
	}
	list($sampah,$hasil) = explode("Location:",$url);
	return str_replace("\n","",trim($hasil));
}

function download_youtube($url){
	$data = get_content_of_url($url);
	$next_url = get_flv_link($data);
	$data = get_http_header($next_url);
	return show_url($data);
}
// ------------------------------------ END SCRIPT --------------------------//

?>

I am not sure if there is something in the script that can fix it.

Here is an updated version to the script, I found but it has done nothing to the output

<?php
/************************************************************************************

	Script Name	: Youtube Downloader 0.2
	Function	: To show path into FLV files located at Youtube.com
	Creator	: Yeni Setiawan (yeni.setiawan@yahoo.com, http://sandalian.com)
	Created date	: April 5, 2007 (0.1)		- read HTML and parse the string
			  March 3, 2008 (0.3)		- shot the SWF and read the header
			  April 15, 2008 (0.4)		- shot the SWF and read the header and let the T string remain
			  
	Requirement	: PHP with CURL

	Note:
	This is a basic functions used to show real URI of FLV files at youtube.com so we can
	download the file and play it offline. 

	Disclaimer:
	You use it at your own risk. You can ask me question about this script but you shouldn't  
	ask me about any damaged computer caused by this script.

************************************************************************************/


// ------------------------------------ START SCRIPT --------------------------//
ini_set('user_agent','Opera/9.24 (Windows NT 5.1; U; id)');

function get_http_header($url){
	$uh = curl_init();
	curl_setopt($uh, CURLOPT_URL, $url);
	curl_setopt($uh, CURLOPT_HEADER, 1);
	curl_setopt($uh, CURLOPT_RETURNTRANSFER, 1);
	$res = curl_exec($uh);
	curl_close($uh);
	return $res;
}

function show_url($http_header){
	$arai = explode("\n",$http_header);
	foreach($arai as $ini){
		if(eregi("location",$ini)) $url = $ini;
	}
	list($sampah,$hasil) = explode("Location:",$url);
	return str_replace("\n","",trim($hasil));
}

function download_youtube($url){
	if(ereg('&',$url)){
		if (eregi("watch\?v=(.*)&", $url, $out)) {  
			$video_id = $out[1];
		}  
	}
	else{
		list($none,$video_id) = explode('watch?v=',$url);
	}
	$header = get_http_header('http://youtube.com/v/'.trim($video_id));
	$secret_link = show_url($header);
	list($none,$dl_url) = explode("/swf/l.swf?",$secret_link);
	$video_url = 'http://youtube.com/get_video?'.$dl_url;
	return $video_url;
}
// ------------------------------------ END SCRIPT --------------------------//
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.