Free720p

ニコニコ内の動画をyoutubeの動画に置き換える

  1. // ==UserScript==
  2. // @name Free720p
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description ニコニコ内の動画をyoutubeの動画に置き換える
  6. // @author You
  7. // @run-at document-end
  8. // @match https://www.nicovideo.jp/watch/sm*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=nicovideo.jp
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. function START() {
  15. let video = document.querySelector("#MainVideoPlayer > video");
  16. video.removeAttribute("crossOrigin");
  17. let yturl;
  18.  
  19. document.getElementsByClassName("MainContainer")[0].insertAdjacentHTML(
  20. "beforebegin",
  21. `<input style='width: 650px;color: #1c1c1c;font-size: 13px;border: none;border-radius: 14px 0px 0px 0px;padding: 4px 12px 4px 7px;box-shadow: #0000006b 0px 0px 3px 0px;' id='url_input'><button style=' font-size: 13px;
  22. padding: 4px;
  23. border: #c9c9c9 1px solid;
  24. color: #8f8f8f;
  25. font-weight: bold;' id='url_button'>置換</button></input>`
  26. );
  27.  
  28. document.getElementById("url_button").onclick = function (e) {
  29. yturl = document
  30. .getElementById("url_input")
  31. .value.split("=")[1]
  32. .slice(0, 11);
  33. video.src = `https://onion.tube/latest_version?id=${yturl}&itag=22`;
  34. };
  35. }
  36. const start = setInterval(() => {
  37. if (
  38. document.querySelector("#MainVideoPlayer > video").crossOrigin != undefined
  39. ) {
  40. START();
  41. clearInterval(start);
  42. }
  43. }, 50);
  44. console.log("📺Replnc v0.1\nCopyright (c) 2023 tanbatu.");