When you look at the page source of any Hulu player page, you see a block of code like this:
Code: Select all
<script type="text/javascript">/*<![CDATA[*/
current_video_cid = "f5bd3dba84d3573fdb7611ee9f20addf";
UserHistory.add_watched_history(50004271);
function carouselOffset(carouselId) {
if (/([a-z])(\d+)/.test(window.location.hash))
if (RegExp.$1 == carouselId && RegExp.$2)
return parseInt(RegExp.$2);
return 0;
}
Code: Select all
http://www.hulu.com/stand_alone/f5bd3dba84d3573fdb7611ee9f20addf
I already have this working in the game using a hard-coded video URL. The problem is, in order to make that URL you have to dig through the source code manually in order to find that string. I want to automate this process to make it more user-friendly, so all you have to do is enter the plain URL from the address bar and the script takes care of the rest. (That would be best, especially considering the level of idiocy in the help forum on Facepunch. )
Yes, this is based off the YouTube in-game player. I tried using the Hulu embedded player, since their embedded player doesn't have an autoplay feature. The "pop-out" player accomplishes the same thing, but plays automatically.
This is definitely possible somehow, since (as far as I can tell) that is how Boxee handles full screen Hulu playback.
It would be great if this could be done in Javascript, because then it can be integrated into the addon without relying on an external webserver. (The addon can generate a temporary HTML page from scratch by itself; that's how it displays the YouTube embedded player.)
Thanks!
EDIT: I think this might be possible with plain old LUA, adapting this example for the job:
http://lua-users.org/wiki/GettingTheTitleFromHtmlFiles" onclick="window.open(this.href);return false;
yes/no?