-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.html.preload
57 lines (55 loc) · 3.06 KB
/
player.html.preload
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
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>@PiperPiedBot</title>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
}
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
</style>
</head>
<script>
const id = new URLSearchParams(window.location.search).get('id');
let url;
if (id.startsWith('tt')) {
url = 'https://kinobox.tv/api/players/?imdb=' + id + '&sources=Collaps,Alloha,Hdvb,Videocdn,Voidboost,Kodik';
} else {
url = 'https://kinobox.tv/api/players/?kinopoisk=' + id + '&sources=Collaps,Alloha,Hdvb,Videocdn,Voidboost,Kodik';
}
//alert(url);
// отправляем запрос с помощью fetch API
fetch(url)
.then(response => response.json())
.then(data => {
if(data[0] && data[0].iframeUrl) {
document.body.innerHTML = `<iframe class="iframe" src="${data[0].iframeUrl}" frameborder="0" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen="" seamless></iframe>`;
} else if(data[1] && data[1].iframeUrl) {
document.body.innerHTML = `<iframe class="iframe" src="${data[1].iframeUrl}" frameborder="0" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen="" seamless></iframe>`;
} else if(data[2] && data[2].iframeUrl) {
document.body.innerHTML = `<iframe class="iframe" src="${data[2].iframeUrl}" frameborder="0" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen="" seamless></iframe>`;
} else if(data[3] && data[3].iframeUrl) {
document.body.innerHTML = `<iframe class="iframe" src="${data[3].iframeUrl}" frameborder="0" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen="" seamless></iframe>`;
} else if(data[4] && data[4].iframeUrl) {
document.body.innerHTML = `<iframe class="iframe" src="${data[4].iframeUrl}" frameborder="0" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen="" seamless></iframe>`;
} else if(data[5] && data[5].iframeUrl) {
document.body.innerHTML = `<iframe class="iframe" src="${data[5].iframeUrl}" frameborder="0" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen="" seamless></iframe>`;
} else if(data[6] && data[6].iframeUrl) {
document.body.innerHTML = `<iframe class="iframe" src="${data[6].iframeUrl}" frameborder="0" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen="" seamless></iframe>`;
} else {
console.error('Ошибка: фильм или сериал не найден.');
}
})
.catch(error => console.error('Произошла ошибка при выполнении запроса:', error));
</script>
</html>