Skip to content

Instantly share code, notes, and snippets.

@knowlet
Created May 25, 2022 14:57
Show Gist options
  • Save knowlet/d19fae9419b40ed3e3ada614e0921e15 to your computer and use it in GitHub Desktop.
Save knowlet/d19fae9419b40ed3e3ada614e0921e15 to your computer and use it in GitHub Desktop.
Garage Play 無限試看
// ==UserScript==
// @name Free GP+
// @namespace knowlet.me
// @version 0.1
// @description unlimited gp+ video preview.
// @author You
// @match https://garageplay.tw/vod/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=garageplay.tw
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
// Your code here...
// the easy bypass
// var hackHandler = setInterval(function(){
// if (unsafeWindow.rmp !== null) {
// unsafeWindow.rmp.pause = null;
// clearInterval(hackHandler);
// console.log('hacked');
// }
// }, 1000);
var elementID = 'player';
var rmp = null;
var modal_type = '';
var processing = false;
unsafeWindow.open_player = () => {
var vid = Number(location.pathname.split('/').pop());
$("#rmp-modal-1").addClass("go-left");
$("body").parent().css("overflow-y","hidden");
document.documentElement.style.overflow='hidden';//電腦端禁止滑動
document.body.style.overflow='hidden';//手機端禁止滑動
if (rmp===null) {
new_player(vid, /*"https://flicksbank.console360.net/images/3688/poster_horizon/default.jpg", */
"https://flicksbank.console360.net/images/"+vid+"/gpmovie/1920x1080.jpg");
}
}
function new_player(id, poster) {
if (rmp !== null) {
rmp.destroy();
$('#'+elementID).empty();
}
if (processing) return false;
processing = true;
// hack bearer
var [bearer1, bearer2] = unsafeWindow.new_player.toString().match(/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.{279}/g);
// hack token
var [token1, token2] = unsafeWindow.new_player.toString().match(/_definst_.*\d/g);
var settings = {
licenseKey: 'Kl8lZD1vPWR2Z2M9NjI3ND9yb201ZGFzaXMzMGRiMEElXyo=',
contentMetadata: {
poster: [ poster ],
},
/*
//hideModule: {
// quality: true,
// volume: true,
//},
*/
src : {
dash: "https://gpx-garageplay.cdn.hinet.net/garageplay-gpx/" + token1,
fps: "https://gpx-garageplay.cdn.hinet.net/garageplay-gpx/" + token2,
},
shakaRequestConfiguration: {
license: {
headers: {
'Authorization': 'Bearer ' + bearer1
}
}
},
shakaCustomConfig: {
abr: {
bandwidthDowngradeTarget: 0.95,
bandwidthUpgradeTarget: 0.85,
defaultBandwidthEstimate: 5000000,
enabled: true,
switchInterval: 8
},
drm: {
servers: {
'com.widevine.alpha': 'https://gpxams1.keydelivery.japanwest.media.azure.net/Widevine/?KID=cc210820-2bcd-4ea0-b7c0-780a880a9e8e',
'com.microsoft.playready': 'https://gpxams1.keydelivery.japanwest.media.azure.net/PlayReady/'
}
}
},
fpsDrm: {
certificatePath: 'https://kinostream.com/drm/fps/cer',
processSpcPath: 'https://gpxams1.keydelivery.japanwest.media.azure.net/FairPlay/?KID=83464acf-b875-4050-adfa-272baa96895c',
licenseRequestHeaders: [
{
name: 'Authorization',
value: 'Bearer ' + bearer2
},
{
name: 'Content-Type',
value: 'application/x-www-form-urlencoded'
}
]
},
autoHeightMode: true,
preload: 'none',
// adBlockerDetection: true,
// adBlockerDetectedPreventPlayback: true,
// adLoadMediaTimeout: 30000,
speed: true,
speedRates: [0.5, 1, 1.5, 2],
pip: true,
googleCast: true,
googleCastReceiverAppId: "FBC3AC44",
adLocale: 'zh_tw',
// ads: true,
// adTagUrl: 'https://garageplay.tw/api/ad'
};
rmp = new RadiantMP(elementID);
var rmpContainer = document.getElementById(elementID);
rmpContainer.addEventListener('ratechange', function() {
//console.log('rate change!');
var rate = rmp.getPlaybackRate();
if (rate==-1||rate==0) {
} else if (rate==1) {
rmp.setBitrate(-1);
} else {
//rmp.setBitrate(0);
rmp.setBitrate(-1);
}
});
rmpContainer.addEventListener('ready', function() {
$('.rmp-quality').css({'opacity': 0, 'visibility': 'hidden'});
$('.rmp-speed').css({'opacity': 0, 'visibility': 'hidden'});
$('.rmp-pip').css({'opacity': 0, 'visibility': 'hidden'});
});
rmpContainer.addEventListener('firstframe', function() {
$('.rmp-quality').css({'opacity': '', 'visibility': ''});
$('.rmp-speed').css({'opacity': '', 'visibility': ''});
$('.rmp-pip').css({'opacity': '', 'visibility': ''});
});
rmp.init(settings);
modal_type = '#member';
// setInterval(function(){
// if (!rmp.getPaused() && rmp.getCurrentTime() > 0 ) {
// rmp.pause();
// rmp.setFullscreen(false);
// //rmp.destroy();
// //window.alert("加入會員,即可享30天線上電影免費無限暢看。");
// //location.href = "/subscribe";
// //$('#player').click(function(){
// // $('#member').modal('show');
// //});
// //$('.rmp-overlay-button').click(function(){
// // $('#member').modal('show');
// //});
// //$('#member').modal('show');
// $(modal_type).modal('show');
// }
// }, 5000);
}
//new_player(3688, "https://flicksbank.console360.net/images/3688/poster_horizon/default.jpg"/*, "https://flicksbank.console360.net/images/3688/gpmovie/1920x1080.jpg"*/);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment