Created
February 4, 2026 17:39
-
-
Save MrPandir/717c5661bad698702eda116f38eaa2f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Fix Reyohoho API | |
| // @namespace https://reyohoho.github.io/ | |
| // @version 0.6 | |
| // @description Removes leading [] from cache response and rewrites Alloha iframe URL | |
| // @author MrPandir with Grok | |
| // @match https://reyohoho.github.io/reyohoho/* | |
| // @grant none | |
| // @run-at document-start | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict' | |
| const { prototype: XHR } = XMLHttpRequest | |
| const originalOpen = XHR.open | |
| const originalSend = XHR.send | |
| XHR.open = function (method, url, ...args) { | |
| this._targetUrl = url | |
| return originalOpen.apply(this, [method, url, ...args]) | |
| } | |
| XHR.send = function (...args) { | |
| if (!this._targetUrl?.includes('api4.rhserv.vu/cache')) { | |
| return originalSend.apply(this, args) | |
| } | |
| this.addEventListener('load', function () { | |
| if (!this.responseText?.startsWith('[]') || this.responseText.length <= 2) { | |
| return | |
| } | |
| let jsonText = this.responseText.slice(2) | |
| try { | |
| const data = JSON.parse(jsonText) | |
| if (!Array.isArray(data)) return | |
| let changed = false | |
| for (const item of data) { | |
| if ( | |
| item?.name?.toLowerCase?.().includes('alloha') && | |
| typeof item.iframe === 'string' | |
| ) { | |
| const tokenMovieMatch = item.iframe.match(/[?&]token_movie=([^&]+)/) | |
| if (!tokenMovieMatch) continue | |
| const tokenMovie = tokenMovieMatch[1] | |
| const nextIframe = `https://torz-as.newplayjj.com/t?token_movie=${tokenMovie}&token=21cd16881e99329c9cd45845f2c852` | |
| if (nextIframe !== item.iframe) { | |
| item.iframe = nextIframe | |
| changed = true | |
| } | |
| } | |
| } | |
| if (changed) { | |
| const patched = JSON.stringify(data) | |
| Object.defineProperties(this, { | |
| responseText: { value: patched, writable: false, configurable: true }, | |
| response: { value: patched, writable: false, configurable: true } | |
| }) | |
| } | |
| } catch { | |
| // silent fail | |
| } | |
| }) | |
| return originalSend.apply(this, args) | |
| } | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment