Pulling videos from Ziggeo’s servers

Pulling videos from our servers is simple. The following PHP script is an example on how to do it: [code language="php"]require_once(dirname(__FILE__) . "/Ziggeo/Ziggeo.php"); $opts = getopt("", array("token:", "private:", "target:")); $ziggeo = new Ziggeo($opts["token"], $opts["private"]); $skip = 0; $limit = 100; $returned = -1; $videos = array(); while ($returned != 0) { $ret = $ziggeo->videos()->index(array( "skip" => $skip, "limit" => $limit )); $videos = array_merge($videos, $ret); $returned = count($ret); $skip += count($ret); } foreach ($videos as $video) { $file_name = $opts["target"] . "/" . $video->token . ".jpg"; echo $file_name . "\n"; $file_data = $ziggeo->videos()->download_image($video->token); file_put_contents($file_name, $file_data); }[/code] You could call it as follows: [code language="shell"]php pull_videos.php --token APPLICATION_TOKEN --private PRIVATE_KEY --target ~/SAVE_VIDEOS_HERE[/code]
PREV NEXT