Guest User

Untitled

a guest
Aug 24th, 2014
237
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /*
  4.  
  5. YOUTUBE QUERY MODULE
  6. created by kenny@Asgard-AOC
  7. Feandan / Kennyth | Guild: -Agoge-
  8.  
  9. http://www.agoge-aoc.de
  10.  
  11. */
  12.  
  13. $yt = new yt($bot);
  14.  
  15. class yt Extends BaseActiveModule
  16. {
  17. var $bot;
  18. var $yt;
  19. var $returnstr;
  20.  
  21.  
  22. function __construct (&$bot)
  23. {
  24. parent::__construct(&$bot, get_class($this));
  25.  
  26. $this -> register_command("all", "yt", "ANONYMOUS");
  27.  
  28. }
  29.  
  30. function command_handler($name, $msg, $source)
  31. {
  32. $this->error->reset();
  33. $args = $this->parse_com($msg, array('com','args'));
  34.  
  35. $retstr = "<font color='#104E8B'>YouTube-Suchergebnisse</font><br><br/><br><br/>";
  36.  
  37. $search = urlencode($args["args"]);
  38. $orderby = urlencode("relevance");
  39. $start = 1;
  40. $count = 10;
  41. $xml = simplexml_load_file('http://gdata.youtube.com/feeds/api/videos?q='.$search.'&orderby='.$orderby.'&start-index='.$start.'&max-results='.$count.'&v=2');
  42. foreach($xml->entry as $video){
  43. $res[] = $video;
  44. $vidurl = str_replace("&feature=youtube_gdata","",$video->link['href']);
  45. $retstr .= "<font color='#ff00ff'>".$video->title."</font><br>";
  46. $retstr .= "Author: ".$video->author->name."<br>";
  47. $retstr .= "Videolink: ".$vidurl."<br><br/><br><br/>";
  48. }
  49.  
  50. $retstr .= $count." results on this page.";
  51. return "[YouTube] Query issued. ".$this -> bot -> core("tools") -> make_blob("Show results", $retstr);
  52. }
  53.  
  54.  
  55. }
  56.  
  57. ?>
RAW Paste Data