Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Not currently blocking ads anymore #3

Closed
brian6932 opened this issue Nov 6, 2020 · 12 comments
Closed

Not currently blocking ads anymore #3

brian6932 opened this issue Nov 6, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@brian6932
Copy link

brian6932 commented Nov 6, 2020

I know that Twitch has been restricting the player to 360/480p and you edited the script recently in an attempt to mitigate those changes, however, the script now no longer actually blocks the ads. Also, don't recommend Twitch alternate player, that thing has like 30s of delay.

Edit from maintainer:

Please try the latest standalone extension version, which should block ads as of Nov 8th: #3 (comment)

@odensc
Copy link
Owner

odensc commented Nov 6, 2020

Yes the script currently doesn't work as stated in the Reddit post. Also I have never recommended Alternate Player?

Nov 8th edit: #3 (comment)

@odensc odensc closed this as completed Nov 6, 2020
@odensc odensc reopened this Nov 6, 2020
@odensc odensc added the enhancement New feature or request label Nov 6, 2020
@brian6932
Copy link
Author

brian6932 commented Nov 6, 2020

I never said you recommended it, a lot of people have been, I felt like saying that it wasn't worth the trade off for me beforehand in case you do, I think it just came off wrong

@svage96
Copy link

svage96 commented Nov 7, 2020

what if we override the access_token response and set the 3 variables (or more) regarding ads to disable them. It would look something like this:

/// twitch-videoad.js
const origFetch = window.fetch;
window.fetch = (url, init, ...args) => {
	if (typeof url === "string" && url.includes("/access_token")) {
			var response;
			return origFetch(url, init, ...args)
            .then(function(res){response = res; return res.json()})
			.then(function(new_body) {
                new_body.token = new_body.token.replace("\"hide_ads\":false", "\"hide_ads\":true")
                                               .replace("\"server_ads\":true", "\"server_ads\":false")
                                               .replace("\"show_ads\":true", "\"show_ads\":false");
                return new Response(JSON.stringify(new_body), {
                                       status: response.status,
                                       statusText: response.statusText,
                                       headers: response.headers });
            });		
    }
    
	return origFetch(url, init, ...args);
};

doubt the ads could be controlled client side, but maybe it would work? I can override it in console, but not with ublock (probably missing something stupid).

@brian6932
Copy link
Author

doubt the ads could be controlled client side, but maybe it would work? I can override it in console, but not with ublock (probably missing something stupid).

You can try using UserScript managers like ViolentMonkey

@justbanter
Copy link

I haven't thoroughly tested but setting the query params "player_type" to "mobile" and "platform" to "android" seems to fix, ie:

url = url.replace("player_type=site", "player_type=mobile");
url = url.replace("platform=web", "platform=android");

and

newBody.variables.playerType = "mobile";
newBody.variables.platform = "android";

@svage96
Copy link

svage96 commented Nov 7, 2020

I haven't thoroughly tested but setting the query params "player_type" to "mobile" and "platform" to "android" seems to fix, ie:

url = url.replace("player_type=site", "player_type=mobile");
url = url.replace("platform=web", "platform=android");

and

newBody.variables.playerType = "mobile";
newBody.variables.platform = "android";

still got an ad but seems less frequent than without that patch. They probably serve less ads to mobile users?
edit: nvm i'm getting ads every stream

@justbanter
Copy link

justbanter commented Nov 7, 2020

After making the changes I mentioned, if I refresh the page after an ad shows up it goes away. I think that's why people are using userscripts to automate this.

@odensc
Copy link
Owner

odensc commented Nov 8, 2020

Hey folks. Just released a Chrome/Firefox-extension version that should block ads. Give it a try: https://github.com/odensc/ttv-ublock/tree/extension (instructions in readme)

Remove any previous uBlock script you may have installed.

@tripplehelix
Copy link

Hey folks. Just released a Chrome/Firefox-extension version that should block ads. Give it a try: https://github.com/odensc/ttv-ublock/tree/extension (instructions in readme)

Remove any previous uBlock script you may have installed.

This seems to be working on initial tests.

@odensc odensc pinned this issue Nov 8, 2020
@SakhJack
Copy link

SakhJack commented Nov 8, 2020

do we have to re-download it every time twitch patch fix?

@laichiaheng
Copy link

laichiaheng commented Nov 9, 2020

It doesn't work.

@petercunha
Copy link

The new chrome extension is working great! Thanks for your hard work @odensc

@odensc odensc unpinned this issue Nov 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants