Youtube downloader is working!

Mobi.web.idFor more than a month my youtube downloader script was not working due to youtube changed their layout. Today I’ve rewritten the script and simplified the functionality. Now is running again and ready to help everyone download videos from Youtube.

Previous script consist of four functions and I’ve shortened into two functions. Please hit the read button to see the full working script.

Here’s the shorten code for youtube downloader:

< ?php
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);
	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 (eregi("watch?v=(.*)&", $url, $out)) {
			$video_id = $out[1];
		list($none,$video_id) = explode('watch?v=',$url);
	$secret_link = substr(show_url(get_http_header(''.trim($video_id))),11);
	$video_url = show_url(get_http_header(''.$secret_link));
	list($dl_url,$sign) = explode("&signature",$video_url);
	return $dl_url;
echo download_youtube('');

Have phun, may the source be with you! ^_^

20 comments on “Youtube downloader is working!

  1. For some reason I can’t get the code to work. Somthing is missing.

  2. Domain nya expired nih. Udah diperpanjang belum ?

  3. I intended to post you that very small remark to be able to say thanks a lot yet again on your fantastic tricks you have featured on this website. This is so incredibly generous of you to provide publicly all that most people could possibly have offered for sale for an electronic book in order to make some cash for themselves, precisely considering that you might well have tried it in the event you considered necessary. Those solutions also worked to be a easy way to realize that other individuals have the same desire like my very own to realize many more related to this matter. I am sure there are a lot more fun opportunities in the future for individuals who check out your site.

Leave a Reply