-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |