Speechify Premium Voices Helper

Removes 1500 word limit on premium voices

// ==UserScript==
// @name         Speechify Premium Voices Helper
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Removes 1500 word limit on premium voices
// @author       You
// @match        https://app.speechify.com/*
// @match        https://dev.app.speechify.com/*
// @match        https://staging.app.speechify.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=speechify.com
// @grant        unsafeWindow
// @run-at       document-start
// @license      MIT
// ==/UserScript==

const mockedResponse = {
    "subscriptions": [],
    "entitlements": {
        "isPremium": false,
        "hdWordsLeft": 1500,
        "nextHDWordsGrant": 0,
        "nextHDWordsGrantDate": null,
        "lastHdWordsGrantDate": "2024-04-26T13:35:08.000Z",
        "audiobookCreditsLeft": 0,
        "lastAudiobookCreditsGrantDate": "2024-04-26T13:35:08.000Z",
        "voiceoverSeconds": 0,
        "dubbingSeconds": 0,
        "avatarsSeconds": 0,
        "ttsExportSeconds": 0
    }
}


const {fetch: origFetch} = unsafeWindow;
unsafeWindow.fetch = async (...args) => {
  if(`${args?.[0]}`?.includes?.("getAllSubscriptionsAndEntitlements")){
     return new Response(JSON.stringify(mockedResponse));
  }

  return await origFetch(...args);
};

(function() {
    'use strict';
    localStorage.setItem('currentWordCount','0');
    setInterval(()=>{
        localStorage.setItem('currentWordCount','0');
    },1000);
})();