Git Product home page Git Product logo

interhulude's Introduction

As featured in LifeHacker and Mashable.

Yay! Except that it got the attention of Hulu's team which worked to counter the extension.

In particular, they added the following:

var a = "#NoHuluAdsMask"; 
$.client && $.client.browser == "Chrome" && window.setInterval(function() {
var b = document.location;
if (!/\/watch\/(\d+)/.test(b.pathname)) return;
var c = $(a);
c.length > 0 && c.remove();
}, (new Date).getTime() % 2e3 + 2e3);

and removed some of their player's APIs, namely getCurrentState, mute and pauseVideo, removing all hope of working around that again.

Fair game.

If it isn't clear, the new code periodically looks for the element with ID NoHuluAdsMask (the mask I create) and removes it from the DOM. There are a couple of interesting things: first of all, they do that only if your browser is Chrome. Why not do that for all browsers? Probably not to add unnecessary work for other browsers, but it seems a bit of premature optimization.

The second thing I find interesting is how they calculate the interval to use: (new Date).getTime() % 2e3 + 2e3. The 2000-modulo of the current time (in milliseconds), plus 2000. So the interval can vary from 2000 to 3999, or 2 to 4s. I find it odd there could be so much variance in the interval length, depending on when the code is actually run. However, I imagine it's so that it scatters the various intervals set in other places… This doesn't seem to be a very valid concern.

Anyway, it was fun while it lasted… I kind of wish I had kept it for myself, so that it would still work. :)

This is thus for educational purposes only.

--

Hello there,

this is just a few lines of JavaScript that mutes the ads on Hulu, packaged in a Chrome extension.

In more details: the ads will be automatically muted and masked when they come on, and unmasked when the commercial break is over. If desired, it will also pause the video when the break is over, so you can step out with the knowledge that you won't miss anything.

Screenshot

Provided under the MIT License.

Available in the Chrome Web Store.

Also ported to GreaseMonkey by reddit user atticusalien: http://userscripts.org/scripts/show/152373

Enjoy,

Tim

timotheeboucher.com

interhulude's People

Contributors

timothee avatar

Watchers

James Cloos avatar  avatar

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.