Skip to content

Commit feb4467

Browse files
committed
added xnxx plugin
1 parent 1dfe62f commit feb4467

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Diff for: src/XnxxPlugin.php

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Proxy\Plugin;
4+
5+
use Proxy\Plugin\AbstractPlugin;
6+
use Proxy\Event\ProxyEvent;
7+
8+
use Proxy\Html;
9+
10+
class XnxxPlugin extends AbstractPlugin {
11+
12+
protected $url_pattern = 'xnxx.com';
13+
14+
public function onCompleted(ProxyEvent $event){
15+
$response = $event['response'];
16+
17+
$content = $response->getContent();
18+
19+
$content = preg_replace_callback('/<img[^>]+src="([^"]+)"[^>]+data-src="([^"]+)/i', function($matches){
20+
return str_replace($matches[1], $matches[2], $matches[0]);
21+
}, $content);
22+
23+
if(preg_match('/VideoUrlHigh\(\'([^\']+)/', $content, $matches)){
24+
$url = $matches[1];
25+
26+
$player = vid_player($url, 938, 476);
27+
28+
$content = Html::replace_inner('#video-player-bg', $player, $content);
29+
}
30+
31+
// too many ads
32+
$content = Html::remove_scripts($content);
33+
$response->setContent($content);
34+
}
35+
36+
}

0 commit comments

Comments
 (0)