├── .gitignore ├── LICENSE ├── README.md ├── composer.json └── src ├── DailyMotionPlugin.php ├── LogPlugin.php ├── PornhubPlugin.php ├── RedTubePlugin.php ├── TwitterPlugin.php ├── XHamsterPlugin.php ├── XVideosPlugin.php ├── XnxxPlugin.php ├── YoutubePlugin.php └── utils.php /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # php-proxy-plugin-bundle 2 | 3 | A collection of useful plugins to be used with [php-proxy](https://github.com/Athlon1600/php-proxy) or [php-proxy-app](https://github.com/Athlon1600/php-proxy-app). All those plugins were initially developed for [unblockvideos.com](https://unblockvideos.com/), but have now been made open source. 4 | 5 | 6 | ![unblockvideos.com](https://unblockvideos.com/unblock_videos.png) 7 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "athlon1600/php-proxy-plugin-bundle", 3 | "description": "A collection of useful plugins to be used with php-proxy", 4 | "type": "library", 5 | "license": "MIT", 6 | "autoload": { 7 | "psr-4": { 8 | "Proxy\\Plugin\\": "src/" 9 | }, 10 | "files": [ 11 | "src/utils.php" 12 | ] 13 | }, 14 | "require": { 15 | "athlon1600/php-proxy": "^5.0", 16 | "athlon1600/youtube-downloader": "^2.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/DailyMotionPlugin.php: -------------------------------------------------------------------------------- 1 | getContent(); 18 | 19 | // http://www.dailymotion.com/json/video/{$id}?fields=stream_h264_sd_url,stream_h264_hq_url,stream_h264_url,stream_h264_hd_url 20 | if(preg_match('/"url":"([^"]+mp4[^"]*)"/m', $content, $matches)){ 21 | 22 | $video = stripslashes($matches[1]); 23 | 24 | // generate our own player 25 | $player = vid_player($video, 1240, 478); 26 | 27 | $content = Html::replace_inner("#player", $player, $content); 28 | } 29 | 30 | // too many useless scripts on this site 31 | $content = Html::remove_scripts($content); 32 | 33 | $response->setContent($content); 34 | } 35 | 36 | } 37 | 38 | 39 | ?> -------------------------------------------------------------------------------- /src/LogPlugin.php: -------------------------------------------------------------------------------- 1 | $_SERVER['REMOTE_ADDR'], 24 | 'time' => time(), 25 | 'url' => $request->getUri(), 26 | 'status' => $response->getStatusCode(), 27 | 'type' => $response->headers->get('content-type', 'unknown'), 28 | 'size' => $response->headers->get('content-length', 'unknown') 29 | ); 30 | 31 | $message = implode("\t", $data)."\r\n"; 32 | 33 | @file_put_contents($log_file, $message, FILE_APPEND); 34 | } 35 | 36 | } 37 | 38 | ?> -------------------------------------------------------------------------------- /src/PornhubPlugin.php: -------------------------------------------------------------------------------- 1 | getContent(); 18 | 19 | if (preg_match('/"videoUrl":"([^"]+)/', $content, $matches)) { 20 | $url = $matches[1]; 21 | $url = str_replace('\\', '', $url); 22 | 23 | $player = vid_player($url, 987, 370); 24 | $content = Html::replace_inner('#player', $player, $content); 25 | } 26 | 27 | // too many ads 28 | $content = Html::remove_scripts($content); 29 | 30 | $response->setContent($content); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/RedTubePlugin.php: -------------------------------------------------------------------------------- 1 | '; 14 | } 15 | 16 | public function onCompleted(ProxyEvent $event){ 17 | 18 | $output = $event['response']->getContent(); 19 | 20 | // preload images 21 | $output = preg_replace_callback('/]+data-src="([^"]+)"[^>]*>/', array($this, 'data_src'), $output); 22 | 23 | // remove ads 24 | $output = preg_replace('/