Command line application that outputs Anime that is being stream from Safari and Chrome in JSON on OS X
Detectstream is a command line program utility for OS X that takes all the URLs and titles from open windows and tabs and detect Anime being stream on legal streaming sites and spit out the series title and episode. It works like this:
Here are the example of the outputs from the currently working program:
{"result":[{"browser":"Safari","title":"Sword Art Online II","season":0,"site":"daisuki","episode":1}]}
This will be the output when there is no match:
{"result":null}
This helper program is used in Hachidori and MAL Updater OS X for legal streaming detection support.
We currently Support Crunchyroll, Daisuki, Anime News Network Video Player, AnimeLab, Viz and Netflix (under Safari only). With the exception of Netflix, legal streaming detection supports work in Safari, Webkit and Chrome.
You can help us out by sending the page title and URL of the Anime Stream with the series title, episode, service name and page source by using this form https://docs.google.com/forms/d/1tuv5OhD71U8L_3NyZuuZii3_A3BHlUhPAfQkkicvciU/viewform
or
Fork this source code and add the necessary changes to improve the detection of various streaming sites.
Get the source and then type xcodebuild. You need to have Google Chrome instlalled to compile as it's used for the scripting bridge.
Get the source by typing 'git clone https://github.com/chikorita157/detectstream.git'
To compile, type: [] 'cd detectstream' [] 'xcodebuild'
The built program should be in the build/release
The following example is in Objective C. To include it on your project, just drag it to Resources. It will be copied to the resource folder of the application bundle.
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:[myBundle pathForResource:@"detectstream" ofType:@""]];
NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];
NSFileHandle *file;
file = [pipe fileHandleForReading];
[task launch];
NSData *data;
data = [file readDataToEndOfFile];
NSError* error;
NSDictionary* json = [NSJSONSerialization
JSONObjectWithData:data
options:kNilOptions
error:&error];
NSArray * a = [json objectForKey@"result"];
NSDictionary * d = [a objectAtIndex:0];
NSString * title = [d objectForKey@"title"];
NSNumber * episode = [d objectForKey@"episode"];
NSNumber * season = [d objectForKey@"season"];
NSString * site = [d objectForKey@"site"];
NSLog(@"%@ - %d - %d - %@, title, [episode intValue], [season intValue], site);
Licensed under the GNU Public License Version 3.