Kodi Community Forum
Hulu Plugin Development Thread - Developers only! - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Hulu Plugin Development Thread - Developers only! (/showthread.php?tid=45888)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19


- fvfv - 2010-06-10

Can you give me simple instructions as to where Am I supposed to place your plugin, but using the AddON Framework ?

Before, with plugins, it would be ~/.xbmc/plugins/video/hulu

Now, I assume is /usr/local/share/xbmc/addons
or
~/.xbmc/addons

But what exactly do I put in those folders ?

By looking at how skins and other addons are organized it looks something like
/usr/share/xbmc/addons/COM.FOR.SOME.WEB.SITE.X/...

What should I name the folder (com.myhuluplugin.hulu Huh??)


- peepsalot - 2010-06-15

I submitted a merge request for adding support of categorical videos. Any questions or comments on my changes?

Also, I just noticed this error on some videos:
Quote:21:43:09 M: 24723456 NOTICE: rtmpe://hulufs.fplive.net/hulu/376/50031376/mp4:HuluTranscode_145696_382108_383977_16x9_24fps_H264_400K.mp4?token=c3RhcnRfdGltZT0yMDEwMDYxNTAyNDMwNSZlbmRfdGltZT0yMDEwMDYxNTAyNDYwNSZkaWdlc3Q9MjQ0ZjQ3NDFkZGEzOTc0NTUyNDM4NjcyY2YxMDRkNTY=
21:43:09 M: 24731648 ERROR: Error Type: exceptions.AttributeError
21:43:09 M: 24731648 ERROR: Error Contents: 'list' object has no attribute 'len'
21:43:09 M: 24743936 ERROR: Traceback (most recent call last):
File "Q:\plugins\video\Hulu\default.py", line 57, in ?
modes ( )
File "Q:\plugins\video\Hulu\default.py", line 36, in modes
stream_media.Main()
File "Q:\plugins\video\Hulu\resources\lib\stream_hulu.py", line 17, in __init__
self.play()
File "Q:\plugins\video\Hulu\resources\lib\stream_hulu.py", line 168, in play
for i in range(2,pathSplit.len()):
AttributeError: 'list' object has no attribute 'len'

In stream_hulu.py, line 168 the "len" function is being called incorrectly as an attribute of pathSplit
Code:
for i in range(2,pathSplit.len()):
it should instead be:
Code:
for i in range(2,len(pathSplit)):

I didn't think it was worth creating another repo and merge request for that fix.

This error occurs for example when trying to view this video:
http://www.hulu.com/watch/125176/american-dad-may-the-best-stan-win#x-0,vepisode,1,0

However, even after fixing that python error, I get a 500 Internal Server Error. I'm not sure if there is something wrong with Hulu, or if the request being sent is bad. I have been getting these 500 errors on a lot of videos lately.
I tried viewing them directly in my desktop browser at hulu.com, and even then I can't view the video, so I guess something is wrong on their end?


- highlandsun - 2010-06-15

Thanks, I've merged your fixes. Dunno about that American Dad episode, but since it's getting 500 server error that pretty clearly says it's a problem on their end.


- hellguide - 2010-06-17

I've been trying to get this to compile on OSX for my AppleTV, has anyone made a port yet? I also just bought the Broadcom Crystal HD card to install inside of it to see if it works with doing HD on Hulu. I figure it would work since it provides .H264 acceleration that hulus videos are encoded in. Any help or binary would help me out a ton! Thanks! Smile


- highlandsun - 2010-06-19

So it looks like they've rolled out yet another new set of scripts for obfuscating their info. Time for someone else to step in and run with this. I've got other things to do...


- BlueCop - 2010-06-20

Thanks for all your work highlandsun! having a full featured rtmp library is amazing.

anyone actively working on this?

The cat seems to be winning. We need more clever mice.

I have been digging through the action script in the current swfs and I can see what is going on but I have zero experience in hashing or ciphers. I think I can handle all the other changes but I am not sure how to implement what is being done in the getContentId function in loadplayer.swf

I guess I have reading to do.


- BlueCop - 2010-06-20

I found a way to bypass the need for cid to eid conversion but it is only because they expose the eid in a stupid way. They give the eid in a fail safe embed url. It is just a hack and not really the proper way to fix things. I am also not even sure if the fail safe urls are ubiquitous. anyway hulu could easily remove them.

My understanding how things currently work.

1. Get Content ID or cid flash variables passed to loadplayer.swf
2. Process the cid in function getContentId in loadplayer to get real cid.
3. Convert the cid to eid. This is done with a base64 md5 of the cid + salt key
4. Use eid to build url to grab pid
the rest seems to be the same as it was.

We might be able to grab the pid directly with the proper cid but the way the site seems to always use eid now in my proxy logs. Before we used the cid to build a url that would we could grab the pid directly.

I went through and compared the keys used previously and the ones used now and everything seems to be the same. There is a new key in loadplayer.swf used in the getContentid function though. Also we will need the salt key they attach to the cid for converting to eid. This is present in IVideoMetadata.as in a few of the swfs.

So in summary I think we can get this working again if someone can get the cids processed properly. It is similar to the decrypt pid code and I tried to modify dec.py to work but I am doing something wrong.


Edit: I decided to take a break and watch a little hulu using the method to bypass the cid to eid.

I think there might be more going on now. On several episodes I seem to get 500 internal server errors when retrieving the smil. Other episodes work great and grab the smil fine. There might be more going on then I thought.


- kreach - 2010-06-20

The 500 issue is known. If you try to watch the same videos in a browser, you will also get the same error.


- BlueCop - 2010-06-20

kreach I think I was having a different problem because they worked fine in a browser.

I think I found the problem actually. the smil urls need more parameters in order to not get 500 errors. I have done some checking and can confirm that adding some extra parameters seems to fix the 500.
Adding "&np=1&pp=hulu&dp_id=hulu" to the end of the smil url fixed the 500 errors I was having.

after more investigation adding the "&np=1&pp=hulu&dp_id=hulu" will change the format of all smils to a new format. for some reason the server will give you the old format smil when you pass the smil url to server without the extra parameters but not all videos work.

I am working on updating the rtmp code for the new smil format. Once we have that I think all we need is a way to get the proper cid and and using it to build the eid.

Edit:
I got all the videos working from akamai with the new smils. They added mirrors of almost all videos on akamai to level3 as well. So we now have choices of which server to use really. I can't seem to build the rtmp parameters correctly for level3. I am not sure how to handle the tokens. Normally I would just dump the browser memory to grab the parameters but I can't seem to find a video that will use the level3 servers by default.

Does anyone know any videos that use exclusively level3 or limelight providers? I would like to get the code working correctly with them. I think the easiest way is to dump browser memory and then build the urls to match how they are done.

I searched through the action script for clues but I can only seem to find the old code for smils. I might just need to look harder and not just grep through it.

Edit 2: I got the CID processing working correctly but still having trouble getting the eid from this. I do an md5 of the cid + cidkey and convert the value to base64 but it isn't the value I expected.

Also looking into level3 more and I am seeing sessionids being passed in the rtmp url along with the auth token so we are going to need some more code to get level3 provider working. I think this might be because they are launching pay service and might need session verification.

I have a working play function for stream_hulu but only akamia servers work correctly. It also just grabs the eid from embed failsafe url. I wanted to post a proper version but if I can't figure this out I will just post the hackish code.

Edit 3: I think I got it. I need to remove the leading 'm' from the cid and xor with 3735928559(0xDEADBEEF) before calculating the the md5. I need look into how parseint() works in actionscript.


- BlueCop - 2010-06-22

SUCCESS!!

I finally got it working. it builds the eid from the cid correctly now

Just so everyone knows there are Doubles of almost all videos. In the Quality selection I added the provider so you can see which stream is from who. only akamai plays now. level3 does not work right because the rtmp parameters are not built right. I have not been able to figure this out. It is failing sending the playpath to the server. it might be a problem in the rtmp url or the playpath.

Never found any limelight videos to try. So i can't comment on that. I included some code that I think handles them but till I find one I won't know.

Also because they are serving these level3 mirrors the auto quality selection might not work as expected because the duplicate qualities and it might choose the wrong provider. I plan to add priority of one provider over another to the settings.

here is my current stream_hulu.py
http://pastebin.com/DWJDNegx

You should be able to replace the current stream_hulu.py

If anyone can look at the level3 and limelight to try to get those working that would be great.

I am unfamiliar with git or I would have tried to submit something. Also I am tired and going to go roll one up and take a nap.


- Jopplehead - 2010-06-23

Big Grin

BlueCop,

You are awesome... I replaced the .py file in kreachs plugin and it now works!

Thanks for your work!!


- BlueCop - 2010-06-23

Who else is interested in developing this plug-in? I am not trying to take over and am really not that interested in developing it. I do enjoy the plug-in immensely so as a consequence if it breaks then I will try to fix it if no one else does.

I am thinking that we should try to pick up some overall design plans to divide up tasks. I think some kind of layout would be good if collaboration is going to happen. I would like to unify the Most Popular as well as Recently Added categories and then have sub-categories for specifics by default with options to flatten if wanted. I think it will be more natural to navigate through.

They recently close an old feature request ticket I did 18 months ago requesting the ability to assign subtitles in plug-ins. Anyway it reminded me that I had already written code for subtitle support for on hulu. It converted the smi(sami) subtitles to srt and saved a copy locally. I am not sure if this is the best method currently but at the time xbmc didn't like the smi format they were using much. I couldn't assign a subtitle file in a plug-in at the time though. So I am going to try working on finishing up the stream_hulu cdn support and add subtitle support now that I can assign subtitles.

This plug-in was once hosted on the xbmc-addons svn. Does anyone care if I commit it back there? I just don't know git about git and I am familiar with svn. Also there are a couple other plug-ins I try to maintain there when I can.

I would really like to see support for these features.
Search
Captions Search
Collections
Recommendations
Movie Trailers
Log-in
Queue (add,delete,watch)
Subscriptions (sub and unsub).

I would like to be able to organize shows by network as well but I don't think hulu provides a list by network anymore. At least not one I would find.

I think this plug-in could be insanely great.
Any one else want to provide some input?


- kreach - 2010-06-23

Biggest concern is that we spend a lot of effort into this for Hulu to just make one change and render everything useless, especially the log-in features. However, search could probably be done through a third-party search engine like Bing.


- BlueCop - 2010-06-23

One thing we could do is support the User's queue and Subscriptions via their RSS feeds. You could make it public in hulu settings and we could access it with the plug-in with just a username. It would be pretty simple and I doubt it would break.

This way you could still use the website to manage your subscriptions and queue. Then you could pop over to hulu plug-in and see a list of your subed shows or your queue of content.

I think we could make it fairly fault tolerant so if one feature breaks it would not take down all functionality.


- BlueCop - 2010-06-24

kreach Wrote:Biggest concern is that we spend a lot of effort into this for Hulu to just make one change and render everything useless, especially the log-in features. However, search could probably be done through a third-party search engine like Bing.

Just out of curiosity why do you suggest a third party search?

The search method on the site seems pretty robust. I have been looking at advanced search and it has a lot of interesting parameters.

I found it most interesting that it returns results from other video hosting pages. I am looking into how this is done via video site maps that those providers submit to hulu. This is copied from the google video site maps. These can be crazy useful for building plug-ins for other streaming sites because you don't have to scrape the sites html to get a complete list of videos on the site. I know this is off topic but I thought it might be interesting to developers. I have been hunting and found a couple maps that seem to be updated regularly.

info on google video site maps.
http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=80472

Anyone interested in collaborating on this? I am not good at that just ask rwparris2 or jonm42. =P
If not and no one else has input then I will just do what I want.