Skip to content

Commit

Permalink
Create ipad1.html
Browse files Browse the repository at this point in the history
  • Loading branch information
etapic authored Jun 15, 2024
1 parent 169ffc0 commit 4c313be
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions ipad1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<title>Kick extract</title>
<style>
#presetLinks a {
display: block;
margin-bottom: 5px;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.14/es5-shim.min.js"></script>
</head>
<body>
<div id="presetLinks"></div>

<input type="text" id="streamerName">
<button onclick="fetchM3U8()">Get M3U8</button>

<div id="result" style="margin-top: 20px;"></div>

<script>

const presetStreamers = ["slightlyhomeless","moxie","sjc_official","sam", "suspendas", "kangjoel", "ac7ionman", "shakomako", "carldo", "nedx", "n3on", "iceposeidon", "cristravels", "nataliereynolds", "nickwhite", "hanridge", "deepak", "taemin1998", "hood_priest", "captaingee", "ddurantv", "vitaly", "adinross"];
function createPresetLinks() {
const linksContainer = document.getElementById("presetLinks");
presetStreamers.forEach(name => {
const link = document.createElement("a");
link.href = "#";
link.textContent = name;
link.onclick = () => fetchM3U8(name, true);
linksContainer.appendChild(link);
});
}


async function fetchM3U8(streamerName = null, redirect = false) {
const name = streamerName || document.getElementById("streamerName").value;
const apiUrl = `https://kick.com/api/v1/channels/${name}`;

try {
const response = await fetch(apiUrl);
const data = await response.json();

if (data.playback_url) {
const m3u8Url = data.playback_url;

if (redirect) {
redirectToM3U8(m3u8Url);
} else {
const resultDiv = document.getElementById("result");
resultDiv.innerHTML = `
<p><span id="m3u8UrlDisplay">${m3u8Url}</span></p>
<button onclick="redirectToM3U8('${m3u8Url}')">Redirect</button>
<button onclick="copyToClipboard('${m3u8Url}')">Copy</button>`;
}
} else {
document.getElementById("result").textContent = "Stream not found or offline.";
}
} catch (error) {
document.getElementById("result").textContent = "Error fetching stream data.";
}
}

function redirectToM3U8(m3u8Url) {
window.location.href = m3u8Url;
}

async function copyToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
alert('M3U8 URL copied to clipboard!');
} catch (err) {
alert('Failed to copy: ', err);
}
}

createPresetLinks();
</script>

</body>
</html>

0 comments on commit 4c313be

Please sign in to comment.