Last active
November 22, 2020 21:51
-
-
Save Gishi1/9e7f9272530c51271c951ff71d02d8d5 to your computer and use it in GitHub Desktop.
Funimation Downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Funimation Downloader | |
// @namespace funimation-downloader | |
// @description downloads from funimation | |
// @updateURL https://gist.githubusercontent.com/raw/e20456e1f36d05db74c5dde6308aa282/funimation-downloader.meta.js | |
// @downloadURL https://gist.githubusercontent.com/raw/9e7f9272530c51271c951ff71d02d8d5/funimation-downloader.user.js | |
// @include http://www.funimation.com/shows/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js | |
// @version 2 | |
// @grant none | |
// ==/UserScript== | |
$(document).ready(function () { | |
function injectStyles(rule) { | |
var div = $('<div />', { | |
html: '­<style>' + rule + '</style>' | |
}).appendTo('body'); | |
} | |
injectStyles('#blue,#red{width:220px;height:40px;text-align:center;color:#FFF;text-decoration:none;line-height:43px;font-family:Oswald,Helvetica;display:block}.downlod{padding:6px 6px 10px;background:#f0f0f0;background-image:-webkit-gradient(linear,0 0,0 100%,from(#D0D0D0),to(#f0f0f0));float:left;margin-right:20px;-webkit-border-radius:5px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.5) inset,0 1px 0 #FFF}#red{text-shadow:-1px -1px 0 #A84155;background:#D25068;border:1px solid #D25068;background-image:-webkit-gradient(linear,0 0,0 100%,from(#F66C7B),to(#D25068));-webkit-border-radius:5px;-webkit-box-shadow:0 1px 0 rgba(255,255,255,.5) inset,0 -1px 0 rgba(255,255,255,.1) inset,0 4px 0 #AD4257,0 4px 2px rgba(0,0,0,.5);float:left}#red:hover{background:#F66C7B;background-image:-webkit-gradient(linear,0 0,0 100%,from(#D25068),to(#F66C7B))}#blue:active,#red:active{-webkit-box-shadow:0 1px 0 rgba(255,255,255,.5) inset,0 -1px 0 rgba(255,255,255,.1) inset;position:relative;top:5px}#blue{text-shadow:-1px -1px 0 #2C7982;background:#3EACBA;border:1px solid #379AA4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#48C6D4),to(#3EACBA));-webkit-border-radius:5px;-webkit-box-shadow:0 1px 0 rgba(255,255,255,.5) inset,0 -1px 0 rgba(255,255,255,.1) inset,0 4px 0 #338A94,0 4px 2px rgba(0,0,0,.5)}#blue:hover{background:#48C6D4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#3EACBA),to(#48C6D4))}'); | |
if ($('.subscribe_now_message_playlist').length) { | |
$('#showsPlayer_main_container').remove(); | |
$('#show_video_player_free_member').append('<link href="https://cdn.rawgit.com/kmoskwiak/videojs-resolution-switcher/master/lib/videojs-resolution-switcher.css" rel="stylesheet" /><script src="https://cdn.rawgit.com/kmoskwiak/videojs-resolution-switcher/master/lib/videojs-resolution-switcher.js"></script><link href="//vjs.zencdn.net/5.8/video-js.min.css" rel="stylesheet" /><script src="//vjs.zencdn.net/5.8/video.min.js"></script><video id="example-2" class="video-js vjs-default-skin" controls width="640" height="360" data-setup=\'{ }\'></video>'); | |
$('<div class="downlod" id="powerplar"><a id="blue">Download</a></div><table class="thetable" style="width:100%"><tr><th class="dubbeddl"><h2 style="text-align:left;">Dubbed:</h2></th><th class="subbeddl"><h2 style="text-align:left;">Subbed:</h2></th></tr></table>').prependTo('p.basic-heading'); | |
} else { | |
$('<div class="downlod" id="powerplar"><a id="blue">Download</a></div><table class="thetable" style="width:100%"><tr><th class="dubbeddl"><h2 style="text-align:left;">Dubbed:</h2></th><th class="subbeddl"><h2 style="text-align:left;">Subbed:</h2></th></tr></table>').prependTo('#main-content'); | |
} | |
$('.thetable').hide(); | |
$.each(playersData, function (index, value) { | |
$.each(value, function (mdex, mvalue) { | |
if (mdex === 'playlist') { | |
$.each(mvalue, function (cdex, cvalue) { | |
$.each(cvalue, function (ldex, lvalue) { | |
if (ldex === 'items') { | |
$.each(lvalue, function (vdex, vvalue) { | |
var seriesname, | |
episodename, | |
thumbnail, | |
FUNImationID = null; | |
$.each(vvalue, function (invdex, invalue) { | |
switch (invdex) { | |
case 'artist': | |
seriesname = invalue; | |
break; | |
case 'title': | |
episodename = invalue; | |
break; | |
case 'posterUrl': | |
thumbnail = invalue; | |
break; | |
case 'videoSet': | |
$.each(invalue, function (fdex, fvalue) { | |
var clang, | |
keys, | |
sdurl, | |
hdUrl, | |
hd1080Url = null; | |
$.each(fvalue, function (ndex, nvalue) { | |
switch (ndex) { | |
case 'languageMode': | |
clang = nvalue; | |
break; | |
case 'authToken': | |
keys = nvalue; | |
break; | |
case 'sdUrl': | |
sdurl = nvalue.replace(',750,1500,K.mp4.m3u8', '1500K.mp4.m3u8'); | |
break; | |
case 'hdUrl': | |
hdUrl = nvalue.replace(',750,1500,2000,2500,K.mp4.m3u8', '2500K.mp4.m3u8'); | |
break; | |
case 'hd1080Url': | |
hd1080Url = nvalue.replace(',750,1500,2000,2500,4000,K.mp4.m3u8', '4000K.mp4.m3u8'); | |
break; | |
case 'FUNImationID': | |
FUNImationID = nvalue; | |
break; | |
} | |
}); | |
var dub480, dub720, dub1080 = null; | |
if (clang === 'dub') { | |
if (sdurl !== null) { | |
dub480 = '<div class="downlod" ><a href="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-1500K.mp4' + keys + '" id="red" download="' + seriesname + ' - ' + episodename + ' [480p].mp4">SD 480p<img height="100%" style="margen:20px;float:right;" src="' + thumbnail + '"></div>'; | |
} | |
if (hdUrl !== null) { | |
dub720 = '<div class="downlod" ><a href="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-2500K.mp4' + keys + '" id="red" download="' + seriesname + ' - ' + episodename + ' [720p]">HD 720p<img height="100%" style="margen:20px;float:right;" src="' + thumbnail + '"></div>'; | |
} | |
if (hd1080Url !== null) { | |
dub1080 = '<div class="downlod" ><a href="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-4000K.mp4' + keys + '" id="red" download="' + seriesname + ' - ' + episodename + ' [1080p]">HD 1080p<img height="100%" style="margen:20px;float:right;" src="' + thumbnail + '"></div>'; | |
} | |
$('.dubbeddl').append(dub480 + dub720 + dub1080); | |
} | |
var sub480, sub720, sub1080 = null; | |
if (clang === 'sub') { | |
if (sdurl !== null) { | |
sub480 = '<div class="downlod" ><a href="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-1500K.mp4' + keys + '" id="red" download="' + seriesname + ' - ' + episodename + ' [480p]">SD 480p<img height="100%" style="margen:20px;float:right;" src="' + thumbnail + '"></a></div>'; | |
} | |
if (hdUrl !== null) { | |
sub720 = '<div class="downlod" ><a href="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-2500K.mp4' + keys + '" id="red" download="' + seriesname + ' - ' + episodename + ' [720p]">HD 720p<img height="100%" style="margen:20px;float:right;" src="' + thumbnail + '"></a></div>'; | |
} | |
if (hd1080Url !== null) { | |
sub1080 = '<div class="downlod" ><a href="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-4000K.mp4' + keys + '" id="red" download="' + seriesname + ' - ' + episodename + ' [1080p]">HD 1080p<img height="100%" style="margen:20px;float:right;" src="' + thumbnail + '"></a></div>'; | |
} | |
$('.subbeddl').append(sub480 + sub720 + sub1080); | |
} | |
if(getUrlParameter('watch') === clang){ | |
if (sdurl !== null) { | |
var dub4801 = '<source src="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-1500K.mp4' + keys + ' " type="video/mp4" label="480p" />'; | |
} | |
if (hdUrl !== null) { | |
var dub7201 = '<source src="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-2500K.mp4' + keys + '" type="video/mp4" label="720p" />'; | |
} | |
if (hd1080Url !== null) { | |
var dub10801 = '<source src="http://wpc.8c48.edgecastcdn.net/008C48/SV/480/' + FUNImationID + '/' + FUNImationID + '-480-4000K.mp4' + keys + '" type="video/mp4" label="1080p" />'; | |
} | |
$('#example-2').append( dub4801 + dub7201 + dub10801 ); | |
} | |
}); | |
break; | |
} | |
}); | |
}); | |
} | |
}); | |
}); | |
} | |
}); | |
}); | |
$('#blue').click(function () { | |
$('.thetable').toggle(500); | |
}); | |
}); | |
var getUrlParameter = function getUrlParameter(sParam) { | |
var sPageURL = decodeURIComponent(window.location.search.substring(1)), | |
sURLVariables = sPageURL.split('&'), | |
sParameterName, | |
i; | |
for (i = 0; i < sURLVariables.length; i++) { | |
sParameterName = sURLVariables[i].split('='); | |
if (sParameterName[0] === sParam) { | |
return sParameterName[1] === undefined ? true : sParameterName[1]; | |
} | |
} | |
}; | |
videojs('example-2').videoJsResolutionSwitcher(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Valveplsfix