獲取Bilibili動態訂閱

一鍵複製訂閱

  1. // ==UserScript==
  2. // @name 獲取Bilibili動態訂閱
  3. // @version 0.0.1
  4. // @description 一鍵複製訂閱
  5. // @match https://www.bilibili.com/*
  6. // @grant GM_setClipboard
  7. // @license MIT
  8. // @namespace https://www.example.com/
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13. function get_link() {
  14. var div_name = document.querySelector('.name');
  15. if (div_name) {
  16. // Get the link inside the div
  17. var link = div_name.querySelector('a');
  18. var rss_link_fix = "https://rsshub.app/bilibili/user/dynamic/";
  19.  
  20. if (link) {
  21. // Get the href of the link
  22. var href = link.href;
  23.  
  24. // 分割網址並且取得最後一個值
  25. var lastValue = href.split('/').pop();
  26. var rss_link = rss_link_fix + lastValue;
  27.  
  28. // Show the last value in an alert
  29. return rss_link;
  30. }
  31. }
  32. }
  33.  
  34. var current_rss_link = get_link();
  35.  
  36.  
  37. function click_to_copy_url() {
  38. var div_name = document.querySelector('.name');
  39. if (div_name) {
  40. // Get the first link inside the div
  41. var link = div_name.querySelector('a');
  42.  
  43. if (link) {
  44. // Set the new href value
  45. link.setAttribute('href', current_rss_link);
  46.  
  47. // Add a click event listener to the link
  48. link.addEventListener('click', function (event) {
  49. // Prevent the default link behavior
  50. event.preventDefault();
  51. GM_setClipboard(current_rss_link);
  52.  
  53. // Copy the new href value to the clipboard
  54. navigator.clipboard.writeText(newHref);
  55. });
  56. }
  57. }
  58. }
  59.  
  60. click_to_copy_url();
  61. })();

QingJ © 2025

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