summaryrefslogtreecommitdiff
path: root/check.php
diff options
context:
space:
mode:
authorroot2014-09-13 22:26:58 +0200
committerroot2014-09-13 22:26:58 +0200
commitc5639ee890215e4e8e0f544821ea8d285ca58eb8 (patch)
tree29f685943c61c4d7ec0e376e485686e985b97065 /check.php
parentf8c60cae423fc78ed21d17a9217716ccc1e6dab1 (diff)
downloadvideo-dl-c5639ee890215e4e8e0f544821ea8d285ca58eb8.tar.gz
init
Diffstat (limited to 'check.php')
-rw-r--r--check.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/check.php b/check.php
new file mode 100644
index 0000000..26da1f3
--- /dev/null
+++ b/check.php
@@ -0,0 +1,14 @@
+<?php
+
+/* Hack to prevent function calls with a youtube list. */
+
+if(preg_match("/^(\s|^)(http[s]?:\/\/)?(wwww\.)?(youtu\.be)|(youtube.com)/i", $video)){
+ $video = urldecode($video);
+ preg_match("/watch\?v=[a-zA-Z0-9-_]{11}/i", $video, $match);
+ preg_match("/[a-zA-Z0-9-_]{11}/", $match[0], $id);
+ $video = "https://www.youtube.com/watch?v=".$id[0];
+}
+
+if(!preg_match("/^http/i", $video)){
+ $video = "https://www.youtube.com/watch?v=".$video;
+}