Advertisement
Guest User

Remove homosharts

a guest
Jan 13th, 2022
203
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.                       'Risu', 'Moona', 'Airani Iofifteen', 'Ollie', 'Anya', 'Reine']
  15.     const freeChatList = ['Twitterのかわりにお知らせしたりする枠【Free Chat】', '【Free chat】サーカス客席【ホロライブ/尾丸ポルカ】', '【Free chat】Happy New Year!ししろんの射撃訓練場【ホロライブ/獅白ぼたん】', '✿  FreeeChat | Miko Ch. ✿']
  16.  
  17.     if (location.host === "hololive.jetri.co") {
  18.         window.addEventListener('DOMContentLoaded', clearnup(), false);
  19.         window.addEventListener('load', clearnup(), false);
  20.         window.addEventListener('beforeunload', clearnup(), false);
  21.  
  22.         function clearnup(){
  23.             function modifyResponse(response) {
  24.                 if (this.readyState === 4) {
  25.                     const url = response.target.responseURL;
  26.                     const original_response = response.target.responseText;
  27.  
  28.                     if (url.search("//api.holotools.app/v1/live") >= 0) {
  29.                         Object.defineProperty(this, "responseText", {writable: true});
  30.                         const modified_response = JSON.parse(original_response);
  31.                         modified_response.live = cleanupVids(modified_response.live);
  32.                         modified_response.ended = cleanupVids(modified_response.ended);
  33.                         modified_response.upcoming = cleanupVids(modified_response.upcoming);
  34.                         modified_response.live = cleanupFreechats(modified_response.live);
  35.                         modified_response.upcoming = cleanupFreechats(modified_response.upcoming);
  36.                         this.responseText = JSON.stringify(modified_response);
  37.                     }
  38.  
  39.                     if (url.search("//api.holotools.app/v1/videos") >= 0) {
  40.                         Object.defineProperty(this, "responseText", {writable: true});
  41.                         const modified_response = JSON.parse(original_response);
  42.                         modified_response.videos = cleanupVids(modified_response.videos);
  43.                         this.responseText = JSON.stringify(modified_response);
  44.                     }
  45.  
  46.                     if (url.search("//api.holotools.app/v1/channels") >= 0) {
  47.                         Object.defineProperty(this, "responseText", {writable: true});
  48.                         const modified_response = JSON.parse(original_response);
  49.                         modified_response.channels = cleanupChannels(modified_response.channels);
  50.                         this.responseText = JSON.stringify(modified_response);
  51.                     }
  52.                 }
  53.             }
  54.  
  55.             function cleanupVids(vids) {
  56.                 return vids.filter(v => shartList.every(shart => !v.channel.name.includes(shart)));
  57.             }
  58.  
  59.             function cleanupChannels(channels) {
  60.                 return channels.filter(c => shartList.every(shart => !c.name.includes(shart)));
  61.             }
  62.  
  63.             function cleanupFreechats(vids) {
  64.                 return vids.filter(v => freeChatList.every(freeChat => !v.title.includes(freeChat)));;
  65.             }
  66.  
  67.             function openBypass(original_function) {
  68.                 return function(method, url, async) {
  69.                     this.addEventListener("readystatechange", modifyResponse);
  70.                     return original_function.apply(this, arguments);
  71.                 };
  72.             }
  73.  
  74.             XMLHttpRequest.prototype.open = openBypass(XMLHttpRequest.prototype.open);
  75.         }
  76.     }
  77. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement