diff options
| -rwxr-xr-x | www/favicon.ico | bin | 0 -> 5242 bytes | |||
| -rw-r--r-- | www/index.php | 5 | ||||
| -rw-r--r-- | www/youtube.php | 16 |
3 files changed, 13 insertions, 8 deletions
diff --git a/www/favicon.ico b/www/favicon.ico Binary files differnew file mode 100755 index 0000000..41f6475 --- /dev/null +++ b/www/favicon.ico diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..b43b2dc --- /dev/null +++ b/www/index.php @@ -0,0 +1,5 @@ +<!Doctype html> +<head> +<meta http-equiv="refresh" content="0; /youtube"> +</head> + 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 @@ <!Doctype html> <head> <title>Random Youtube Video</title> +<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'> </head> <body> <center> @@ -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! <br>> -<iframe width="560" height="315" src="//www.youtube.com/embed/<? echo $videoID ?>" frameborder="0" allowfullscreen></iframe> <br><br> +<h1>A random youtube video!</h1> <br> +<iframe width="560" height="315" src="https://www.youtube.com/embed/<? echo $videoID ?>" frameborder="0" allowfullscreen></iframe> <br><br> -<a href="youtube.php">Get another one!</a> +<a href="youtube">Get another one</a> </center> |
