Skip to content

Commit 2811aeb

Browse files
committed
Update PornhubPlugin.php
1 parent c6d69b7 commit 2811aeb

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

src/PornhubPlugin.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22

33
namespace Proxy\Plugin;
44

5-
use Proxy\Plugin\AbstractPlugin;
65
use Proxy\Event\ProxyEvent;
7-
86
use Proxy\Html;
7+
use Proxy\Plugin\AbstractPlugin;
8+
9+
class PornhubPlugin extends AbstractPlugin
10+
{
11+
protected $url_pattern = 'pornhub.com';
12+
13+
public function onCompleted(ProxyEvent $event)
14+
{
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, 987, 370);
24+
$content = Html::replace_inner('#player', $player, $content);
25+
}
26+
27+
// too many ads
28+
$content = Html::remove_scripts($content);
929

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-
}
30+
$response->setContent($content);
31+
}
3232
}
3333

0 commit comments

Comments
 (0)