HypeMachine Cocoa Woes


So I’ve been working at trying to refit the Python batch downloader as a GUI application; specifically a mac application written in Cocoa. However, porting the existing code has been much more troublesome/difficult than I expected.


Each song link in HypeMachine is built using 2 tags: the song’s id and a key. With these two tags, the final url to stream the song is:

‘http://hypem.com/serve/play/’ + id + ‘/’ + key + ‘.mp3’

As far as I can tell from what I’ve determined (my javascript is pretty limited), is that the key’s are generated on the server side based on a timestamp. So if you look at my python code, I perform the following steps:

Running the above script multiple times appropriately generates different keys every time.

The key and ID are parsed from the HTML, where they occur in the following format:

The problem

I’ve been running into multiple problems porting this over to Objective-C cocoa. However the most damaging is the fact that I cannot seem to generate the appropriate HTML file. The HTML file I keep generating has invalid keys.

I am retrieving the HTML and parsing it similarly as I did in Python however the server is returning me invalid keys.

Not only are the keys invalid, however re-running my application, retrieves the same keys over and over. This helps confirm that they are feeding me garbage keys as they are not being properly dynamically generated. I’ve attempted to retrieve the keys in the following manner (both of which do not work):


If anyone has some ideas on how they can help me fix my problem please let me know via a comment, e-mail or my question at Stackoverflow. I’m also looking for help on setting up the GUI / Core data model for the application once I get this issue sorted out if you’d like to help in that respect as well.

6 Replies to “HypeMachine Cocoa Woes”

  1. @Anthony Volodkin:

    At least I’m not going crazy and you guys are doing something lol.

    What’s odd is that the Python script still works… so worst case scenario is I can run the script in the application but I’m confused why urllib2 works but not NSURLRequest….

    Any tips ? 😉

Leave a Reply

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