Example #1
0
 public static function parse_list($response)
 {
     $result = array();
     try {
         $atom = Atom::parse($response, new YouTubeDataMedia());
     } catch (Exception $e) {
         throw new Exception($response);
     }
     foreach ($atom->arEntry() as $entry) {
         $obj = new self();
         $links = $entry->link();
         if (isset($links[0])) {
             $obj->url($links[0]->href());
         }
         if (isset($links[3])) {
             $obj->mobile_url($links[3]->href());
         }
         if ($entry->content() instanceof AtomContent) {
             $obj->content($entry->content()->value());
         }
         $obj->title($entry->title());
         $obj->published($entry->published());
         $obj->updated($entry->updated());
         $obj->keyword($entry->extra()->keyword());
         $obj->duration($entry->extra()->duration());
         $obj->player($entry->extra()->player());
         $obj->category($entry->extra()->category());
         $obj->thumbnail($entry->extra()->thumbnail());
         $result[] = $obj;
     }
     return $result;
 }
Example #2
0
 public static function parse_list($response)
 {
     $result = array();
     $res = Text::parse_json($response);
     if (!isset($res["responseData"]["results"])) {
         throw new Exception("Invalid data");
     }
     foreach ($res["responseData"]["results"] as $re) {
         $obj = new self();
         $obj->url($re["blogUrl"]);
         $obj->title($re["titleNoFormatting"]);
         $obj->content($re["content"]);
         $obj->author($re["author"]);
         $obj->published($re["publishedDate"]);
         $result[] = $obj;
     }
     return $result;
 }
Example #3
0
 public static function parse(&$src)
 {
     $args = func_get_args();
     array_shift($args);
     $result = array();
     foreach (Tag::anyhow($src)->in("entry") as $in) {
         $o = new self();
         foreach ($args as $module) {
             $o->add_modules($module);
         }
         $o->id($in->f("id.value()"));
         $o->title($in->f("title.value()"));
         $o->published($in->f("published.value()"));
         $o->updated($in->f("updated.value()"));
         $o->issued($in->f("issued.value()"));
         $value = $in->value();
         $o->content = AtomContent::parse($value);
         $o->summary = AtomSummary::parse($value);
         $o->link = AtomLink::parse($value);
         $o->author = AtomAuthor::parse($value);
         $o->parse_extra($value);
         $result[] = $o;
         $src = str_replace($in->plain(), "", $src);
     }
     return $result;
 }
Example #4
0
 public static function parse(&$src)
 {
     $args = func_get_args();
     array_shift($args);
     $result = array();
     \org\rhaco\Xml::set($x, '<:>' . $src . '</:>');
     foreach ($x->in('entry') as $in) {
         $o = new self();
         $o->id($in->f('id.value()'));
         $o->title($in->f('title.value()'));
         $o->published($in->f('published.value()'));
         $o->updated($in->f('updated.value()'));
         $o->issued($in->f('issued.value()'));
         $value = $in->value();
         $o->content = Content::parse($value);
         $o->summary = Summary::parse($value);
         $o->link = Link::parse($value);
         $o->author = Author::parse($value);
         $result[] = $o;
         $src = str_replace($in->plain(), '', $src);
     }
     return $result;
 }