您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
免费下载penguinreaders的书pdf
// ==UserScript== // @name penguinreaders下载pdf // @namespace https://gf.qytechs.cn // @match https://www.penguinreaders.co.uk/ladybird-books/* // @grant GM_setClipboard // @run-at document-start // @version 1.0 // @author Gwen0x4c3 // @description 免费下载penguinreaders的书pdf // @license GPL // ==/UserScript== (function() { 'use strict'; function sel(selector) { return document.querySelector(selector); } function sels(selector) { return document.querySelectorAll(selector); } async function getBookUrl(nonce, prod_id) { const formData = new FormData(); formData.append('action', 'get_pdf_url'); formData.append('nonce', nonce); formData.append('prod_id', prod_id); return await fetch(`https://www.penguinreaders.co.uk/wp-admin/admin-ajax.php`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" }, body: new URLSearchParams(formData).toString() }).then(res => res.json()); } function hookRequest() { const originalOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(method, url) { if (url.includes('generate_pdf_button')) { this.addEventListener('readystatechange', async function() { if (this.readyState == 4) { const nonceRegex = /nonce:\s*'([^']+)'/; const prodIdRegex = /prod_id:\s*(\d+)/; const nonceMatch = this.responseText.match(nonceRegex); const prodIdMatch = this.responseText.match(prodIdRegex); if (nonceMatch && nonceMatch[1] && prodIdMatch && prodIdMatch[1]) { const nonce = nonceMatch[1]; const prodId = parseInt(prodIdMatch[1], 10); const res = await getBookUrl(nonce, prodId); if (!res.result) { return; } const bookUrl = res.url; console.log(bookUrl) const buttonRow = sel('.button-row'); const button = document.createElement('button'); button.className = 'link-button' button.textContent = 'DOWNLOAD BOOK'; button.onclick = e => { // const a = document.createElement('a'); // a.href = bookUrl; // a.download = sel('.section-hero-book .section-title').innerText; GM_setClipboard(sel('.section-hero-book .section-title').innerText, 'text/plain'); // a.target = '_blank'; // a.click(); window.open(bookUrl + `&prod_id=${prodId}&label=View%20Book`); } buttonRow.prepend(button); } else { console.error('未获取到呢'); } } }) } originalOpen.apply(this, arguments); } } function remove() { if (!sel('.download-bar')) { return setTimeout(remove, 300); } const fades = sels('.download-bar-fade'); for (const fade of fades) { fade.remove(); } } remove(); hookRequest(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址