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; }
public static function parse(&$src) { $result = array(); \org\rhaco\Xml::set($x, '<:>' . $src . '</:>'); foreach ($x->in('author') as $in) { $src = str_replace($in->plain(), '', $src); $o = new self(); $o->name($in->f('name.value()')); $o->url($in->f('url.value()')); $o->email($in->f('email.value()')); if (!$o->is_url()) { $o->url($in->f('uri.value()')); } $result[] = $o; } return $result; }
public static function parse(&$src) { $result = array(); foreach (Tag::anyhow($src)->in("source") as $in) { $src = str_replace($in->plain(), "", $src); $o = new self(); $o->url($in->inParam("url")); $o->value($in->value()); $result[] = $o; } return $result; }
public static function parse(&$src) { $result = array(); foreach (Tag::anyhow($src)->in("enclosure") as $in) { $src = str_replace($in->plain(), "", $src); $o = new self(); $o->url($in->inParam("url")); $o->type($in->inParam("type")); $o->length($in->inParam("length")); $result[] = $o; } return $result; }
public static function parse(&$src) { $result = array(); foreach (Tag::anyhow($src)->in("author") as $in) { $src = str_replace($in->plain(), "", $src); $o = new self(); $o->name($in->f("name.value()")); $o->url($in->f("url.value()")); $o->email($in->f("email.value()")); $result[] = $o; } return $result; }
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->cache_url($re["cacheUrl"]); $obj->url($re["unescapedUrl"]); $obj->title($re["titleNoFormatting"]); $obj->content($re["content"]); $result[] = $obj; } return $result; }
public static function parse_list($response, $paginator) { $result = array(); $res = Text::parse_json($response); if (isset($res["error"])) { throw new Exception($res["error"]); } if (!empty($res["pager"])) { $paginator = new Paginator($res["pager"]["clips_in_page"], $res["pager"]["current_page"], $res["pager"]["total_entries"]); } if (!empty($res["entries"])) { foreach ($res["entries"] as $re) { $obj = new self(); $obj->id($re["id"]); $obj->title($re["title"]); $obj->url($re["permalink"]); $obj->author(new FlipClipAuthor($re["author"]["id"], $re["author"]["name"], $re["author"]["uri"])); $obj->summary($re["summary"]); $obj->updated($re["updated"]); if (isset($re["category"])) { $obj->category(new FlipClipCategory($re["category"]["term"], $re["category"]["scheme"], $re["category"]["label"])); } if (isset($re["subcategory"])) { $obj->category(new FlipClipCategory($re["subcategory"]["term"], $re["subcategory"]["scheme"], $re["subcategory"]["label"])); } if (isset($re["tags"])) { foreach ($re["tags"] as $tag) { $obj->tags(new FlipClipTag($tag["term"], $tag["scheme"], $tag["label"])); } } $obj->embed_script($re["embed_script"]); $obj->latitude($re["latitude"]); $obj->longitude($re["longitude"]); $obj->privacy($re["privacy"]); $obj->duration($re["duration"]); $obj->image($re["image"]); $obj->image_medium($re["imageMedium"]); $obj->image_small($re["imageSmall"]); $obj->thumbnail($re["thumbnail"]); $result[] = $obj; } } return $result; }
public function parse_list($response) { if ($response === "N;") { throw new Exception("Invalid data"); } $result = array(); foreach (unserialize($response) as $re) { $obj = new self(); $obj->language($re["language"]); $obj->id($re["id"]); $obj->url($re["url"]); $obj->title($re["title"]); $obj->body($re["body"]); $obj->length($re["length"]); $obj->redirect($re["redirect"]); $obj->strict($re["strict"]); $obj->datetime($re["datetime"]); $result[] = $obj; } return $result; }