Exists: http://server1.com/player.php Inside server 1 there is a player with Clappr that looks like this:
<script type='text/javascript'>
var player = new Clappr.Player({
source: window.atob("bXlzdHJlYW0ubTN1OA=="),
plugins: [],
parentId: '#player',
width: '100%',
height: '100%',
//hlsMinimumDvrSize: 0,
chromecast: {
appId: '9DFB77C0',
media: {
type: ChromecastPlugin.None,
title: 'Tittle',
subtitle: 'Sub'
}}
//playback: {
// hlsjsConfig: {
// liveSyncDurationCount: 2
//}
//}
});
I used the following code in a file called test.php inside http://server2.com
- (Check the PHP Code at the end).
And I got:
var player = new Clappr.Player({ source: window.atob("bXlzdHJlYW0ubTN1OA=="), plugins: []
- How can I "decode" the route? ("bXlzdHJlYW0ubTN1OA==" to "mystream.m3u8")
- Once the path is decoded, how can i leave it "alone" to use in a new player?
[https://stackoverflow.com/a/44234560/12765259][1]
$url = 'http://server1.com/player.php';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10');
$html = curl_exec($curl);
curl_close($curl);
$dom = new DOMDocument();
@$dom->loadHTML($html); //convert character asing
$xpath = new DOMXPath($dom);
$script = $xpath->query ('//script[contains(text(),"window.atob(")]')->item (0)->nodeValue;
$json = end(explode( 'sources:', $script));
$json = explode ( ']', $json)[0].']';
echo $json
?>```
[1]: https://stackoverflow.com/a/44234560/12765259
To achieve this, you should look up these PHP functions: base64_decode and preg_match
Then do something like this: