Skip to content

Instantly share code, notes, and snippets.

@qinlili23333
Created January 25, 2022 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qinlili23333/32b393069c1aad1e4e491683832e78f5 to your computer and use it in GitHub Desktop.
Save qinlili23333/32b393069c1aad1e4e491683832e78f5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Botu Predator
// @namespace https://qinlili.bid
// @version 0.1
// @description 截取博图加密PDF
// @author You
// @match *://www.cnbooksearch.com/CheckIpForRead.aspx?*
// @match *://*/*/CheckIpForRead.aspx?*
// @grant none
// @run-at document-body
// ==/UserScript==
(function() {
'use strict';
var loadUrl= new Function(document.body.getAttribute("onload").replace("javascript:","").replace("OpenURL","OpenUrlHook"));
document.body.onload="";
document.body.setAttribute("onload","");
console.log("catch onload event!")
window.OpenUrlHook=function(nouse0,pdfurl,nouse1,nouse2){
console.log("Got PDF URL:"+pdfurl);
fetch(pdfurl).then(res => res.blob().then(blob => {
var bloburl = URL.createObjectURL(blob);
var a = document.createElement('a');
var filename = "[尚未解密]"+document.title+".pdf";
a.href = bloburl;
a.download = filename;
a.click();
window.URL.revokeObjectURL(bloburl);
}))
}
loadUrl();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment