Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Remove homosharts
  3. // @namespace remove homosharts
  4. // @version 0.2
  5. // @description Remove sharts in .jetri
  6. // @author 35p
  7. // @match https://hololive.jetri.co/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. const shartList = ['花咲みやび','奏手イヅル','アルランディス','律可','アステル','岸堂天真','夕刻ロベル','影山シエン','荒咬オウガ','ホロスタ',]
  14. const freeChatList = ['【Free chat】サーカス客席【ホロライブ/尾丸ポルカ】', '【Free chat】Happy New Year!ししろんの射撃訓練場【ホロライブ/獅白ぼたん】', '✿ FreeeChat | Miko Ch. ✿']
  15.  
  16. if (location.host === "hololive.jetri.co") {
  17. window.addEventListener('DOMContentLoaded', clearnup(), false);
  18. window.addEventListener('load', clearnup(), false);
  19. window.addEventListener('beforeunload', clearnup(), false);
  20.  
  21. function clearnup(){
  22. function modifyResponse(response) {
  23. if (this.readyState === 4) {
  24. const url = response.target.responseURL;
  25. const original_response = response.target.responseText;
  26.  
  27. if (url.search("//api.holotools.app/v1/live") >= 0) {
  28. Object.defineProperty(this, "responseText", {writable: true});
  29. const modified_response = JSON.parse(original_response);
  30. modified_response.live = cleanupVids(modified_response.live);
  31. modified_response.ended = cleanupVids(modified_response.ended);
  32. modified_response.upcoming = cleanupVids(modified_response.upcoming);
  33. modified_response.live = cleanupFreechats(modified_response.live);
  34. modified_response.upcoming = cleanupFreechats(modified_response.upcoming);
  35. this.responseText = JSON.stringify(modified_response);
  36. }
  37.  
  38. if (url.search("//api.holotools.app/v1/videos") >= 0) {
  39. Object.defineProperty(this, "responseText", {writable: true});
  40. const modified_response = JSON.parse(original_response);
  41. modified_response.videos = cleanupVids(modified_response.videos);
  42. this.responseText = JSON.stringify(modified_response);
  43. }
  44.  
  45. if (url.search("//api.holotools.app/v1/channels") >= 0) {
  46. Object.defineProperty(this, "responseText", {writable: true});
  47. const modified_response = JSON.parse(original_response);
  48. modified_response.channels = cleanupChannels(modified_response.channels);
  49. this.responseText = JSON.stringify(modified_response);
  50. }
  51. }
  52. }
  53.  
  54. function cleanupVids(vids) {
  55. return vids.filter(v => shartList.every(shart => !v.channel.name.includes(shart)));
  56. }
  57.  
  58. function cleanupChannels(channels) {
  59. return channels.filter(c => shartList.every(shart => !c.name.includes(shart)));
  60. }
  61.  
  62. function cleanupFreechats(vids) {
  63. return vids.filter(v => freeChatList.every(freeChat => !v.title.includes(freeChat)));;
  64. }
  65.  
  66. function openBypass(original_function) {
  67. return function(method, url, async) {
  68. this.addEventListener("readystatechange", modifyResponse);
  69. return original_function.apply(this, arguments);
  70. };
  71. }
  72.  
  73. XMLHttpRequest.prototype.open = openBypass(XMLHttpRequest.prototype.open);
  74. }
  75. }
  76. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement