-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYTMD-Musiikki-to-OBS.php
55 lines (46 loc) · 975 Bytes
/
YTMD-Musiikki-to-OBS.php
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
<?php
$curl = curl_init('http://YTMDESKTOP IP:9863');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($curl);
if (curl_errno($curl)) {
echo 'Error: ' . curl_error($curl);
exit;
}
curl_close($curl);
$DOM = new DOMDocument;
libxml_use_internal_errors(true);
if (!$DOM->loadHTML($page)) {
$errors = '';
foreach (libxml_get_errors() as $error) {
$errors .= $error->message . "\r\n";
}
libxml_clear_errors();
print "LibXML Errors: \r\n$errors";
return;
}
$Xpath = new DOMXPath($DOM);
$content = $Xpath->query('//*[@class="truncate"]')->item(0);
?>
<html>
<head>
<meta http-equiv="refresh" content="5">
<style>
p {
width: 1500px;
border: 5px solid white;
padding: 50px;
margin: 20px;
font-size: 50px;
color: #ff7200;
}
</style>
</head>
<body style="background-color: black;">
<br>
<br>
<p>
Nyt Soi:<br>
<?php echo htmlspecialchars($content->textContent, ENT_QUOTES, 'UTF-8'); ?>
</p>
</body>
</html>