public function onCompleted(ProxyEvent $event) { // there is some problem with content-length when submitting form... $response = $event['response']; $content = $response->getContent(); // remove all javascript $content = Html::remove_scripts($content); $response->setContent($content); }
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); } }
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); }
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); }
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); }