From 4ea82b5224bc0192d8a1182b48c52561b261f11c Mon Sep 17 00:00:00 2001 From: Michael Reber Date: Thu, 14 Nov 2019 19:57:34 +0100 Subject: [PATCH] Add php-proxy-plugin-bundle to project --- vendor/athlon1600/php-proxy-plugin-bundle | 1 - .../php-proxy-plugin-bundle/LICENSE | 21 +++++++ .../php-proxy-plugin-bundle/README.md | 4 ++ .../php-proxy-plugin-bundle/composer.json | 17 ++++++ .../src/DailyMotionPlugin.php | 39 ++++++++++++ .../php-proxy-plugin-bundle/src/LogPlugin.php | 38 ++++++++++++ .../src/TwitterPlugin.php | 27 +++++++++ .../src/YoutubePlugin.php | 59 +++++++++++++++++++ .../php-proxy-plugin-bundle/src/utils.php | 45 ++++++++++++++ 9 files changed, 250 insertions(+), 1 deletion(-) delete mode 160000 vendor/athlon1600/php-proxy-plugin-bundle create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/LICENSE create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/README.md create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/composer.json create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/src/DailyMotionPlugin.php create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/src/LogPlugin.php create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/src/TwitterPlugin.php create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/src/YoutubePlugin.php create mode 100644 vendor/athlon1600/php-proxy-plugin-bundle/src/utils.php diff --git a/vendor/athlon1600/php-proxy-plugin-bundle b/vendor/athlon1600/php-proxy-plugin-bundle deleted file mode 160000 index 172202c..0000000 --- a/vendor/athlon1600/php-proxy-plugin-bundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 172202c9b7913dc397b0a2eeacb68984a73f5c6e diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/LICENSE b/vendor/athlon1600/php-proxy-plugin-bundle/LICENSE new file mode 100644 index 0000000..a8fc851 --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/README.md b/vendor/athlon1600/php-proxy-plugin-bundle/README.md new file mode 100644 index 0000000..0fbd28e --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/README.md @@ -0,0 +1,4 @@ +# php-proxy-plugin-bundle + +A collection of useful plugins to be used with php-proxy or php-proxy-app. A lot of those are used on unblockvideos.com + diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/composer.json b/vendor/athlon1600/php-proxy-plugin-bundle/composer.json new file mode 100644 index 0000000..2c89388 --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/composer.json @@ -0,0 +1,17 @@ +{ + "name": "athlon1600/php-proxy-plugin-bundle", + "description": "A collection of useful plugins to be used with php-proxy", + "type": "library", + "license": "MIT", + "autoload": { + "psr-4": { + "Proxy\\Plugin\\": "src/" + }, + "files": [ + "src/utils.php" + ] + }, + "require": { + "athlon1600/youtube-downloader": "^1.0" + } +} diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/src/DailyMotionPlugin.php b/vendor/athlon1600/php-proxy-plugin-bundle/src/DailyMotionPlugin.php new file mode 100644 index 0000000..7f2e5cb --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/src/DailyMotionPlugin.php @@ -0,0 +1,39 @@ +getContent(); + + // http://www.dailymotion.com/json/video/{$id}?fields=stream_h264_sd_url,stream_h264_hq_url,stream_h264_url,stream_h264_hd_url + if(preg_match('/"url":"([^"]+mp4[^"]*)"/m', $content, $matches)){ + + $video = stripslashes($matches[1]); + + // generate our own player + $player = vid_player($video, 1240, 478); + + $content = Html::replace_inner("#player", $player, $content); + } + + // too many useless scripts on this site + $content = Html::remove_scripts($content); + + $response->setContent($content); + } + +} + + +?> \ No newline at end of file diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/src/LogPlugin.php b/vendor/athlon1600/php-proxy-plugin-bundle/src/LogPlugin.php new file mode 100644 index 0000000..e98249a --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/src/LogPlugin.php @@ -0,0 +1,38 @@ + $_SERVER['REMOTE_ADDR'], + 'time' => time(), + 'url' => $request->getUri(), + 'status' => $response->getStatusCode(), + 'type' => $response->headers->get('content-type', 'unknown'), + 'size' => $response->headers->get('content-length', 'unknown') + ); + + $message = implode("\t", $data)."\r\n"; + + @file_put_contents($log_file, $message, FILE_APPEND); + } + +} + +?> \ No newline at end of file diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/src/TwitterPlugin.php b/vendor/athlon1600/php-proxy-plugin-bundle/src/TwitterPlugin.php new file mode 100644 index 0000000..6eb988a --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/src/TwitterPlugin.php @@ -0,0 +1,27 @@ +getContent(); + + // remove all javascript + $content = Html::remove_scripts($content); + + $response->setContent($content); + } +} + +?> \ No newline at end of file diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/src/YoutubePlugin.php b/vendor/athlon1600/php-proxy-plugin-bundle/src/YoutubePlugin.php new file mode 100644 index 0000000..0f3edae --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/src/YoutubePlugin.php @@ -0,0 +1,59 @@ +headers->set('Cookie', 'PREF=f6=8'); + $event['request']->headers->set('User-Agent', 'Opera/7.50 (Windows XP; U)'); + } + + public function onCompleted(ProxyEvent $event){ + + $response = $event['response']; + $url = $event['request']->getUrl(); + $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('#]*data-thumb=#s','ThumbnailsetContent($output); + } +} + +?> \ No newline at end of file diff --git a/vendor/athlon1600/php-proxy-plugin-bundle/src/utils.php b/vendor/athlon1600/php-proxy-plugin-bundle/src/utils.php new file mode 100644 index 0000000..1cae7c5 --- /dev/null +++ b/vendor/athlon1600/php-proxy-plugin-bundle/src/utils.php @@ -0,0 +1,45 @@ + + + Your browser does not support the video tag. + '; + + } else { + + // encode before embedding it into player's parameters + $video_url = rawurlencode($video_url); + + $html = ' + + + + + + '; + } + + return $html; +} + +?> \ No newline at end of file