MooBot-song-player song-name helper

Make craftwar's obs plugin (https://craftwarblog.blogspot.com/2018/01/obs-plugin-playing-song.html) able to get NightBot-AutoDJ song name.

  1. // ==UserScript==
  2. // @author craftwar
  3. // @name MooBot-song-player song-name helper
  4. // @description Make craftwar's obs plugin (https://craftwarblog.blogspot.com/2018/01/obs-plugin-playing-song.html) able to get NightBot-AutoDJ song name.
  5. // @copyright 2020, craftwar (https://craftwarblog.blogspot.com/)
  6. // @license GPL-3.0-or-later; https://www.gnu.org/licenses/gpl-3.0.txt
  7. // @homepageURL https://github.com/craftwar/userscript/tree/master/MooBot-song-name-helper
  8. // @version 0.1.20201005
  9. // @namespace github.com.craftwar
  10. // @match https://moo.bot/*
  11. // @grant none
  12. // @run-at document-end
  13. // ==/UserScript==
  14.  
  15. 'use strict';
  16. (() => {
  17. const body_observer = new MutationObserver((record, observer) => {
  18. const song_list = document.querySelector(".widget-song-requests-list");
  19. if (song_list) {
  20. observer.disconnect();
  21.  
  22. const song_observer = new MutationObserver(() => {
  23. document.title = song_list.querySelector(".widget-song-requests-list-text > h4:first-child").firstChild.wholeText + " - YouTube";
  24. });
  25. song_observer.observe(song_list, { subtree: true, childList: true });
  26. }
  27. });
  28. const body_element = document.querySelector("body");
  29. body_observer.observe(body_element, { subtree: true, childList: true });
  30. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址