dataDiv.innerHTML=`<span style="color:red;">That doesn't look like a valid video ID.<br />If it is valid, please report the bug on github!</span>`;
dataDiv.innerHTML=`<span style="color:red;">That doesn't look like a valid video ID.<br />If it is valid, please report the bug on GitHub!</span>`;
submitBtn.disabled=false;
submitBtn.innerHTML="Search for Captures";
returnfalse;
@@ -96,27 +96,27 @@ function finish(vid1) {
fetch(`api/v4/youtube/${vid}?stream`)
.then((response)=>{
if (response.status===410||response.status===404){
dataDiv.innerHTML=`<span style="color: red;">API version is not supported - this should never happen, please report this</span>`;
dataDiv.innerHTML=`<span style="color: red;">API version is not supported - this should never happen, please report this!</span>`;
returnnull;
}
if (response.status===500){
dataDiv.innerHTML=`<span style="color: red;">Internal server error - this is not your fault, please try again</span>`;
dataDiv.innerHTML=`<span style="color: red;">Internal server error - this is not your fault, please try again.</span>`;
returnnull;
}
if (response.status===429){
dataDiv.innerHTML=`<span style="color: red;">You have been rate limited - please slow down</span>`;
dataDiv.innerHTML=`<span style="color: red;">You have been rate limited - please slow down.</span>`;
returnnull;
}
if (response.status===502){
dataDiv.innerHTML=`<span style="color: red;">The server is currently down - please wait a minute and try again</span>`;
dataDiv.innerHTML=`<span style="color: red;">The server is currently down - please wait a minute and try again.</span>`;
returnnull;
}
if (response.status==503){
dataDiv.innerHTML=`<span style="color: red;">The YouTube Video finder is currently unavailable. Please check back later. More information might be available by refreshing the page.</span>`
dataDiv.innerHTML=`<span style="color: red;">The YouTube Video Finder is currently unavailable. Please check back later. More information might be available by refreshing the page.</span>`;
returnnull;
}
if (response.status!==200){
dataDiv.innerHTML=`<span style="color: red;">Received unknown status code ${response.status}</span>`;
dataDiv.innerHTML=`<span style="color: red;">Received unknown status code ${response.status}</span>.`;
returnnull;
}
returnresponse.body.getReader();
@@ -196,7 +196,7 @@ function finish(vid1) {
return;
}
default:{
thrownewError("unexpected state")
thrownewError("unexpected state");
}
}
}
@@ -205,14 +205,14 @@ function finish(vid1) {
if (done){
Object.values(elements).forEach((i)=>{
if (i.getAttribute("data-status")=="loading"){
i.querySelector(".result").innerHTML=`<span class="white">Error</span><br />Did not receive a result from the server.`
i.querySelector(".result").innerHTML=`<span class="white">Error</span><br />Did not receive a result from the server.`;
}
})
});
return;
}
lettext=newTextDecoder().decode(value);
for (constcoftext){
currentline+=c
currentline+=c;
if (c==="\n"){
processLine(currentline);
currentline="";
@@ -256,7 +256,7 @@ function finishWrpa(data) {
try{
returnfinish(data);
}catch (err){
console.error(err)
console.error(err);
dataDiv.innerHTML="<span class='red'>An unknown error occured. Please report this. If possible, provide console output and a way of reproducing.</span>";