Guest User

Untitled

a guest
Nov 18th, 2023
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://schedule.hololive.tv/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=hololive.tv
  9. // @grant none
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. // Format
  15. //const whiteList = ['name'];
  16. // Example
  17. const whiteList = ['FUWAMOCO','Ina','Amelia','Shiori','Kaela','Flayon','Crimzon','ホロライブ'];
  18.  
  19. // Official schedule
  20. if (location.host === "schedule.hololive.tv") {
  21. document.addEventListener('DOMContentLoaded', () => {
  22. document.body.querySelectorAll(".name").forEach(nameE => {
  23. const name = nameE.innerText.trim();
  24. if (!whiteList.some(wlN => name.includes(wlN))) {
  25. nameE.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.remove();
  26. };
  27. });
  28.  
  29. if (blBtn = document.evaluate("//a[contains(., 'ホロスタ')]", document, null, XPathResult.ANY_TYPE, null ).iterateNext()) {
  30. blBtn.parentNode.remove();
  31. }
  32. });
  33. }
  34.  
  35. // Holotools
  36. if (location.host === "hololive.jetri.co") {
  37. document.addEventListener('DOMContentLoaded', () => {
  38. // here we will modify the response
  39. function modifyResponse(response) {
  40. if (this.readyState === 4) {
  41. const url = response.target.responseURL;
  42. const original_response = response.target.responseText;
  43.  
  44. if (url.search("//api.holotools.app/v1/live") >= 0) {
  45. Object.defineProperty(this, "responseText", {writable: true});
  46. const modified_response = JSON.parse(original_response);
  47. modified_response.live = keepWhitelisted(modified_response.live);
  48. modified_response.ended = keepWhitelisted(modified_response.ended);
  49. modified_response.upcoming = keepWhitelisted(modified_response.upcoming);
  50. this.responseText = JSON.stringify(modified_response);
  51. }
  52.  
  53. if (url.search("//api.holotools.app/v1/videos") >= 0) {
  54. Object.defineProperty(this, "responseText", {writable: true});
  55. const modified_response = JSON.parse(original_response);
  56. modified_response.videos = keepWhitelisted(modified_response.videos);
  57. this.responseText = JSON.stringify(modified_response);
  58. }
  59.  
  60. if (url.search("//api.holotools.app/v1/channels") >= 0) {
  61. Object.defineProperty(this, "responseText", {writable: true});
  62. const modified_response = JSON.parse(original_response);
  63. modified_response.channels = keepWhitelisted(modified_response.channels);
  64. this.responseText = JSON.stringify(modified_response);
  65. }
  66. }
  67. }
  68.  
  69. function keepWhitelisted(items) {
  70. return items.filter(item => whiteList.some(wlN => item.channel.name.includes(wlN)));
  71. }
  72.  
  73. function openBypass(original_function) {
  74. return function(method, url, async) {
  75. this.addEventListener("readystatechange", modifyResponse);
  76. return original_function.apply(this, arguments);
  77. };
  78. }
  79.  
  80. XMLHttpRequest.prototype.open = openBypass(XMLHttpRequest.prototype.open);
  81. });
  82. }
  83. })();
  84.  
Advertisement
Add Comment
Please, Sign In to add comment