Skip to content

Commit c6d69b7

Browse files
committed
fixed xhamster
1 parent 575232e commit c6d69b7

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/XHamsterPlugin.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ class XHamsterPlugin extends AbstractPlugin {
1111
protected $url_pattern = 'xhamster.com';
1212

1313
public function onBeforeRequest(ProxyEvent $event){
14-
// mobile
15-
$event['request']->headers->set('user-agent', 'Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30');
14+
// we do not want to force mobile this time
15+
$event['request']->headers->set('user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0');
1616
}
1717

1818
private function find_video($html){
1919
$file = false;
2020

21-
if(preg_match('/"play":"([^"]+)"/', $html, $matches)){
22-
$file = rawurldecode($matches[1]);
23-
$file = str_replace('\\', '', $file);
21+
if(preg_match('/mp4File":"([^"]+)/', $html, $matches)){
22+
$file = $matches[1];
23+
return stripslashes($file);
2424
}
2525

2626
return $file;
@@ -36,10 +36,11 @@ public function onCompleted(ProxyEvent $event){
3636
// is this video page?
3737
$file = $this->find_video($content);
3838
if($file){
39-
$player = vid_player($file, 638, 504);
39+
$player = vid_player($file, 950, 650);
4040
$player = str_replace('<video', '<video style="display:block;', $player);
4141

42-
$content = HTML::replace_inner('#video_box', $player, $content);
42+
//$content = HTML::replace_inner('#video_box', $player, $content);
43+
$content = HTML::replace_inner('#player-container', $player, $content);
4344

4445
// remove "show comments" button
4546
$content = HTML::remove('#commentToggle', $content);

0 commit comments

Comments
 (0)