Skip to content

Commit 1dfe62f

Browse files
committed
added pornhub plugin
1 parent 402b9e4 commit 1dfe62f

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/PornhubPlugin.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 PornhubPlugin extends AbstractPlugin {
11+
12+
protected $url_pattern = 'pornhub.com';
13+
14+
public function onCompleted(ProxyEvent $event){
15+
$response = $event['response'];
16+
17+
$content = $response->getContent();
18+
19+
if(preg_match('/"videoUrl":"([^"]+)/', $content, $matches)){
20+
$url = $matches[1];
21+
$url = str_replace('\\', '', $url);
22+
23+
$player = vid_player($url, 989, 557);
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+

0 commit comments

Comments
 (0)