Do not try to parse stderr data + check if we really have an URL
authorChristian Weiske <cweiske@cweiske.de>
Thu, 19 Oct 2017 19:04:28 +0000 (21:04 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 19 Oct 2017 19:04:28 +0000 (21:04 +0200)
www/play.php

index a9adc5b8a83953a35a69eb81e96410d7033101d6..ce221e01566964b75217c8e0973a0a2d5e3483eb 100644 (file)
@@ -45,7 +45,7 @@ function extractVideoUrl($pageUrl, $youtubedlPath)
         . ' --quiet'
         . ' --dump-json'
         . ' ' . escapeshellarg($pageUrl)
-        . ' 2>&1';
+        . ' 2> /dev/null';
 
     $lastLine = exec($cmd, $output, $exitCode);
     if ($exitCode !== 0) {
@@ -75,6 +75,13 @@ function extractVideoUrl($pageUrl, $youtubedlPath)
         //use URL chosen by youtube-dl
         $url = $data->url;
     }
+
+    if ($url == '') {
+        errorOut(
+            'No video URL found',
+            '406 No video URL found'
+        );
+    }
     return $url;
 }