Enable Full SponsorBlock Support in Grayjay
Grayjay is an Android app that allows you to follow the creators, no matter what platform they use to publish their videos. Four months ago, they added support for SponsorBlock. Although it wasn’t the full SponsorBlock, which some of us love and use every day, their implementation only skipped the sponsor sections from the videos, and there was no way to enable them to skip other categories of SponsorBlock.
Figuring Out:
A few days ago, I was looking into the source code of YouTube plugin which Grayjay uses, and then I found out that they use this line of code to fetch the SponsorBlock API’s endpoint.
const URL_YOUTUBE_SPONSORBLOCK = "https://sponsor.ajay.app/api/skipSegments?videoID=";
After digging into the documentation of SponsorBlock, I found out that if I changed the API endpoint to the below-mentioned URL, I could skip all the categories that SponsorBlock supported.
const URL_YOUTUBE_SPONSORBLOCK = `https://sponsor.ajay.app/api/skipSegments?categories=["sponsor","intro","outro","selfpromo","music_offtopic","preview","filler"]&videoID=`;
Setting Up:
Now, the only thing left at this point is to make this modified plugin available in the Grayjay app. The fastest way that I used to make the plugin available was by making a public repo on GitHub and then adding the required 3 files from the original repo of Grayjay plugins. The required three files are YouTubeConfig.js, YouTubeScript.js, and youtube.png
We are not done yet, but in order to access our plugin, we need to make some changes to the YouTubeConfig.js file. The fields that require changes are name, sourceUrl, scripturl and iconUrl. To understand this properly, you can refer to my changes, which would give you a proper idea of how to do it.
Lastly, we need to make the GitHub repo into GitHub pages so that we can access our uploaded files. In the end, simply create a QR code linking to the URL of the YouTubeConfig.json file.
Changes In App:
In order to add our plugin to the app, head over to the sources section and tap on add sources. Inside, choose to install by QR. Once you scan your QR code, it will state that it requires reinstalling the existing plugin, and then it will also mention that it failed the signature verification. Just continue with the installation, and then once everything is done, head over again to sources and then tap on your newly installed plugin. Scroll down to the SponsorBlock section and then enable it. Also, allow no vote segments and set the skip type to automatic.
That’s it. Now enjoy the full SponsorBlock experience in Grayjay without depending on the developers to add it. Hopefully, someone will find this guide helpful.