function formatTS(delta) {
var date = new Date(new Date().getTime() - window.start + (delta || 0));
return "00:" +
("0" + date.getMinutes()).slice(-2) + ":" +
("0" + date.getSeconds()).slice(-2) + "," +
("00" + date.getMilliseconds()).slice(-3);
}
function printTexts() {
console.log(
window.texts.join("")
// + formatTS() + "\r\n" + window.sub + "\r\n\r\n"
);
return "";
}
function record() {
document.getElementsByTagName("video")[0].click();
window.start = new Date().getTime() - 1; // global
window.texts = new Array();
window.texts.push(
"1" + "\r\n"
// + formatTS() + " --> "
);
window.i = 2; // global
window.sub = ""; // global
window.lastSub = "";
setInterval(function() {
// DOMSubtreeModified
window.sub = document.getElementsByClassName("css-jrziy5")[0].innerText;
if (window.lastSub !== window.sub) {
console.log(window.sub);
window.texts.push(
// formatTS(-5) + "\r\n" +
window.sub + "\r\n" +
"\r\n" +
(window.i++) + "\r\n"
// + formatTS() + " --> "
);
window.lastSub = window.sub;
}
}, 10);
return "start recording...";
}
record();
网友评论