Code Monkey home page Code Monkey logo

Comments (12)

odensc avatar odensc commented on May 30, 2024 5

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.

from ttv-ublock.

odensc avatar odensc commented on May 30, 2024 3

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)

from ttv-ublock.

brian6932 avatar brian6932 commented on May 30, 2024 2

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

from ttv-ublock.

svage96 avatar svage96 commented on May 30, 2024 2

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).

from ttv-ublock.

brian6932 avatar brian6932 commented on May 30, 2024

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

from ttv-ublock.

justbanter avatar justbanter commented on May 30, 2024

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";

from ttv-ublock.

svage96 avatar svage96 commented on May 30, 2024

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

from ttv-ublock.

justbanter avatar justbanter commented on May 30, 2024

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.

from ttv-ublock.

tripplehelix avatar tripplehelix commented on May 30, 2024

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.

from ttv-ublock.

SakhJack avatar SakhJack commented on May 30, 2024

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

from ttv-ublock.

laichiaheng avatar laichiaheng commented on May 30, 2024

It doesn't work.

from ttv-ublock.

petercunha avatar petercunha commented on May 30, 2024

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

from ttv-ublock.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.