Twitch RSS Button

Add link to a channel's RSS feed

  1. // ==UserScript==
  2. // @name Twitch RSS Button
  3. // @namespace http://domain.com/directory
  4. // @description Add link to a channel's RSS feed
  5. // @include *://*.twitch.*/*
  6. // @run-at document-start
  7. // @version 0.0.1.20191107015349
  8. // ==/UserScript==
  9.  
  10. setInterval(function()
  11. {
  12.  
  13. var cur_url = window.document.URL;
  14.  
  15. //// Get Rss Link
  16. var fields = cur_url.split('/');
  17. var junk1 = fields[0];
  18. var junk2 = fields[1];
  19. var twitchlink = fields[2];
  20. window.channellink = fields[3];
  21. var junk3 = fields[4];
  22. window.targetlink = "https://twitchrss.appspot.com/vod/" + window.channellink;
  23.  
  24. var btn = document.getElementById('button')
  25.  
  26. if (window.channellink != "")
  27. {
  28. if (window.channellink != "directory")
  29. {
  30. btn.style.visibility = "visible";
  31. }
  32. else
  33. {
  34. btn.style.visibility = "hidden";
  35. }
  36. }
  37. else
  38. {
  39. btn.style.visibility = "hidden";
  40. }
  41. }, 500);
  42.  
  43. //Make Button
  44. addButton("RSS Feed", rssFeedFn)
  45.  
  46. function addButton(text, onclick, cssObj) {
  47. cssObj = cssObj || {position: 'absolute', bottom: '86%', left:'75%', 'z-index': 3}
  48. let button = document.createElement('button'), btnStyle = button.style
  49. document.body.appendChild(button)
  50. button.innerHTML = text
  51. button.onclick = onclick
  52. button.id = "button"
  53. Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key])
  54. return button
  55. }
  56.  
  57.  
  58. //Clck Button
  59.  
  60. function rssFeedFn()
  61. {
  62. if (window.channellink != "")
  63. {
  64. if (window.channellink != "directory")
  65. {
  66. window.open(window.targetlink);
  67. }
  68. }
  69.  
  70. }

QingJ © 2025

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