Spotify song-name helper

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

目前为 2019-06-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @author craftwar
  3. // @name Spotify song-name helper
  4. // @description Make craftwar's obs plugin (https://craftwarblog.blogspot.com/2018/01/obs-plugin-playing-song.html) able to get Spotify song name.
  5. // @copyright 2019, craftwar (https://craftwarblog.blogspot.com/)
  6. // @license GPL-3.0+; https://www.gnu.org/licenses/gpl-3.0.txt
  7. // @homepageURL https://github.com/craftwar/userscript/tree/master/spotify-song-name-helper
  8. // @version 0.1.20190602
  9. // @namespace github.com.craftwar
  10. // @match https://open.spotify.com/*
  11. // @grant none
  12. // @run-at document-end
  13. // ==/UserScript==
  14.  
  15. (() => {
  16. const track_observer = new MutationObserver( ()=> {
  17. if (!document.title.endsWith(" - YouTube"))
  18. document.title += " - YouTube";
  19. });
  20.  
  21. track_observer.observe(document, {subtree:true, characterData:true});
  22. })();