Last active
December 16, 2023 12:17
-
-
Save aoirint/5dbe0febd4a560e5aa92b4d93aadc2ab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// ==UserScript== | |
// @name niconico_live_user_live_program_user_script | |
// @namespace Violentmonkey Scripts | |
// @match https://live.nicovideo.jp/embed/broadcast-history | |
// @grant none | |
// @version 0.1.0 | |
// @author aoirint | |
// @description 2023-12-08T00:07:54+09:00 | |
// ==/UserScript== | |
(() => { | |
function run() { | |
const textAreaElement = document.createElement("textarea") | |
textAreaElement.cols = 80 | |
textAreaElement.rows = 3 | |
textAreaElement.style.fontSize = "6pt" | |
textAreaElement.style.position = "fixed" | |
textAreaElement.style.zIndex = 999 | |
textAreaElement.style.left = 0 | |
textAreaElement.style.top = 0 | |
document.body.appendChild(textAreaElement) | |
textAreaElement.addEventListener("click", (event) => { | |
event.target.select() | |
}) | |
let string = "" | |
for (const programCardElement of [...document.querySelectorAll(".program-card")]) { | |
// ライブ公開を除外 | |
if (programCardElement.querySelector(".video-premiere-label") != null) continue; | |
string += [ | |
new URL(programCardElement.querySelector(".program-title a").href).pathname.slice(7), | |
programCardElement.querySelector(".start-at").getAttribute("datetime").replace(" ", "T") + "+09:00", | |
programCardElement.querySelector(".end-at").getAttribute("datetime").replace(" ", "T") + "+09:00", | |
programCardElement.querySelector(".program-title").innerText, | |
].join("\t") + "\n" | |
} | |
textAreaElement.value = string | |
} | |
let intervalId = null | |
intervalId = setInterval(() => { | |
const totalCountElement = document.querySelector(".total-count") | |
if (totalCountElement == null) return | |
const totalCount = parseInt(totalCountElement.dataset.value) | |
if (totalCount == 0) return | |
run() | |
clearInterval(intervalId) | |
}, 300) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment