1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace wp_SexHackMe;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if(!class_exists('ChaturbateLive')) {
class ChaturbateLive
{
public static function parseSite($html)
{
$dom = new DOMDocument;
@$dom->loadHTML($html);
foreach ($dom->getElementsByTagName('script') as $node) {
preg_match( '/initialRoomDossier\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1/', $node->textContent, $res);
if(count($res) > 2)
{
$j = json_decode(str_replace("\u0022", '"', str_replace("\u005C", "\\", $res[2])));
if(property_exists($j, 'hls_source'))
{
return $j->{'hls_source'};
}
}
}
return FALSE;
}
public static function getStream($model)
{
$vurl = false; //$this->parse_chaturbate(sexhack_getURL('https://chaturbate.com/'.$model.'/'));
if(!$vurl) {
return '<p>Chaturbate '.$model."'s cam is OFFLINE</p>";
}
return '<a href="https://chaturbate.com/'.$model.'/" target="_black" >Chaturbate '.$model.':</a> '.sh_hls_player($vurl);
}
}
}
if(!class_exists('Cam4Live')) {
class Cam4Live
{
public static function parseSite($html)
{
$dom = new DOMDocument;
@$dom->loadHTML($html);
foreach ( $dom->getElementsByTagName('video') as $node) {
return $node->getAttribute('src');
}
return FALSE;
}
public static function getStream($model)
{
$vurl = false; //$this->parse_cam4(sexhack_getURL('https://www.cam4.com/'.$model));
if(!$vurl) {
return '<p>Cam4 '.$model."'s cam is OFFLINE</p>";
}
return '<a href="https://chaturbate.com/'.$model.'/" target="_blank" >Cam4 '.$model.":</a> ".sh_hls_player($vurl);
}
}
}
if(!class_exists('LiveCamSite')) {
class LiveCamSite
{
public static function getCamStream($site, $model)
{
if($site=='chaturbate') return ChaturbateLive::getStream($model);
else if($site=='cam4') return Cam4Live::getStream($model);
return false;
}
}
}
?>