NEW Netflix Autoplay Bookmarklet!

GOOD NEWS EVERYONE!

I was checking out Netflix today, and they seem to have moved to an HTML5 video player (for me in Chrome at least, and that is all I tested). This is awesome news as it made writing a new autoplay bookmarklet easy as shit! They also got rid if the bit of Javascript they were trying to use to prevent you from using the console. I don’t know why they made the decision to get rid of that, it could be because they know it is a dumb idea and anybody who actually knows what they are doing can get around it, it could be because they are now OK with people playing around, it could be just an accident, but I am going to take personal credit for it because of this post: I Don’t Like Being Told What I Can and Can’t Do.

Anyway, as I said, this awesome new HTML5 video player made my job super easy – as you can see by how much less code there is this time…and here it is:

'use strict';
(function(undefined){
	//Check if user has already loaded an instance - if so, just update the play time;
	if(window._ME && window._ME.autoplayer) {
		//Get desired play time extension & convert to miliseconds
		window._ME.autoplayer.playTime = window.prompt('Autoplay already started! Updating playtime. \n How many more minutes would you like to play for?') * 60 * 1000;
		if(isNaN(window._ME.autoplayer.playTime)) {
			window.alert('That\'s not a number jackass.');
		}
		window._ME.autoplayer.startTime = new Date();
		return;
	}

	window._ME = {
		autoplayer: {}
	};

	//Get desired play time & convert to miliseconds
	window._ME.autoplayer.playTime = window.prompt('How many minutes would you like to play for?') * 60 * 1000;
	if(isNaN(window._ME.autoplayer.playTime)) {
		window.alert('That\'s not a number jackass.');
	}
	window._ME.autoplayer.startTime = new Date();
	var lastUpdate = new Date();

	//Checks if the video has stopped or if we are done playing once a second
	window._ME.autoplayer.interval = setInterval(function() {
		var currentTime = new Date();

		// Check if autoplay-interrupt has fired
		if(document.getElementsByClassName('player-autoplay-interrupter').length > 0 && document.getElementsByClassName('continue-playing').length > 0) {
			//Just click the continue button!
			document.getElementsByClassName('continue-playing')[0].click();
		} 

		//Check if at end of season
		if (document.getElementsByClassName('player-postplay-autoplay-header') && document.getElementsByTagName('video').length === 0 && document.getElementsByClassName('player-postplay-still-hover').length > 0) {
			//Click the next video picture
			document.getElementsByClassName('player-postplay-still-hover')[0].click();
		}	

		//Check if we have reached the users max play time
		if(window._ME.autoplayer.playTime && currentTime - window._ME.autoplayer.startTime > window._ME.autoplayer.playTime && document.getElementsByClassName('player-play-pause').length > 0) {
			//click the pause button
			document.getElementsByClassName('player-play-pause')[0].click();

			//remove all traces of this autoplayer
			clearInterval(window._ME.autoplayer.interval);
			delete(window._ME);
		}

		lastUpdate = currentTime;
	}, 1000);
})();

Basically all I had to do this time was watch for when the right elements popup on the screen, and when they do, click them. Thank you Netflix!

The Thing You Want:
Here is the Bookmarklet: Netflix Autoplay

I also made a couple of extra bookmarklets because it was so easy.

Restart the timer:

(function() {
	window._ME.autoplayer.startTime = new Date();
})();

Bookmarklet: Restart Timer

Turn off Autoplay:

(function() {
	clearInterval(window._ME.autoplayer.interval);
	delete(window._ME);
})();

Bookmarklet: Turn off Autoplay

If you are new to this, to use these, simply drag those links up to your bookmark bar, then start up the TV show you want to watch, and click the first bookmark.

The bookmarklet will ask you how long you want to play for, and it will pause the video and remove itself when it hits that time limit. For never-ending play, just enter “0″.
-If you hit it a second time, it will as you again how long you want to play for, and restart the timer with the new length.

If you hit the second bookmarklet I have there, it will restart the timer. Meaning that if you put in “60″ (for 1 hour of play time) hitting it will restart the countdown back to 60 minutes.

If you hit the third bookmarklet, it will remove all traces of the bookmarklet from the page (basically the same as just hitting refresh on the page).

This should have no problem with multiple seasons, or any of that fancy stuff. Let me know if you find any bugs, I may do something about them I guess.

And I should have this up on GitHub shortly here: https://github.com/rtpmatt/Netflix-HTML5-Autoplay-Bookmarklet

Update:
Yeah, I just tried this in FireFox, and apparently it still uses SilverLight, not HTML5 videos, so this wont work at all in it. So, please don’t tell me about how it is broken in FireFox, I will not be doing anything about that…If you are using IE, then I REALLLY don’t care if it works or not. If you send me anything about your IE situation I may send you back an insult, or possibly a picture of a cat butt, that might be fun for you I guess? I don’t know if you will be able to view them on IE though.

This entry was posted in Github, javascript, Netflix, programming. Bookmark the permalink.

One Response to NEW Netflix Autoplay Bookmarklet!

  1. Pingback: Netflix Autoplay Chrome Extension – With System Sleep! | Mostly Worthless

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>