Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There's no reason to apply this script to vods #297

Closed
wants to merge 1 commit into from

Conversation

rainlizard
Copy link

I'm getting freezes in Firefox while watching vods, it says "This page is slowing down Firefox" and the stream stops. Sorry I'm not sure why, front page says (may suffer from more freezing / playback issues) so maybe that's it.

It's just silly that it's even running the script when vods don't even have any ads, so this PR prevents that.

If vods ever do get ads, then you can revisit this again and allow the script to run on vods.

note: I'm new to this, I tried using @exclude but that doesn't work well when clicking back and forth between vods and live, without refreshing.

@pixeltris
Copy link
Owner

Unfortunately that isn't going to work for the reason you mentioned:

note: I'm new to this, I tried using @exclude but that doesn't work well when clicking back and forth between vods and live, without refreshing.

Using the change in this PR if you open a video url directly, then navigate to a stream it'll modify the window url but the page isn't changed so the script wont ever get loaded and you'll see ads.

In terms of your freezing issues on vods there's only one location where the responses to requests could be modified and that's when you first open a given vod and the m3u8 of the vod is requested:

if (url.endsWith('m3u8')) {

Which calls down into this:

weaverText = await processM3U8(url, responseText, realFetch, PlayerType2);

Which only modifies the response if the ad signifier is found:

scope.AdSignifier = 'stitched';

var haveAdTags = textStr.includes(AdSignifier);
if (haveAdTags) {

It isn't the best check so it could get hit in some rare situations but otherwise the requests aren't being modified on vods.

You could possibly do the same sort of checks inside of the following but the first one is in Worker scope which I don't think has access to the window href so you'd need to postMessage it. But it'd be a better idea to improve the script itself to address any possible issues it's causing rather than add a url check.

function hookWorkerFetch() {
console.log('hookWorkerFetch');
var realFetch = fetch;
fetch = async function(url, options) {

function hookFetch() {
var realFetch = window.fetch;
window.fetch = function(url, init, ...args) {

@pixeltris pixeltris closed this Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants