Double request for Songs + New Layout

Published 2011-06-21 on Farid Zakaria's Blog

Two For One Ajax Request

I believe in an attempt to stop browser extensions that inject download buttons onto HypeMachine's website, they've recently changed how the songs are delivered. This is annoying once again because it means not only my extension is broken but all my scripts + Java Batch Loader as well.
Let's take a look at what they've changed.

Prior the requests to the song were simply one Ajax Request


 var song_url = "/serve/play/" + + "/" + activeItem.key;
 try {
  currentPlayerObj[0] = soundManager.createSound({
  id: 'currentPlayer' + currentTrack,
  url: song_url 


function playTrack(skip_prompts) {
//removed bunch of code not related to grabbing the song content
r = new Ajax.Request("/serve/source/" + + "/" + activeItem.key, {
 method: 'get',
 onSuccess: function (transport) {
 var source_data;
 source_data = transport.responseText.evalJSON();
 try {
  currentPlayerObj[0] = soundManager.createSound({
  id: 'currentPlayer' + currentTrack,
  url: source_data.url,
  //removed a bunch of settings set for creating the sound object for sake of brevity

The request to "/serve/source/" + + "/" + activeItem.key now results in a JSON object that contains the appropriate URL and some additional data. Making retrieving song requiring two Ajax requests.

For those that are curious to look at the HypeMachine's javascript, you will notice that it has been minified in order to save space. I've been suing JSBeautifier , in order to 'un-minify' it. A very clean and wonderfully helpful website, kudos.

What does this mean for my extension and scripts ?

Previously the buttons I injected were linked to straight MP3 but now instead when I inject the buttons I'll have to perform an Ajax request for each one to get the proper URL to the MP3 file. I haven't implemented this yet but hopefully it doesn't cause the injection to be exceedingly slow and unusable. I'll work on it sometime this week and hopefully can fix it !

The change is less severe for the scripts & java program as I just need to make another request to get the URL before downloading the file.

Just another hoop to jump through...

I'm Against The Layout Change

Hype Machine just pushed a layout change to their website. I just wanted to openly voice my opinion that I am against the change for the following reasons:

  1. It is overall visually unappealing.
  2. I miss the standard green colour backdrop, I've known to come and love.
  3. There is a huge grotesque nestea add on the site now.
  4. I find the fact that only the song content scroll and not the whole site in general hurtful on my eyes.

Here's a pic of the new layout (in case they decide to revert it):
[caption id="attachment_586" align="aligncenter" width="300" caption="Visually unaesthetic"][/caption]

Not a fan.