Niconico URL 重定向

自动将类似 acg.tv/sm* 的 URL 转换为 nicovideo.jp/watch/sm* (包括 URL 参数)

  1. // ==UserScript==
  2. // @name Niconico URL 重定向
  3. // @name:en Niconico URL redirector
  4. // @name:zh-TW Niconico 網址重新導向
  5. // @namespace http://tampermonkey.net/
  6. // @version 0.1
  7. // @description 自动将类似 acg.tv/sm* 的 URL 转换为 nicovideo.jp/watch/sm* (包括 URL 参数)
  8. // @description:en Redirect URLs like acg.tv/sm* to nicovideo.jp/watch/sm* (including url arguments)
  9. // @description:zh-TW 自動將類似 acg.tv/sm* 的網址轉換為 nicovideo.jp/watch/sm* (包含網址參數)
  10. // @author はなちゃん with help by Bing Copilot
  11. // @match *://*/*
  12. // @grant none
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. // Function to redirect URLs
  20. function redirectUrls() {
  21. // Redirect current window URL
  22. if (window.location.href.includes("acg.tv/sm")) {
  23. window.location.href = window.location.href.replace("acg.tv/sm", "nicovideo.jp/watch/sm");
  24. }
  25.  
  26. // Redirect URLs in href of a tags
  27. document.querySelectorAll('a').forEach(a => {
  28. if (a.href.includes("acg.tv/sm")) {
  29. a.href = a.href.replace("acg.tv/sm", "nicovideo.jp/watch/sm");
  30. }
  31. });
  32. }
  33.  
  34. // Call the function initially
  35. redirectUrls();
  36.  
  37. // Call the function 1s later, for later-render page.
  38. setInterval(() => { redirectUrls(); }, 1000);
  39. })();

QingJ © 2025

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