Exemplo n.º 1
0
 public function onCompleted(ProxyEvent $event)
 {
     $response = $event['response'];
     if (preg_match('@flv_url=([^&]+)@', $response->getContent(), $matches)) {
         $flv_url = rawurldecode($matches[1]);
         $output = preg_replace('@<div id="player.*?<\\/div>@s', '<div id="player">' . vid_player($flv_url, 588, 476) . '</div>', $response->getContent(), 1);
         $response->setContent($output);
     }
 }
Exemplo n.º 2
0
 public function onCompleted(ProxyEvent $event)
 {
     $output = $event['response']->getContent();
     if (preg_match('@video_url=([^&]+)@', $output, $matches)) {
         $vid_url = rawurldecode($matches[1]);
         $player = vid_player($vid_url, 650, 365);
         $output = preg_replace('@<div id="redtube_flv_player"(.*?)>.*?<noscript>.*?<\\/noscript>.*?<\\/div>@s', '<div id="redtube_flv_player"$1>' . $player . '</div>', $output);
         $event['response']->setContent($output);
     }
 }
Exemplo n.º 3
0
 public function onCompleted(ProxyEvent $event)
 {
     $response = $event['response'];
     $content = $response->getContent();
     $vid = $this->find_video($content);
     // we must be on a video page?
     if ($vid) {
         $content = preg_replace("@<div id='playerSwf'>.*?loader.*?<\\/div>.*?<\\/div>.*?<\\/div>@s", "<div id='playerSwf'>" . vid_player($vid, 638, 505) . "</div>", $content);
         $response->setContent($content);
     }
 }
Exemplo n.º 4
0
 public function onCompleted(ProxyEvent $event)
 {
     $response = $event['response'];
     $html = $response->getContent();
     if (preg_match('@flv_url=([^&]+)@', $html, $matches)) {
         $flv_url = rawurldecode($matches[1]);
         $player = vid_player($flv_url, 938, 476);
         // insert our own video player
         $html = Html::replace_inner("#video-player-bg", $player, $html);
         $response->setContent($html);
     }
 }
Exemplo n.º 5
0
 public function onCompleted(ProxyEvent $event)
 {
     $response = $event['response'];
     $content = $response->getContent();
     // remove ts_popunder stuff
     $content = preg_replace('/<script[^>]*no-popunder[^>]*><\\/script>/m', '', $content);
     $content = preg_replace_callback('/<img[^>]*sprite=\'(.*?)\'/im', array($this, 'img_sprite'), $content);
     // are we on a video page?
     $file = $this->find_video($content);
     if ($file) {
         $player = vid_player($file, 638, 504);
         $content = Html::replace_inner("#playerSwf", $player, $content);
     }
     $response->setContent($content);
 }
Exemplo n.º 6
0
 public function onCompleted(ProxyEvent $event)
 {
     $response = $event['response'];
     $output = $response->getContent();
     if (preg_match('/video\\/([^_]+)/', $event['request']->getUri(), $matches)) {
         $id = $matches[1];
         // this better be available
         $str = file_get_contents("http://www.dailymotion.com/json/video/{$id}?fields=stream_h264_sd_url,stream_h264_hq_url,stream_h264_url,stream_h264_hd_url");
         $json = json_decode($str, true);
         if ($json) {
             $url = $json['stream_h264_sd_url'];
             $output = preg_replace('#\\<div\\sclass\\=\\"dmpi_video_playerv4(.*?)>.*?\\<\\/div\\>#s', '<div class="dmpi_video_playerv4${1}>' . vid_player($url, 620, 348) . '</div>', $output, 1);
             $response->setContent($output);
         }
     }
 }
Exemplo n.º 7
0
 public function onCompleted(ProxyEvent $event)
 {
     $output = $event['response']->getContent();
     // preload images
     $output = preg_replace_callback('/<img[^>]+data-src="([^"]+)"[^>]*>/', array($this, 'data_src'), $output);
     // remove ads
     $output = preg_replace('/<script data-cfasync.*?<\\/script>/sm', '', $output);
     // extract all videos
     preg_match_all('/"([0-9]+)":"([^"]*mp4[^"]*)"/im', $output, $matches, PREG_SET_ORDER);
     // by default, HD videos go first - we don't want that
     $matches = array_reverse($matches);
     if ($matches) {
         $video = rawurldecode(stripslashes($matches[0][2]));
         // generate player
         $player = vid_player($video, 973, 547, 'mp4');
         // replace it with our own player
         $output = Html::replace_inner("#redtube_flv_player", $player, $output);
     }
     $event['response']->setContent($output);
 }
Exemplo n.º 8
0
 public function onCompleted(ProxyEvent $event)
 {
     $response = $event['response'];
     $output = $response->getContent();
     // do this on all youtube pages
     $output = preg_replace('@masthead-positioner">@', 'masthead-positioner" style="position:static;">', $output, 1);
     // replace future thumbnails with src=
     $output = preg_replace('#<img[^>]*data-thumb=#s', '<img alt="Thumbnail" src=', $output);
     $links = $this->get_youtube_links($output);
     // we must be on a video page
     if ($links) {
         // the only ones supported by flowplayer
         $flv_itags = array(5, 34, 35);
         // supported by html5 player
         $mp4_itags = array(18, 22, 37, 38, 82, 84);
         // not supported by any player at the moment
         $webm_itags = array(43, 44, 46, 100, 102);
         // find first available mp4 video
         $mp4_url = $this->find_first_available($links, $mp4_itags);
         //$mp4_itags);
         $player = vid_player($mp4_url, 640, 390, 'mp4');
         // this div blocks our player controls
         $output = str_replace('<div id="theater-background" class="player-height"></div>', '', $output);
         // replace youtube player div block with our own
         $output = preg_replace('#<div id="player-api"([^>]*)>.*?<div id="watch-queue-mole"#s', '<div id="player-api"$1>' . $player . '</div><div id="watch-queue-mole"', $output, 1);
     }
     $response->setContent($output);
 }
Exemplo n.º 9
0
 public function onCompleted(ProxyEvent $event)
 {
     $this->youtube_url = $event['request']->getUrl();
     $response = $event['response'];
     $output = $response->getContent();
     // remove top banner that's full of ads
     $output = Html::remove("#header", $output);
     // do this on all youtube pages
     $output = preg_replace('@masthead-positioner">@', 'masthead-positioner" style="position:static;">', $output, 1);
     // replace future thumbnails with src=
     $output = preg_replace('#<img[^>]*data-thumb=#s', '<img alt="Thumbnail" src=', $output);
     $links = $this->get_youtube_links($output);
     // we must be on a video page
     if ($links) {
         // the only ones supported by flowplayer
         $flv_itags = array(5, 34, 35);
         // supported by html5 player
         $mp4_itags = array(18, 22, 37, 38, 82, 84);
         // not supported by any player at the moment
         $webm_itags = array(43, 44, 46, 100, 102);
         // find first available mp4 video
         $mp4_url = $this->find_first_available($links, $mp4_itags);
         //$mp4_itags);
         $player = vid_player($mp4_url, 640, 390, 'mp4');
         // this div blocks our player controls
         $output = Html::remove("#theater-background", $output);
         // replace youtube player div block with our own
         $output = Html::replace_inner("#player-api", $player, $output);
     }
     // causes too many problems...
     $output = Html::remove_scripts($output);
     $response->setContent($output);
 }