F**k BILIBILI'S TRACKING PARAMETER

Replace bilibili's tracking parameter and makes it funnier.

  1. // ==UserScript==
  2. // @name F**k BILIBILI'S TRACKING PARAMETER
  3. // @namespace https://ceplavia.com
  4. // @version 1.0
  5. // @description Replace bilibili's tracking parameter and makes it funnier.
  6. // @author Ceplavia
  7. // @match https://www.bilibili.com/video/*
  8. // @match https://www.bilibili.com/s/video/*
  9. // @match https://acg.tv/*
  10. // @match https://b23.tv/*
  11. // @grant none
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. function checkAndReplaceParams() {
  19. let url = new URL(window.location.href);
  20. let params = url.searchParams;
  21.  
  22. let isChanged = false;
  23. if (params.has('vd_source')) {
  24. params.set('vd_source', 'CHEN_RUI_NI_MA_SHEN_ME_SHI_HOU_SI_A');
  25. isChanged = true;
  26. }
  27. if (params.has('spm_id_from')) {
  28. params.set('spm_id_from', 'SHA_BI_CHEN_RUI');
  29. isChanged = true;
  30. }
  31.  
  32. if (isChanged) {
  33. url.search = params.toString();
  34. window.history.replaceState({}, '', url.toString());
  35. }
  36. }
  37.  
  38. let observer = new MutationObserver(function(mutations) {
  39. mutations.forEach(function(mutation) {
  40. if (mutation.type === 'childList') {
  41. checkAndReplaceParams();
  42. }
  43. });
  44. });
  45.  
  46. let config = { childList: true, subtree: true };
  47.  
  48. observer.observe(document.body, config);
  49.  
  50. checkAndReplaceParams();
  51. })();

QingJ © 2025

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