chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 583 forks source link

Plugin for Daisuki.net? #806

Open TennoDiablo opened 9 years ago

TennoDiablo commented 9 years ago

http://www.daisuki.net/

That´s another service which streams Anime (legal of course) like Crunchyroll.

fb39ca4 commented 9 years ago

Here is a forum thread that has some useful information.

http://forum.videohelp.com/threads/369812-How-to-Rip-From-Daisuki-net

Basically, we want to get the URL for a manifest.f4m file, substitute a few strings in that URL, and this will get us the URL for a m3u8 playlist that can then be played.

Now, the trick is getting that URL. It appears to be computed by the site's Flash player, which has the following intiialization code inline in the webpage for an episode:

var flashvars = {
    's':"ServerControlled",
    "mv_id":"",
    "device_cd":"1",
    "ss1_prm":"59",
    "ss2_prm":"11472",
    "ss3_prm":"US",

    //?????
    'country':'/common2/pages/anime/swf/country.xml',
    'serverIP':'/common2/pages/anime/swf/serverip.xml',
    'init':'/fastAPI/bgn/init/',
};

var params = {
    allowScriptAccess:"always", 
    allowfullscreen :'true',
    wmode :"transparent"
};
var attrs = {};
swfobject.embedSWF('http://img.daisuki.net/common2/pages/anime/swf/bngn_player_001.swf', "bngn-player", "854", "480", "12.0.0", null, flashvars, params, attrs);

The interesting variables are ss1_prm and ss2_prm, which appear to determine the show and episode. I've been looking at the decompiled code from the flash player, but can't seem to follow what it is doing with them to get the manifest URL.

intact commented 9 years ago

https://gist.github.com/intact/3d6af5f361c1a44fd878

fb39ca4 commented 9 years ago

Cool. I also figured all of this out when I was working on a plugin for youtube-dl. One thing I realized is you don't have to include all of the code for RSA-encrypting a randomly generated AES key. You can just generate and encrypt a predefined key ahead of time. If we also implemented the pure-Python AES module from youtube-dl, we could remove the dependency on PyCrypto for this plugin.