diff options
Diffstat (limited to 'www/youtube.php')
| -rw-r--r-- | www/youtube.php | 70 |
1 files changed, 62 insertions, 8 deletions
diff --git a/www/youtube.php b/www/youtube.php index ee2cc02..13829fa 100644 --- a/www/youtube.php +++ b/www/youtube.php @@ -1,12 +1,65 @@ <?php -/* -*This generates a Youtube-ID and checks if available. This is the most stupid way I can think of. -*NO, THIS SHIT DOESN'T WORK!! You will get 404's everytime. -*/ +include("zend_init.php"); + +function getAndPrintVideoFeed($location = Zend_Gdata_YouTube::VIDEO_URI) +{ +$yt = new Zend_Gdata_YouTube(); +$yt->setMajorProtocolVersion(2); + +$videoFeed = $yt->getVideoFeed($location); + printVideoFeed($videoFeed); +} + +function printVideoFeed($videoFeed) +{ + $count = 1; + foreach ($videoFeed as $videoEntry) { + echo "Entry # " . $count . "\n"; + printVideoEntry($videoEntry); + echo "\n"; + $count++; + } +} + +function printVideoEntry($videoEntry) +{ + // the videoEntry object contains many helper functions + // that access the underlying mediaGroup object + echo 'Video: ' . $videoEntry->getVideoTitle() . "\n <br>"; +/* echo 'Video ID: ' . $videoEntry->getVideoId() . "\n"; + echo 'Updated: ' . $videoEntry->getUpdated() . "\n"; + echo 'Description: ' . $videoEntry->getVideoDescription() . "\n"; + echo 'Category: ' . $videoEntry->getVideoCategory() . "\n"; + echo 'Tags: ' . implode(", ", $videoEntry->getVideoTags()) . "\n"; + echo 'Watch page: ' . $videoEntry->getVideoWatchPageUrl() . "\n"; + echo 'Flash Player Url: ' . $videoEntry->getFlashPlayerUrl() . "\n"; + echo 'Duration: ' . $videoEntry->getVideoDuration() . "\n"; + echo 'View count: ' . $videoEntry->getVideoViewCount() . "\n"; + echo 'Rating: ' . $videoEntry->getVideoRatingInfo() . "\n"; + echo 'Geo Location: ' . $videoEntry->getVideoGeoLocation() . "\n"; + echo 'Recorded on: ' . $videoEntry->getVideoRecorded() . "\n"; + */ -$clientLibraryPath = "../zend/library"; -$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath); + // see the paragraph above this function for more information on the + // 'mediaGroup' object. in the following code, we use the mediaGroup + // object directly to retrieve its 'Mobile RSTP link' child +/* foreach ($videoEntry->mediaGroup->content as $content) { + if ($content->type === "video/3gpp") { + echo 'Mobile RTSP link: ' . $content->url . "\n"; + } + } + + echo "Thumbnails:\n"; + $videoThumbnails = $videoEntry->getVideoThumbnails(); + + foreach($videoThumbnails as $videoThumbnail) { + echo $videoThumbnail['time'] . ' - ' . $videoThumbnail['url']; + echo ' height=' . $videoThumbnail['height']; + echo ' width=' . $videoThumbnail['width'] . "\n"; + } +*/ +} function get_video(){ @@ -24,12 +77,13 @@ function get_video(){ $string = "$string".$youtube_array[$index]; } return $string; - } } +getAndPrintVideoFeed(); + $searchstring = get_video(); -echo $searchstring; +echo "<br>Searchstring: " . $searchstring; // <iframe width="560" height="315" src="//www.youtube.com/embed/" frameborder="0" allowfullscreen></iframe> |
