From ed80377385f9d1df0f0a31aad3102d1c2a17d755 Mon Sep 17 00:00:00 2001
From: root
Date: Thu, 27 Feb 2014 00:56:03 +0100
Subject: index
---
www/youtube.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
(limited to 'www/youtube.php')
diff --git a/www/youtube.php b/www/youtube.php
index 311b2c4..37654e5 100644
--- a/www/youtube.php
+++ b/www/youtube.php
@@ -1,6 +1,7 @@
Random Youtube Video
+
@@ -20,7 +21,6 @@ function searchterm(){
$db = new SQLite3("../database/dict.db");
$table_array = array("english", "german");
- $table_count = count("$table_array");
$table=$table_array[0]; // choose the language
@@ -50,7 +50,7 @@ function printVideoFeed($videoFeed)
$res_quant = count($videoFeed);
- $video = mt_rand(1, $res_quant);
+ $video = mt_rand(0, $res_quant-1);
$videoId = printVideoEntry($videoFeed[$video]);
@@ -69,26 +69,26 @@ function start($yt){
$searchstring = searchterm();
$location = $yt->newVideoQuery();
- $location->setOrderBy('viewCount');
+// $location->setOrderBy('viewCount');
$location->setSafeSearch('none');
$location->setVideoQuery($searchstring);
$videoID = getAndPrintVideoFeed($location, $yt);
- if(file_get_contents("https://gdata.youtube.com/feeds/api/videos/" . $videoID . "")){
-
+ if(fopen("https://gdata.youtube.com/feeds/api/videos/" . $videoID , "r")){
return $videoID;
} else {
start();
}
+
}
$videoID = start($yt);
?>
-A random youtube video!
>
-
+A random youtube video!
+
-Get another one!
+Get another one
--
cgit v1.2.3