Dies ist eine Php-Klasse mit der man Videos von verschiedenen Portalen laden kann. Momentan möglich ist Youtube.com , Myvideo.de und Youporn.com .
Hier ist der Code:
[php]
<?php
/*\
# Scripter: Ultimate
# Blog: tasteless.back2hack.cc
# E-Mail: [email protected]
# Scriptname: Ulti-Movieloader
# Version: 1
# Script use: Start it in the Console
#
# Special thanks to Gunner for helping to break the url’s of the pages ;)
\*/
class MovieLoader {
function __construct(){
$this->url = "";
$this->content = "";
$this->page = "";
//FOR ALL
$this->video_id = "";
// FOR YOUTUBE
$this->t = "";
$this->fmt = "";
//MyVideo
$this->video_server = "";
}
function setUrl($url=""){
$this->url = $url;
}
function setPage($page){
switch($page){
case "youtube": $this->page = "youtube"; return true;
case "myvideo": $this->page = "myvideo"; return true;
case "youporn": $this->page = "youporn"; return true;
default : echo "Not Found!"; return false;
}
}
function info(){
switch($this->page){
case "unknown": echo "Page not set!"; return false;
case "youtube":
$this->content = file_get_contents($this->url);
preg_match(‚|.*meta name=\"title\" content=\"([^\"]*)\".*|‘, $this->content, $found);
$this->info[’name‘] = $found[1];
preg_match(‚/.*\"length_seconds\". \"([^\"]*).*/‘, $this->content, $found);
$this->info[‚length‘] = $found[1];
echo $this->info[’name‘]." ". (int)($this->info[‚length‘]/60).":".($this->info[‚length‘]%60)." Download: Y/N? ";
$line = trim(fgets(STDIN));
if($line == "y" || $line == "Y"){
preg_match(‚|http://(?:www\.)?youtube\.com/watch\?v=([^&]*)|‘, $this->url, $treffer);
preg_match(‚|"t":\s"(.*?)"|‘, $this->content, $match);
$this->video_id = $treffer[1];
$this->t = $match[1];
$this->fmt = 18;
echo "Enter the Filename: ";
$line = trim(fgets(STDIN));
$this->download($line.".flv", ‚http://youtube.com/get_video?video_id=‘.$this->video_id.’&t=‘.$this->t.’&fmt=‘.$this->fmt);
}else{
echo "Download Stoped.";
}
return true;
case "myvideo":
$this->content = file_get_contents($this->url);
preg_match(‚|.*meta name=\"title\" content=\"([^\"]*)\".*|‘, $this->content, $found);
$this->info[’name‘] = str_replace(" – MyVideo","",$found[1]);
echo $this->info[’name‘]." Download: Y/N? ";
$line = trim(fgets(STDIN));
if($line == "y" || $line == "Y"){
preg_match("|addVariable\(‚_videoid‘,'(.*)’\);p.addParam\(‚quality’|", $this->content, $found);
$this->video_id = $found[1];
preg_match("|rel=’image_src‘ href='(.*?)thumbs/.*‘ />|", $this->content, $found);
$this->video_server = $found[1];
echo "Enter the Filename: ";
$line = trim(fgets(STDIN));
$this->download($line.".flv", $this->video_server.$this->video_id.‘.flv‘);
}else{
echo "Download Stoped.";
}
return true;
case "youporn":
$context = stream_context_create(array(‚http’=>array(‚method’=>"GET",’header’=>"Accept-language: en\r\n" ."Cookie: age_check=1\r\n")));
$this->content = file_get_contents($this->url,0,$context);
preg_match(‚|.*meta name=\"description\" content=\"([^\"]*)\".*|‘, $this->content, $found);
$split = explode(". Watch Free Porn. ",$found[1],2);
$this->info[’name‘] = $split[0];
$length = explode(" ",$split[1]);
$length = $split[0]*60+$split[2];
$this->info[‚length‘] = $length;
echo $this->info[’name‘]." ". (int)($this->info[‚length‘]/60).":".($this->info[‚length‘]%60)." Download: Y/N? ";
$line = trim(fgets(STDIN));
if($line == "y" || $line == "Y"){
preg_match(‚|http://download.youporn.com/download/\d*/.*\?download=1&ll=1&t=dd|‘, $this->content, $ypurl);
$ypurl = $ypurl[0];
echo "Enter the Filename: ";
$line = trim(fgets(STDIN));
$this->download($line.".flv", $ypurl);
}else{
echo "Download Stoped.";
}
return true;
}
}
function download($file, $where){
$read = @fopen($where, "r");
if(!$read) die("Couldn’t open ".$where);
$output = @fopen($file, "w");
if(!$output) die("Couldn’t open ".$file);
while(!feof($read)){
fwrite($output, fgets($read));
}
fclose($read);
fclose($output);
}
function intro(){
print("######################################################################\n");
print("# ULTI-MOVIELOADER #\n");
print("######################################################################\n");
print("# BY GUNNER & ULTIMATE #\n");
print("# GREETZ: Back2Hack <3 and all B2H Members :D #\n");
print("######################################################################\n");
}
function menu(){
print("MENU:\n");
print(" 1 – Youtube\n");
print(" 2 – MyVideo\n");
print(" 3 – YouPorn\n");
print(" 4 – EXIT\n");
print("\n");
print("CHOOSE:");
}
function choose($choose=NULL){
if($choose === NULL){
$choose = trim(fgets(STDIN));
}
switch(strtolower($choose)){
case "1":case "youtube": $this->setPage("youtube"); break;
case "2":case "myvideo": $this->setPage("myvideo"); break;
case "3":case "youporn": $this->setPage("youporn"); break;
case "4":case "exit": exit;
}
}
}
function cls(){
echo "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
$MovieLoader = new MovieLoader();
while(1){
cls();
$MovieLoader->intro();
$MovieLoader->menu();
$MovieLoader->choose();
print("URL: "); $MovieLoader->setUrl(trim(fgets(STDIN)));
$MovieLoader->info();
}
?>[/php]