Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases > Coding Snippets
You last visited: Today at 04:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Mit 2 kleinen Parametern ein YT-Video analysieren

Discussion on Mit 2 kleinen Parametern ein YT-Video analysieren within the Coding Snippets forum part of the Coding Releases category.

Reply
 
Old   #1

 
Ravenstorm's Avatar
 
elite*gold: 0
The Black Market: 100/0/0
Join Date: Jan 2010
Posts: 13,150
Received Thanks: 3,207
[PHP] Mit 2 kleinen Parametern ein YT-Video analysieren

Um mit 2 kleinen Parametern ein YT-Video analysieren kann:
PHP Code:
 public function getVideoDetails($url,$getMethode){
    
//The Youtube"s API url
    
define("YT_API_URL""http://gdata.youtube.com/feeds/api/videos?q=");
     
    
//Change below the video id.
    
$video_id $url;
     
    
//Using cURL php extension to make the request to youtube API
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URLYT_API_URL $video_id);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
//$feed holds a rss feed xml returned by youtube API
    
$feed curl_exec($ch);
    
curl_close($ch);
     
    
//Using SimpleXML to parse youtube"s feed
    
$xml simplexml_load_string($feed);
     
    
$entry $xml->entry[0];
    
//If no entry whas found, then youtube didn"t find any video with specified id
    
if(!$entry) exit("Error: no video with id " $video_id " whas found. Please specify the id of a existing video.");
    
$media $entry->children("media"true);
    
$group $media->group;
     
    
$title $group->title;
    
$desc $group->description;
    
$vid_keywords $group->keywords;
    
$thumb $group->thumbnail[0];
    
//There are 4 thumbnails, the first one (index 0) is the largest.
    //$thumb_url: the url of the thumbnail. $thumb_width: thumbnail width in pixels.
    //$thumb_height: thumbnail height in pixels. $thumb_time: thumbnail time in the video
    
list($thumb_url$thumb_width$thumb_height$thumb_time) = $thumb->attributes();
    
$content_attributes $group->content->attributes();
    
//$vid_duration: the duration of the video in seconds. Ex.: 192.
    
$vid_duration $content_attributes["duration"];
    
//$duration_formatted: the duration of the video formatted in "mm:ss". Ex.:01:54
    
$duration_formatted str_pad(floor($vid_duration/60), 2'0'STR_PAD_LEFT) . ":" str_pad($vid_duration%602"0"STR_PAD_LEFT);
     
    if(
$getMethode == "title"){
        return 
$title;
    }elseif(
$getMethode == "desc"){
        return 
$desc;
    }elseif(
$getMethode == "keywords"){
        return 
$vid_keywords;
    }elseif(
$getMethode == "TUrl"){
        return 
$thumb_url;
    }elseif(
$getMethode == "TWidth"){
        return 
$thumb_width;
    }elseif(
$getMethode == "THeight"){
        return 
$thumb_height;
    }elseif(
$getMethode == "TTime"){
        return 
$thumb_time;
    }elseif(
$getMethode == "VDuration"){
        return 
$vid_duration;
    }elseif(
$getMethode == "VDurationFormatted"){
        return 
$duration_formatted;
    }else {
        return 
false;
    }


Ravenstorm is offline  
Reply


Similar Threads Similar Threads
eigene .exe mit parametern öffnen
08/16/2013 - AutoIt - 8 Replies
Hat jemand eine Möglichkeit wie ich meine autoit.exe so schreiben kann das diese beim start parameter akzeptiert und diese z.B. als variable abspeichert . ShellExecute(@ScriptDir & "\bla.exe","Parameter")
minecraft jar noch mit Parametern Starten?
11/21/2012 - Minecraft - 2 Replies
Hallo alle zusammen, fals ich hier nicht richtig bin sagt mir bitte bescheid! Also folgende Frage: kann mann die Aktuelle version von der Minecraft jar noch mit parametern Starten (Username Passwort, Server IP und no Update)? Ich weis das das mal möglich war und auch noch möglich ist mit dem Launcher, doch ich will diesen nach möglichkeit nicht nutzen, da ich meinen eingenden Launcher gerade Baue und es da blöd kommt wenn mann erst noch den originalen Launcher sieht wenn minecraft...
[SUCHE] Video Editor für einen kleinen Clip
08/07/2012 - Call of Duty - 0 Replies
Hey Com! Ich suche für ein Special einen Video Editor, der mir bei SonyVegas ein bisschen hilft um einen Clip von MW3 zu gestalten.. Aufwand würde ich auf einer Skala von 1-5 auf 2-3 schätzen.. Wäre cool wenn ihr euch mit einer Nachricht in epvp melden könntet! Liebe Grüße TubeYourGames
[S]Daisy mit v17 Parametern
04/22/2012 - Flyff Private Server - 2 Replies
Ich suche Daisy welches die v17 Parameter mit liest hat das jemand bzw. ist es released?
Packets analysieren bei sa:mp
08/09/2010 - General Coding - 7 Replies
also, ich hab mal ein wenig über das sniffen und analysieren gelesen und wollte das mal praktisch anweden bei sa:mp(dem multiplayer von gta:sa) soweit so gut, es werden leider sehr viele packete versand und deswegen war es, für mich zumindest, relativ schwer das richtige packet, nämlich eins das ein einfaches a im chat versendet ausfindig zu machen und das ergebnis war dann folgendes was auch stimmen müsste 31 14 E6 A4 39 19 28 C2 61 16 71 //a im chat #1 31 74 E6 24 39 19 28 C2 61 16 71...



All times are GMT +2. The time now is 04:00.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.