Quote:
Originally Posted by huda0
Thnks bro
|
What did you do?
I set up the html page, activated the extensions and then went on skillcapped, copied this URL in the farm:
[Only registered and activated users can see links. Click Here To Register...]
but it doesn't load the vid.
Nvmd.
You need to remove the last part of the URL. Everything from the last / and afterwards.
I added a download button and functionality.
I also added a link strip which cuts away the last part of the URL so you can just paste it in from Skillcapped.
Code:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SkillUncapped</title>
</head>
<label>url: </label>
<input onkeyup="if (event.key =='Enter') stream()" style="width: 300px;" id="url"
placeholder="https://www.skill-capped.com/lol/commentaries/p1qcnwqt75" />
<button style="width: 80px;" onclick="stream()">Stream</button>
<label style="display: block;" id="status"></label>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video style="display: block; margin-top: 16px; margin-bottom: 16px;" height="720" width="1280" id="video" controls
autoplay crossorigin="anonymous" />
<script>
var hls = null;
if (Hls.isSupported()) {
var hlsjsConfig = {
"maxBufferSize": 0,
"maxBufferLength": 30,
"startPosition": 0
}
hls = new Hls(hlsjsConfig);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
video.play();
});
}
const rgx = /([a-z0-9]{10})(:?\/|$)/g;
async function stream() {
if (hls == null) {
alert("HLS not supported, please use a modern browser such as Chrome");
return;
}
let rawUrl = document.getElementById("url").value;
rawUrl = rawUrl.replace(/\/[^/]*$/, '');
let ids = [];
let match = null;
while ((match = rgx.exec(rawUrl)) !== null) {
ids.push(match[1]);
}
if (ids.length < 1) {
alert("Invalid URL");
return;
}
const videoId = rawUrl.includes("browse3") ? ids[0] : ids[ids.length - 1];
let statusLabel = document.getElementById("status");
console.log(`Video ID is ${videoId}`);
console.log("Looking for the final part...");
let last = 0;
let jump = true;
for (let i = 300; i <= 1000; i++) {
if (i == 1000) {
alert("Error finding the last part");
return;
}
if (i == 0) i = 1;
const url = `https://d13z5uuzt1wkbz.cloudfront.net/${videoId}/HIDDEN4500-${String(i).padStart(5, "0")}.ts`;
console.log(`Testing ${url}`);
statusLabel.innerText = `Looking for the final part; Testing ${i}...`;
try {
const resp = await fetch(url, { method: 'HEAD' });
if (resp.status === 403) {
if (i >= 50 && i % 50 === 0 && jump) {
last = i;
jump = true;
i -= 51;
continue;
}
break;
}
last = i;
jump = false;
} catch (e) {
alert("Fetch failed, please install a Cross-Origin disabler extension for your browser or check your internet connectivity.");
return;
}
}
statusLabel.innerText = "";
let data = "#EXTM3U\n#EXT-X-PLAYLIST-TYPE:VOD\n#EXT-X-TARGETDURATION:10";
for (let i = 0; i <= last; i++) {
data += `#EXTINF:10,\nhttps://d13z5uuzt1wkbz.cloudfront.net/${videoId}/HIDDEN4500-${String(i).padStart(5, "0")}.ts\n`
}
console.log(data);
// Load the media for streaming
hls.loadSource("data:application/x-mpegURL;base64," + btoa(data));
hls.attachMedia(video);
// Add a download button for users to download the media
const downloadButton = document.createElement("a");
downloadButton.classList.add("downloadBtn");
downloadButton.textContent = "Download Media";
downloadButton.href = `data:application/x-mpegURL;base64,${btoa(data)}`;
downloadButton.download = "your_media_file.m3u8"; // Specify the filename for download
document.body.appendChild(downloadButton);
// Add a click event listener to the download button
downloadButton.addEventListener("click", function () {
// Clear the player by stopping and unloading it
hls.stopLoad();
hls.detachMedia();
// Remove the download button
document.body.removeChild(downloadButton);
document.getElementById("url").value = "";
});
}
</script>
<style>
.downloadBtn {
font-family: sans-serif;
text-decoration: none;
padding: 8px 16px;
background-color: #33b249;
color: #fff;
font-weight: 700;
font-size: 1rem;
margin-left: auto;
border-radius: 4px;
position: absolute;
left: 640px;
transform: translateX(-50%);
transition: background-color 250ms ease-in;
}
.downloadBtn:hover {
background-color: #2ea042;
}
</style>
</body>
</html>