berrange wrote: > Having thought about the problem a little more, I think it might not > actually be as hard to solve as I first feared. The youtube-dl python > program has some reasonably straightforward code for interpreting the > javascript unobfuscation code in the HTML5 player. It ought to be > possible to port this code to Perl without undue pain. Next time I get > some free time I'll attempt this and see if it gets us to a working > solution....
I've spent many hours hacking on the code today. I rewrote the youtube-dl python code for interpreting javascript in Perl, and have integrated it into the YouTube slimserver plugin code. So when we see an encrypted youtube stream signature we can evaluate the actual youtube javascript player code to decrypt (well unobfuscate) the signature. This lets us fetch the raw data stream once again ! I've successfully played a number of youtube streams by Blur and Creedence Clearwater Revival. Obviously not an exhaustive test, but it shows enough signs of life that this is worth sharing for others to try... As mentioned in my previous posting, you need to install Mozilla::CA, Net::SSLeay and IO::Socket::SSL from CPAN so that the plugin can deal with https URLs from youtube. My ported signature code requires that you install the JSON module too. So in addition to the instructions in my previous post, also run this. # cd /opt/ssods4/tmp # wget http://search.cpan.org/CPAN/authors/id/M/MA/MAKAMAKA/JSON-2.90.tar.gz # tar zxvf JSON-2.90.tar.gz # cd JSON-2.90 # ../../bin/perl Makefile.PL # make # make install # cd .. I have bundled the updated plugin code into a zip file for convenience, and attached it to this posting, as well as uploading it to https://www.berrange.com/~dan/YouTube-html5player-v0.16.zip So, recapping First, install the youtube plugin on your slimserver normally Second, make sure you have Mozilla::CA, Net::SSLeay, IO::Socket::SSL and JSON modules installed from CPAN (see instructions above or README.txt in my ZIP file) Third, copy the ProtocolHandler.pm, Signature.pm and JSInterp.pm files from my updated ZIP file into your slimserver plugin directory (/opt/ssods4/var/home/SqueezeboxServer/Cache/InstalledPlugins/Plugins/YouTube on my QNap NAS), replacing the original ProtocolHandler.pm that came with the youtube plugin I hope this works for other people too - I'm very unlikely to have any time to further hack on this myself if further problems are found, so perhaps the original author who wrote the youtube plugin will see this message and be able to integrate the changes into their officially hosted plugin in some nicer manner. +-------------------------------------------------------------------+ |Filename: YouTube-html5player-v0.16.zip | |Download: http://forums.slimdevices.com/attachment.php?attachmentid=17643| +-------------------------------------------------------------------+ ------------------------------------------------------------------------ berrange's Profile: http://forums.slimdevices.com/member.php?userid=64173 View this thread: http://forums.slimdevices.com/showthread.php?t=87731 _______________________________________________ plugins mailing list plugins@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/plugins