HypeMachine Chrome Extension – Still going

Short and Sweet

This will be a short and sweet post. It’s been a while since I’ve used my HypeMachine Chrome Extension and just as long since I’ve used HypeMachine (my music taste has shifted). However I’m always surprises me the community of people using the extension.

I’ve recently merged in some new code that allows the user to download multiple songs at once which was graciously written by Scott Clayton. The code is now in master, so feel free to re-install the extension and give the new functionality a whirl!

Try #2: Fixing download name

tl;dr;

Let’s get straight to the point; I believe I have finally fixed the download name issue. You can download the latest fix in the chrome-bug-373182 branch; simply download the zip chrome-bug-373182.zip

Explanation

For those curious who have been tracking the Chrome bug; I thought the issue was unsolvable as the latest fix has caused any cross-origin requests to not respect the download attribute (except for data URIs). I had nevertheless believed I had fixed it earlier because when testing some downloads (from the popular page) I only attempted the first page of songs loaded. The glaring problem however was that the songs loaded upon scrolling down were not receiving the jQuery on event (even with the delegation syntax!). My solution at the moment, is simply to unbind all event handlers for the array key and re-bind them upon any ajax completion. This isn’t the greatest solution but it works!
Perhaps someone can help me fix it so that it uses jQuery’s delegation event handling properly…

Fix for latest Extension Hypemachine bug

Wah Happened?!

During the last week I got a lot of e-mails from people telling me how the extension was no longer working for them. The complaint was the name of the song downloaded seemed to have been ‘garbled’ or no longer working. I’m sorry it took me a while (~1 week) to dig into it, however I now have published the fix into a new branch on Github.

For those curious, the regression (bug) looks to be caused by Chrome/Chromium and is currently being tracked here, where they don’t seem to be respecting the download attribute for anchor tags.

Enjoy the music,
Farid

New Changes to HypeMachine Extension

Minor improvements

Hasn’t been a while since I’ve written a blog post and this one will be pretty short. I’ve recently submitted a small push to my HypeMachine-Extension. The commit includes:

  • General code cleanlyness (so people can learn/understand better what it’s doing)
  • Added Google Analytics to see how many songs are being downloaded in general.
  • Added download attribute so that the song automatically downloads when you click the button!

I think the best reason to grab the latest changes is for the download on click fix, which also sets the name of the file download to the “title – artist.mp3”

Open Questions

Ideas for Metrics?

I’d love to hear ideas on some neat Google Analytics people would like to see tracked. I’ll be publishing the metrics I’m tracking now once I get enough data!

Google Chrome Store ?

Does anyone know enough of copyright law/trademark infringement to help me understand whether I can safely re-publish the extension to the Google Chrome Store?

The joys of knowing Software – Hacking the Boat License Course

Boat Licenses

NOTE: June 17th 2016 – I received a cease and desist letter from boat-ed.com and they have fixed the way in which the script in this post circumvents the wait. I am not aware of any other way to bypass it.

Summer is fast approaching and me and a group of friends decided to take the water on some ridiculously fun jet skis. In the state of Washington, a boat license is required to operate any PWC (personal watercraft) which thankfully can be done online. As a procrastinator I put aside 30 minutes of my time the night before the excursion to do the online exam on www.boat-ed.com. I was in for a large shock when I discovered that you had to sit through all the course material on the website prior to attempting the exam; average time for completion 6-8 hours.

Time is precious

Time is precious. It’s constantly fleeting and the last thing I wanted to do was sit through 6-8 hours of instructions that I knew and are largely common sense. The final exam should be indicative of whether you know the material or not, therefore it is not necessary to force people to sit through the course (all though you can Google the answers to the exam…). As my roomate decided to sit through the course material blindly hitting next when the button becomes available as he watched tv shows on Netflix, I decided to investigate if my knowledge of Computer Science can save me!

Chrome Extensions FTW

tl;dr; Install this Chrome Extension, which will enable you to skip any State Boat License course on www.boat-ed.com

Having some prior experience to writing Chrome Extensions and knowing more than my fair share of web services, I was able to dig into their JavaScript source files and find how they were forcing the users to sit through the course material. I will leave future blog posts perhaps detailing how one might go about “hacking” websites to reverse engineer their web services and fiddle around with it, briefly the steps were:

  1. Reverse obfuscate their JavaScript
  2. Find the offending timer code
  3. Figure out how to diable the timer (was a server call
  4. Fake the code in a Chrome Extension

Update – Google Chrome HypeMachine Extension Alive and Well!

I’m still kicking

tl;dr; You can get the latest and greatest of the Chrome HypeMachine Download Extension on my Github Account.

I hope everyone hasn’t written me off as dead since the somewhat shutdown of MetaHypem. I’ve been trying to think of a new project and devoting to more time to my professional life (i.e. working at Amazon). I have however not forgotten about all of you and your insatiable desire for music.

I recently received a Pull-Request that detailed some changes I’ve been planning to make for quite a while! (props to landr0id). The changes outlined:

  1. changing to HypeMachine’s new private API (which I’ve detailed earlier)
  2. adding the new sexy HTML5 download attribute
  3. Downloaded songs are now named according to artist and title
  4. general performance improvements

What does this mean for you?

The extension is still alive and well. You can even now Left Click on the download arrow to kickoff the download. Goodbye confusing Save As… instructions!

Hypem API Changes

A constant rat race

Honestly, I don’t even use hypem.com anymore since my music taste has changed, however I am constantly trying to keep my hypem chrome extension and python download script up to date with the changes to the site. People have been overall extremely generous in their compliments which is why I keep updating the script.

Although I may not use the site anymore, I am finding their constant attempts to thwart similar extensions interesting and have enjoyed the constant rate race. I’ve documented on my blog already several of their numerous attempts to thwart similar projects and looks like they released their latest incarnation. I hope this post will serve those who are attempting to enjoy their music beyond the confines of the site helpful.

So, What’s Changed?

Previously, the link to the mp3 file was very easy to generate and scrape from their HTML page. Every song use to contain it’s unique identifiers right in the ‘div’ element of that song. One simply had to parse out the ‘key’ and ‘id’ and construct a URL to http://hypem.com/serve/play/id/key.mp3 and your content was served on a platter. They’ve now added a few more tricks to their sleeve but it’s still trivial getting access to the mp3.

  1. Firstly, they’ve moved where the ‘key’ is stored for each song. They’ve embedded the ‘keys’ of the current page in a ‘script’ object on the site. The interior of the script object is simply JSON.
  2. Example

    <script type="application/json" id="displayList-data">
    {"page_cur":"/track/1q7nf?ax=1&ts=1349217708.87","page_num":1,"tracks":[{"type":"normal","id":"1q7nf","time":372,"ts":{"sec":1349210330,"usec":0},"postid":1950767,"posturl":"http://stereogum.com/1167152/wooden-wand-southern-colorado-song/mp3s/","fav":0,"key":"55b57f34d3774ecc94ff7360e02dc279","artist":"Wooden Wand","song":"So. Colorado Song","thumb_url_large":""}],"page_name":"item","title":"Wooden Wand - So. Colorado Song, posted on music blogs / The Hype Machine","page_next":"/track/1q7nf/2.87","page_mode":"1q7nf"} </script>

    After the page loads, they read the JSON data into a javascript variable and remove the script tag from the HTML body. So you won’t be able to inspect a current page and find the code

  3. Secondly, they’ve changed the whole request mechanism for serving songs. Before as I mentioned, the /serve/play url immediately served up the Mp3. This is no longer the case. There is now an intermediate request which returns some JSON data and then finally the URL to the Mp3 is retrieved and served!
  4. Relevant Code from hype_functions_min.js

  5. Thirdly, this hasn’t changed but don’t forget about setting the cookie! Hypemachine checks for a AUTH cookie and without it will not authorize your get request for the song data! Simply store the cookie when you retrieve the HTML and use the same one when you make further requests. Voila!

HypeMachine Extension Fixed

Sorry it took so long…

While I was away on vacation in Turkey (will post photos later), HypeMachine and Chrome decided to both muck up my extension. This is a short blog post to inform everyone that the code found on GitHub is now fixed and working again. Hurray!

Please go to https://github.com/fzakaria/HypeMachine-Extension to get the latest Chrome Extension.

Call to arms

What I was not able to fix however is the nifty/spiffy look of the downward arrow button. I’d love if someone can please contribute to the project and fix the arrow. I liked the original implementation of it being done in pure CSS as it blended in beautifully with the Hypem page. Please either contact me or submit a patch to the GitHub repository!

Continue reading “HypeMachine Extension Fixed”

Update: Fixed HypeScript and HypeMachine Extension

Just a quick update.

I’ve fixed the HypeScript issue and updaed the HypeMachine Chrome extension. Both should be working, please let me know if they are still not.

For those curious as to the fixes they are:

HypeScript:

  • Had to change the regular expression used to match the id/keys.

HypeExtension:

  • Changed where the download button is appended to make it always properly visible and aesthetically pleasing still.

You can checkout my commits on GitHub and get the latest extension and hype script. I’ll try to update the java GUI batch downloader tonight (I need to re-setup the project again :S )

Please let me know if you have any issues or need any help!

HypeMachine Script / Java / Extension Not Working

Hey Everyone,

First off, just wanted to thank everyone for all the kind words and support I’ve received either via the comments or by e-mail! It’s always touching to hear about how a little program I wrote (in a hurry for my own use) has been so helpful for others. I think we all can agree how invaluable HypeMachine has been in expanding our music taste and it only makes sense to want to share that music offline at parties, in the form of playlists and at the gym for instance.

I’ve gotten a lot of feedback recently about how all the scripts, java program and extension have recently stopped working. I’m going to try and get it fixed A.S.A.P. however I’d like to point you all to my GitHub where I’ve made all the code available. Please file a bug request or even fork the code! I kind of wrote all the code in a hurry for myself and it would be great to get some global community together to improve upon it! =)

I’ve set aside some time this week to look at it.

Cheers,
Farid Zakaria