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!

14 thoughts on “Hypem API Changes

      1. Freut mich, dass es dir helfen kotnne :)So lange es eine Mf6glichkeit gibt, ist ja alles gut. Aber so entgeht Amazon eine inzwischen immer grf6dfer werdende Kundenzahl

      2. Sooooooooo coooooooooolBut how to coernvt a C struct which include pointer field point to a struct ?For example: struct LOCK_IP {char ip[20]; //lock ipint time; //lock timefloat a; //just e.g.double b;char c;unsigned char d;unsigned int e; struct LOCK_IP* next; struct someObj* obj;};Shall I define the function json_object_new_undefined() by myself ?Thanks

    1. thanks Andrew.
      I haven’t forgotten about the extension or the script and the people who use it either!
      I’ve just been focused on this new site to let you download.

      All the goodies coming soon

      1. Danke, das hat gerade 10€ von mir gertetet. Bis vor kurzem konnte man die Musik auch noch direkt mit Banshee kaufen. Geht nun nicht mehr. Ich denke ich war das letzte mal bei Amazon Musik kaufen.

  1. “There is now an intermediate request which returns some JSON data and then finally the URL to the Mp3 is retrieved and served!”

    This is not the case in my experience.
    I see no JSON response, just Status: 302[Moved Temporarily] redirects.

    12:16:25.468[666ms][total 666ms] Status: 302[Moved Temporarily]
    GET http://hypem.com/serve/play/1rbkb/9097b60b6f3d3ad9a4212a66321d2314.mp3 Load Flags[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Content Size[-1] Mime Type[text/html]
    Request Headers:
    Host[hypem.com]
    User-Agent[Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[nl,en-us;q=0.7,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Proxy-Connection[keep-alive]
    Cookie[__utma=1717032.1548772717.1353445981.1353445981.1353755681.2; __utmz=1717032.1353445981.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __qca=P0-1026700643-1353445981753; hblid=HTLhI2PQKnTXcuaVZqqhWBG786428581; olfsk=olfsk8030978083672631; AUTH=03%3A74e587adb3047850a3f48ba2986d2c82%3A1353445973%3A1448472171%3A09-NL; __utmb=1717032.1.10.1353755681; __utmc=1717032]
    Response Headers:
    Content-Type[text/html; charset=UTF-8]
    Content-Encoding[gzip]
    Transfer-Encoding[chunked]
    Location[http://api.soundcloud.com/tracks/68232982/stream?consumer_key=nH8p0jYOkoVEZgJukRlG6w]
    Server[nginx/1.2.3]
    Vary[Accept-Encoding]
    Date[Sat, 24 Nov 2012 11:15:59 GMT]
    Keep-Alive[timeout=5]
    Connection[Keep-Alive]
    Proxy-Connection[Keep-Alive]

    12:16:26.135[97ms][total 97ms] Status: 302[Moved Temporarily]
    GET http://api.soundcloud.com/tracks/68232982/stream?consumer_key=nH8p0jYOkoVEZgJukRlG6w Load Flags[LOAD_DOCUMENT_URI LOAD_REPLACE LOAD_INITIAL_DOCUMENT_URI ] Content Size[28] Mime Type[application/xml]
    Request Headers:
    Host[api.soundcloud.com]
    User-Agent[Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[nl,en-us;q=0.7,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Proxy-Connection[keep-alive]
    Response Headers:
    Content-Type[application/xml; charset=utf-8]
    Content-Length[28]
    Via[1.1 varnish]
    Access-Control-Allow-Origin[*]
    X-Cacheable[NO:Cache-Control=no-cache]
    Location[http://ec-media.soundcloud.com/4wBtAmevZJkU.128.mp3?ff61182e3c2ecefa438cd02102d0e385713f0c1faf3b0339595666f90800ed15a826ef5293b6ad9fcb33ffb24facb26dcae86e95f821856747d1c31426457d321cb2e487e1&AWSAccessKeyId=AKIAJ4IAZE5EOI7PA7VQ&Expires=1353756170&Signature=Q8ZhVh2S7ZvRNrnPeKMCY%2FhCl2E%3D]
    X-Varnish[420384860]
    X-Cache[MISS]
    Date[Sat, 24 Nov 2012 11:16:00 GMT]
    Cache-Control[no-cache]
    Age[0]
    Access-Control-Allow-Methods[GET, PUT, POST, DELETE]
    X-Runtime[14]
    Access-Control-Expose-Headers[Date]
    Access-Control-Allow-Headers[Accept, Authorization, Content-Type, Origin]
    Server[nginx]
    Keep-Alive[timeout=5]
    Connection[Keep-Alive]
    Proxy-Connection[Keep-Alive]

    12:16:26.233[430ms][total 4681ms] Status: 200[OK]
    GET http://ec-media.soundcloud.com/4wBtAmevZJkU.128.mp3?ff61182e3c2ecefa438cd02102d0e385713f0c1faf3b0339595666f90800ed15a826ef5293b6ad9fcb33ffb24facb26dcae86e95f821856747d1c31426457d321cb2e487e1&AWSAccessKeyId=AKIAJ4IAZE5EOI7PA7VQ&Expires=1353756170&Signature=Q8ZhVh2S7ZvRNrnPeKMCY%2FhCl2E%3D Load Flags[LOAD_DOCUMENT_URI LOAD_REPLACE LOAD_INITIAL_DOCUMENT_URI ] Content Size[4642271] Mime Type[audio/mpeg]
    Request Headers:
    Host[ec-media.soundcloud.com]
    User-Agent[Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[nl,en-us;q=0.7,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Proxy-Connection[keep-alive]
    Response Headers:
    Content-Type[audio/mpeg]
    Content-Length[4642271]
    X-Amz-Meta-Duration[290169]
    X-Amz-Meta-Job[4wBtAmevZJkU]
    X-Amz-Id-2[71CW4Y3nVq6TJrqKNXsdgPMvWUS1QmTch1z9x9u3V4voVm1OQJ1edA7jngs/Q4yr]
    Date[Sat, 24 Nov 2012 11:16:00 GMT]
    Cache-Control[max-age=252460800]
    X-Cache[HIT]
    X-Amz-Request-Id[3FCFC7577DAA11EF]
    X-Amz-Version-Id[Pf7cBj1iUxYbXm7T4Ra7GDRazH3.GV4o]
    Etag["3738a8f86fe8628bb9b3467d6a59a2c0"]
    X-Amz-Meta-Bitrate[128]
    Last-Modified[Wed, 21 Nov 2012 01:59:12 GMT]
    Accept-Ranges[bytes]
    Server[ECAcc (ams/D18A)]
    Keep-Alive[timeout=5]
    Connection[Keep-Alive]
    Proxy-Connection[Keep-Alive]

    1. They moved the URL from where they serve media to “”http://hypem.com/serve/source/” rather than “http://hypem.com/serve/play/”.
      If you use the new URL you’ll see the new JSON data! :)

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 class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">