STV JS Remote Download
HTML
<a href="javascript:
(function() {
C_API_KEY = 'XHirSpNcri5gB07r6wGZdBcVOsuDBstQxffNw9DpfHtITzu43IePQaDcSmBT1_392ba7P8oepoqQKaa1eDSxAA';
var remoteDownload = function (telecastId, adFree, downloadFormats) {
var formatId = vm.DefaultDownloadFormatID();
if (adFree) {
adFree = vm.AutoAdCutEnabled();
}
if (downloadFormats && !downloadFormats.some(function (recordFormat) { return recordFormat.RecordingFormatId() == formatId; })) {
formatId = 5;
}
vm.gaSend('Download', formatId, adFree);
$.ajax({
url: '/STV/M/obj/cRecordOrder/croGetDownloadUrl2.cfm?TelecastId=' + telecastId + '&iFormat=' + formatId + '&bAdFree=' + adFree,
datatype: 'json'
}).done(function (data) {
var result = jQuery.parseJSON(data);
if (result.SUCCESS) {
var url = result.DOWNLOADURL;
var url = 'https://api.cloudconvert.com/convert?apikey=' + encodeURIComponent(C_API_KEY) + '&inputformat=mp4&outputformat=mp4&input=download&file=' + encodeURIComponent(url) + '&filename=' + prompt('Bitte wähle einen Dateinamen (ohne Dateierweiterung)') + '.mp4&converteroptions[video_codec]=copy&converteroptions[audio_codec]=copy&converteroptions[audio_all_streams]=true&converteroptions[subtitles_copy]=true&wait=true&download=true&save=true';
window.location = url;
}
else {
toastr.error(result.ERROR);
}
}).fail(function () {
toastr.error('Die Download-Anfrage konnte nicht bearbeitet werden.');
});
};
vm.downloadBtnClick = remoteDownload;
$('.fa-arrow-down').addClass('fa-cloud-upload');
})();">
STV JS Remote Download</a>
CSS
a {
display: block;
height: 7em;
width: 300px;
line-height: 6em;
background-color: #080000;
text-decoration: none;
color: #FFFFFF;
text-align: center;
}
a:after{
content: "Ziehe mich in deine Lesezeichenleiste!";
position: absolute;
margin-left: -240px;
width: 300px;
margin-top: 1em;
text-align: center;
color: #FFFFFF;
}