Hulp bij download script

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Ken zey

ken zey

28/02/2012 00:00:56
Quote Anchor link
Wat heb ik hier fout gedaan ??
hij download niet....




Javascript:



<!--


function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}

var http = createRequestObject();

function sndReq(random_key) {
var youtube_url = document.getElementById('q').value;
if(youtube_url.length>8){

// disable both text and button field
document.getElementById("q").disabled = true;
document.getElementById("b").disabled = true;

// display loading things
loading();

// okay, send request to starfleet
http.open('get', 'robot.php?key='+random_key+'&url='+youtube_url);
http.onreadystatechange = handleResponse;
http.send(null);
}
else{
// yeah, at least please tell me what to download :P
alert('Please enter video URL you wish to download.');
}
}
function handleResponse() {
if(http.readyState == 4){
var response = http.responseText;

document.getElementById("result").innerHTML = response;

// undisabled all disabled items
document.getElementById("q").disabled = false;
document.getElementById("b").disabled = false;
document.getElementById("q").value = '';
return false;
//}
}
}

function loading(){
document.getElementById("result").innerHTML = "<p><img src='img/o.gif' alt='loading..' /></p>";
return false;
}


// this is a hack for IE T_T
var newdiv = document.createElement("div");
var container = document.getElementById("result");
container.appendChild(newdiv);

-->


















index:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title> Youtube Downloader</title>
<meta name="keywords" content="Video downloader, download youtube, video download, youtube video, youtube downloader, download youtube FLV, download youtube MP4, download youtube 3GP, php video downloader" />
<meta name="description" content="This video downloader is able to download video from youtube.com in 3 different format. For high quality choose MP4, medium choose FLV and for low quality (and play on your cellphone) please choose 3GP." />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/youtube.js"></script>
</head>
<body>
<div id="container">
<h1> Youtube Downloader</h1>
<!--
I must add time() function to trick the bad IE's cache.
-->
<form method="get" id="form" onsubmit="sndReq('
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo time();?>
');return false;">
<input type="text" name="q" id="q" size="40" /> <input type="submit" name="b" id="b" value="Download" />
</form>
<div id="result"><blockquote>Example: http://www.youtube.com/watch?v=Y_xhRQXobG0<;/blockquote></div>
</div>
<p id="power">powered by <a href="#/">Kenzey!!</a></p>
</body>
</html>


















Robot.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
require_once('lib/youtube.lib.php');
if(eregi('youtube.com|localhost',$_GET['url'])){
    if(!eregi('www.',$_GET['url'])){
        $_GET['url'] = str_replace('http://','http://www.',$_GET['url']);
    }

    list($video_id,$download_link) = get_youtube($_GET['url']);
    ?>

<p>
<img src="http://img.youtube.com/vi/
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo trim($video_id);?>
/1.jpg" alt="Preview 1" class="ythumb" />
<img src="http://img.youtube.com/vi/
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo trim($video_id);?>
/2.jpg" alt="Preview 2" class="ythumb" />
<img src="http://img.youtube.com/vi/
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo trim($video_id);?>
/3.jpg" alt="Preview 3" class="ythumb" />
</p>
<p>
<a href="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo trim($download_link);?>
" class="ydl" title="Download as FLV">Download FLV</a>
<a href="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo trim($download_link);?>
&fmt=18" class="ydl" title="Download as MP4">Download MP4</a>
<a href="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo trim($download_link);?>
&fmt=17" class="ydl" title="Download as 3GP">Download 3GP</a>
</p>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
<?php
}
else{
    die('<span style="color:red;">Sorry, the URL is not recognized..</span>');
}

?>















youtube.lib.php7






Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php



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;
}


function
get_flv_link($string) {  
    if (eregi("watch_fullscreen(.*)plid", $string, $out)) {  
        $outdata = $out[1];
    }
  
    $arrs = (explode('&',$outdata));
    foreach($arrs as $arr){
        list($i,$x) = explode("=",$arr);
        $$i = $x;
    }

    $link = 'http://www.youtube.com/get_video?video_id='.$video_id.'&t='.$t;
    return array($video_id,$link);
}

function
get_youtube($url){
    $stream = get_content_of_url($url);
    return get_flv_link($stream);
}



/*
 * <?php
 * require_once('youtube.lib.php');
 * echo get_youtube($youtube_url);
 * ?>
 *
 */
 
PHP hulp

PHP hulp

08/11/2024 12:35:00
 
- Ariën  -
Beheerder

- Ariën -

28/02/2012 00:29:25
Quote Anchor link
Beperk je code tot uitsluitend relevante code.
 
Reshad F

Reshad F

28/02/2012 00:34:26
Quote Anchor link
@aar pak gewoon je glazen bol?
 
- Ariën  -
Beheerder

- Ariën -

28/02/2012 00:40:03
Quote Anchor link
... is naar de glasblazer toe, voor garantie-nawerk :-(
 
Erwin H

Erwin H

28/02/2012 08:54:55
Quote Anchor link
Doe eens gek, klik eens op eregi hieronder!
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
if (eregi("watch_fullscreen(.*)plid", $string, $out))
?>
 
Ken zey

ken zey

28/02/2012 18:16:27
Quote Anchor link
Wat bedoel je ?
 
- SanThe -

- SanThe -

28/02/2012 18:18:10
 
- Ariën  -
Beheerder

- Ariën -

28/02/2012 18:22:45
Quote Anchor link
Quote:
This function (eregi) has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.


Gebruik dus: http://nl.php.net/manual/en/function.preg-match.php
Gewijzigd op 28/02/2012 18:23:46 door - Ariën -
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.