PHP Version 5.3.10
Author: Pierre Rudloff (contact@rudloff.pro)
Example #1
0
 /**
  * Test getAudioStream function without curl or rtmpdump.
  *
  * @param string $url    URL
  * @param string $format Format
  *
  * @return void
  * @expectedException Exception
  * @dataProvider      urlProvider
  */
 public function testGetAudioStreamCurlError($url, $format)
 {
     $config = \Alltube\Config::getInstance();
     $config->curl = 'foobar';
     $config->rtmpdump = 'foobar';
     $this->download->getAudioStream($url, $format);
 }
Example #2
0
 /**
  * Output JSON info about the video.
  *
  * @param Request  $request  PSR-7 request
  * @param Response $response PSR-7 response
  *
  * @return Response HTTP response
  */
 public function json(Request $request, Response $response)
 {
     $params = $request->getQueryParams();
     if (isset($params['url'])) {
         try {
             $video = $this->download->getJSON($params['url']);
             return $response->withJson($video);
         } catch (\Exception $e) {
             return $response->withJson(['success' => false, 'error' => $e->getMessage()]);
         }
     }
 }
Example #3
0
 /**
  * Output JSON info about the video
  * @return void
  */
 static function json()
 {
     global $app;
     if (isset($_GET["url"])) {
         $app->response->headers->set('Content-Type', 'application/json');
         try {
             $video = VideoDownload::getJSON($_GET["url"]);
             echo json_encode($video);
         } catch (\Exception $e) {
             echo json_encode(array('success' => false, 'error' => $e->getMessage()));
         }
     }
 }
 /**
  * Test getJSON function errors
  *
  * @param string $url URL
  *
  * @return            void
  * @expectedException Exception
  * @dataProvider      ErrorURLProvider
  */
 public function testGetJSONError($url)
 {
     $videoURL = VideoDownload::getJSON($url);
 }