Getting Pandora to work again on classic Rokus

 I own a couple of classic Roku boxes, the N1000 (the very first Roku box, retroactively named the HD) and 2100X (Roku XD|S). While these not-so-little boxes were pretty revolutionary in their time, nowadays they don't do quite as much. Not only did pretty much every service drop support for these models, you can't even activate them anymore. You have to do this shoddy activation bypass, which leaves you with the absolute bare minimum of a Roku- settings and a screensaver. Thankfully, nothing stops you from enabling Developer Mode, and with that, you can make your own channels. I've made a few of these for myself, most notably an IPTV viewer and a Jellyfin client.

And then, I got another Roku. Not just any Roku, though. I got a Roku that was vulnerable to a root exploit. And, using that, I was able to access the channels on that device.

I messed with a few of them, but most lead to dead ends. Random and/or discontinued services, or services that stopped these old channels and devices from accessing the service (e.g. Netflix, which returned an error along the lines of "Netflix is no longer available on this device. (R10-1)"). But, of all of them, one stood out. The Pandora app worked perfectly fine on the rooted box... but not on the classic boxes. I originally dismissed this, assuming it was just an issue with an insecure connection that I couldn't do anything about. But, eventually, I dug into it, and actually managed to get it to function completely on classic boxes.

How?

First, the easiest of them all, I put in new certs. To be honest, I have no clue if I even needed to do this, but I figure there's no harm in doing so.

Then, I looked at the error code I was getting. Despite the channel itself not using the information, the API was returning specific error codes, which were helpfully commented in the code. The first error I came across was 1034 - ERROR_DEVICE_DISABLED.

I had no clue what this meant, so I tried changing my device model being sent to Pandora from "roku-2100X" (the Roku XD|S model number) to "roku-3100X" (the Roku 2 XS model number), and we got a new error. 1023 - DEVICE_MODEL_INVALID. 

At least this one was pretty easy to figure out. In the code, there is a section that changes the model to "roku-aac-<model>" if the device "supports AAC". So, I changed it to "roku-aac-3100X", which worked! 

And, lastly, the roughest issue of all, actually getting stations to play. The classic Roku models lack support for AAC ADTS, which is the only thing Pandora would send. I was totally stumped here. I checked and changed everything I could see, and nothing made it work. Until, eventually, I found https://6xq.net/pandora-apidoc/. Even though the Roku channel uses an XML API, I looked in the JSON API specifications for station.getPlaylist, and sure enough, I found the solution to my woes.

A parameter called "additionalAudioUrl" allows you to get the audio in a different codec. After some trial and error, I found out that all of the codecs listed except for AACPLUS_ADTS (which the classic Roku boxes don't support) and WMA (which returned an HTTP 500 error) worked. I ultimately settled on AACPLUS.

https://cdn.discordapp.com/attachments/1490102606368866447/1570558717668368534/dev.png?ex=6af78849&is=6af636c9&hm=73a0fa666ae7907f0ac9605ba45b7b1092931413c25f4c3bb12be22b58c837d9 

Why?

Getting even one streaming service to work again on the classic Roku box is a wonderful feat. Local media is great, but sometimes you want to just stream, worry-free, which was the entire goal of the Roku in the first place. Also, Pandora just works on pretty much everything.

Notes

To my knowledge, this does not bypass any paid features of Pandora. Even if it did, I'm a paying customer, so I would have no way of knowing. The one, sole goal of this work, was to make Pandora function on this device again, not to abuse their services. Also, I haven't distributed this anywhere. Please, don't sue me. :-D

Popular posts from this blog

How does the Roku 3 fare today?