The world is getting tighter….Can’t breathe. Ughhh… Screw Firefox

Words cannot decribe how angry I am right now….Writing this blog post to kill off some negativities.

Tired of all this.
Water your face


With Github releasing unlimited private repositories option plan, I was literally shouting in the air. No private repo was the main reason we was not using github in the first place in our OS class repo ( It is about Weenix and all the codes right belongs to Brown university; therefore we could only host it on bitbucket for it being generous giving us 5 free private repos ). Well, tobe honest, my github has been inactive for awhile; it looks like place to put up sample codes. I am going to strive to do something about it. And people been doing these x days of consecutive coding and it turns out great. I want to do that and up my code streaks for real not faky-faky-faky. Listen to this guide( READ LATER)

But I am slacking off watching youtube all days, which is exactly what I should do something about –do the things you love and you will never work a day in your life.

Don’t you agree ?

I have been coding Youtube stuff for a while. But now I decided to actually do it for real.

The motivation : Automation my daily repitition for the sake of being lazy.

My normal day on youtube starts out like this :


Log in Youtube > Subscription > Watch all the new Cool Video
NOPE to the face.
Home > Watch it Again or > Recommended


Youtube has this cool little Recommended Layout that recommend me to watch videos. Right now there is no options to Watch them as a playlist. I could create playlist and add them but that would be too gruelesome. How many clicks are there ?. So I want at about 1-2 clicks I can setup a fake playlist to play. Enter Youtube Theater.

Getting inputs

So far, the viable solutions to creating playlist is embedding an iframe. Therefore, I could setup a fake local html that embed a bunch of these and I would be all good. ( I don’t want to waste my time and money buying host and setting up server just to host those videos — A while back when I was in college[ Told you I am into Youtube for long, even making a youtube download/scape Python app before] I really want to make a Youtube repeat player. Tried it with Chrome extension until I figured out that you need server for that. Example). The html could load video using youtube videoid( those alphanumerics after ?v= ). I need a way to load a  bunch of video ids.  Thought for a while then decided to use encode the videos using query parameters.

var yt = []; //store youtube video objects containing property : videoId, startSec, quality


var query =;
var videoIds = query.substring(query.indexOf("=")+1).split("&");

for( var i = 0; i < videoIds.length; i++ )

yt.push( new YTVideo( videoIds[i] ) );


To manually send inputs to the html, I come up with the following script

var recommended = doc.getElementsByClassName("feed-item-dismissable")[1];
var ids = [];
var ll = recommended.getElementsByClassName("yt-lockup-thumbnail contains-addto");//each square of videos
for( var i = 0 ; i < ll.length; i++ ){
ids.push( ll[i].firstChild.href.split("=")[1]);
var test_link = "test.html?v=";
for( var i = 0 ; i < ids.length; i++ ){
test_link += ids[i] + "&";
test_link = test_link.substring(0, test_link.lastIndexOf("&"));

//open a new tab, '_blank');

Well, it sorta works

Sorry Ben
Works. Hoo-ray

My approach is like this. I could just download the using curl and turns them into string to feed into javascript above and it will works. The problem is it is having issue with cross domain problem( localhost > youtube host ). I think it might work, I don’t know yet , curl does not seem to work in bash and downloading the site is not a wise choice.

So I am bashing that approach in favor of Firefox Extension but little did I know that’s the source of frustration to come bite me. Firefox is always my browser of choice because it never crashes too often, not like Safari and Chrome, so it is easily my platform of choice and given that i am familiar with developing extension for it.

Signing my anus

Firefox since version 38 switches to using NPM from NodeJS for extension manager/installer. I was hesitant for a bit since people are talking bad about it(Look at that 141 comments!!!) but gotta do what I gotta do.

First off, the installing process is off-putting

Wut. No install for current user?
Well. Done


Putting in my simple code to add context menu and when clicked run my little javascript code above

var cm = require("sdk/context-menu");
label: "Play Recommended",
context: cm.URLContext(["*"]),
contentScript: 'self.on("click", function( node, data ) {' +
' self.postMessage( node.href );'
+ '});'
onMessage: playRecommended

OK. Compiles. Then Run and found the following:

Verify What???


Googling around. People said I could turn that off by setting xpinstall.signatures.required = false in “about:config.” Tried that. Didn’t work. Then only Nightly version works. OK. Download and install and here is the first scene.


What gives.
My God.

Then I could Turn it on but that red message still there and I did not even know whether it works or not. Did not see my context menu. Donot know how to debug. Guess I am back to Safari. Good Lord.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s